mirror of
https://github.com/SimplexDevelopment/SimplexCore.git
synced 2024-12-22 00:37:36 +00:00
BLEEDING-EDGE v1.3_01
- Removed some static abuse - Moved TimeValues to their own class - Renamed package to simplexdev from paldiu - Moved interface classes to a respective api package - Removed Lisp
This commit is contained in:
parent
a06ba4db5d
commit
549187b450
@ -1,4 +0,0 @@
|
||||
package io.github.paldiu.simplexcore.concurrent;
|
||||
|
||||
public final class TaskFactory {
|
||||
}
|
@ -1,96 +0,0 @@
|
||||
package io.github.paldiu.simplexcore.utils;
|
||||
|
||||
import io.github.paldiu.simplexcore.SimplexCorePlugin;
|
||||
import io.github.paldiu.simplexcore.command.CommandLoader;
|
||||
import io.github.paldiu.simplexcore.config.Yaml;
|
||||
import io.github.paldiu.simplexcore.config.YamlFactory;
|
||||
import io.github.paldiu.simplexcore.plugin.AddonRegistry;
|
||||
import io.github.paldiu.simplexcore.plugin.DependencyManagement;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public final class Constants {
|
||||
private static final SimplexCorePlugin plugin = JavaPlugin.getPlugin(SimplexCorePlugin.class);
|
||||
private static final Server server = plugin.getServer();
|
||||
private static final Logger logger = plugin.getLogger();
|
||||
private static final PluginManager manager = server.getPluginManager();
|
||||
private static final BukkitScheduler scheduler = server.getScheduler();
|
||||
private static final DependencyManagement dpm = new DependencyManagement();
|
||||
private static final Yaml config = new YamlFactory(plugin).setDefaultPathways();
|
||||
private static final TimeValues time = new TimeValues();
|
||||
// Utility class should not be instantiated.
|
||||
private Constants() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
public static SimplexCorePlugin getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public static Server getServer() {
|
||||
return server;
|
||||
}
|
||||
|
||||
public static Logger getLogger() {
|
||||
return logger;
|
||||
}
|
||||
|
||||
public static PluginManager getManager() {
|
||||
return manager;
|
||||
}
|
||||
|
||||
public static BukkitScheduler getScheduler() {
|
||||
return scheduler;
|
||||
}
|
||||
|
||||
public static synchronized AddonRegistry getRegistry() {
|
||||
return AddonRegistry.getInstance();
|
||||
}
|
||||
|
||||
public static synchronized CommandLoader getCommandLoader() {
|
||||
return CommandLoader.getInstance();
|
||||
}
|
||||
|
||||
public static DependencyManagement getDependencyManager() {
|
||||
return dpm;
|
||||
}
|
||||
|
||||
public static TimeValues getTimeValues() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public static Yaml getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
public static class TimeValues {
|
||||
public long SECOND() {
|
||||
return 20L;
|
||||
}
|
||||
|
||||
public long MINUTE() {
|
||||
return 1200L;
|
||||
}
|
||||
|
||||
public long HOUR() {
|
||||
return 72000L;
|
||||
}
|
||||
|
||||
public long DAY() {
|
||||
return 1728000L;
|
||||
}
|
||||
|
||||
public long MONTH() {
|
||||
return 51840000L;
|
||||
}
|
||||
|
||||
public long YEAR() {
|
||||
return 622080000L;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
package io.github.paldiu.simplexcore.ban;
|
||||
package io.github.simplexdev.api;
|
||||
|
||||
import io.github.simplexdev.simplexcore.ban.BanType;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
@ -1,5 +1,6 @@
|
||||
package io.github.paldiu.simplexcore.config;
|
||||
package io.github.simplexdev.api;
|
||||
|
||||
import io.github.simplexdev.api.func.Path;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import java.util.List;
|
@ -1,5 +1,6 @@
|
||||
package io.github.paldiu.simplexcore.gui;
|
||||
package io.github.simplexdev.api;
|
||||
|
||||
import io.github.simplexdev.api.func.Action;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
@ -1,4 +1,4 @@
|
||||
package io.github.paldiu.simplexcore.particle;
|
||||
package io.github.simplexdev.api;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Particle;
|
@ -1,4 +1,4 @@
|
||||
package io.github.paldiu.simplexcore.potion;
|
||||
package io.github.simplexdev.api;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.NamespacedKey;
|
@ -1,6 +1,6 @@
|
||||
package io.github.paldiu.simplexcore.structures;
|
||||
package io.github.simplexdev.api;
|
||||
|
||||
import io.github.paldiu.simplexcore.math.Size;
|
||||
import io.github.simplexdev.simplexcore.math.Size;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.World;
|
@ -1,4 +1,4 @@
|
||||
package io.github.paldiu.simplexcore.sign;
|
||||
package io.github.simplexdev.api;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
@ -1,4 +1,4 @@
|
||||
package io.github.paldiu.simplexcore.command;
|
||||
package io.github.simplexdev.api.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
@ -1,4 +1,4 @@
|
||||
package io.github.paldiu.simplexcore.gui;
|
||||
package io.github.simplexdev.api.func;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package io.github.paldiu.simplexcore.functional;
|
||||
package io.github.simplexdev.api.func;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface Guard {
|
@ -1,4 +1,4 @@
|
||||
package io.github.paldiu.simplexcore.config;
|
||||
package io.github.simplexdev.api.func;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface Path {
|
@ -1,4 +1,4 @@
|
||||
package io.github.paldiu.simplexcore.functional;
|
||||
package io.github.simplexdev.api.func;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface Validate {
|
@ -1,6 +1,6 @@
|
||||
package io.github.paldiu.simplexcore;
|
||||
package io.github.simplexdev.simplexcore;
|
||||
|
||||
import io.github.paldiu.simplexcore.utils.Constants;
|
||||
import io.github.simplexdev.simplexcore.utils.Constants;
|
||||
|
||||
public class CoreState {
|
||||
String message;
|
@ -1,11 +1,12 @@
|
||||
package io.github.paldiu.simplexcore;
|
||||
package io.github.simplexdev.simplexcore;
|
||||
|
||||
import io.github.paldiu.simplexcore.command.defaults.Command_info;
|
||||
import io.github.paldiu.simplexcore.concurrent.Announcer;
|
||||
import io.github.paldiu.simplexcore.listener.DependencyListener;
|
||||
import io.github.paldiu.simplexcore.listener.SimplexListener;
|
||||
import io.github.paldiu.simplexcore.plugin.SimplexAddon;
|
||||
import io.github.paldiu.simplexcore.utils.Constants;
|
||||
import io.github.simplexdev.simplexcore.command.defaults.Command_info;
|
||||
import io.github.simplexdev.simplexcore.concurrent.Announcer;
|
||||
import io.github.simplexdev.simplexcore.listener.DependencyListener;
|
||||
import io.github.simplexdev.simplexcore.listener.SimplexListener;
|
||||
import io.github.simplexdev.simplexcore.plugin.SimplexAddon;
|
||||
import io.github.simplexdev.simplexcore.utils.Constants;
|
||||
import io.github.simplexdev.simplexcore.utils.Instances;
|
||||
|
||||
// This comment was added to force a test on Jenkins AutoBuild
|
||||
// https://jenkins.coomware.dev/job/SimplexCore
|
||||
@ -13,29 +14,24 @@ public final class SimplexCorePlugin extends SimplexAddon<SimplexCorePlugin> {
|
||||
protected static boolean debug = false;
|
||||
protected static boolean suspended = false;
|
||||
|
||||
public static boolean isDebug() {
|
||||
return debug;
|
||||
}
|
||||
|
||||
public static void setDebug(boolean enable) {
|
||||
debug = enable;
|
||||
}
|
||||
|
||||
public static boolean isSuspended() {
|
||||
return suspended;
|
||||
}
|
||||
protected Instances instances;
|
||||
|
||||
@Override
|
||||
public SimplexCorePlugin getPlugin() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
instances = new Instances();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
try {
|
||||
Constants.getRegistry().register(this);
|
||||
Constants.getCommandLoader().classpath(Command_info.class).load();
|
||||
Constants.getConfig().reload();
|
||||
instances.getRegistry().register(this);
|
||||
instances.getCommandLoader().classpath(Command_info.class).load();
|
||||
instances.getConfig().reload();
|
||||
//
|
||||
SimplexListener.register(new DependencyListener(), this);
|
||||
new Announcer();
|
||||
@ -52,4 +48,20 @@ public final class SimplexCorePlugin extends SimplexAddon<SimplexCorePlugin> {
|
||||
public void stop() {
|
||||
|
||||
}
|
||||
|
||||
public static boolean isDebug() {
|
||||
return debug;
|
||||
}
|
||||
|
||||
public static void setDebug(boolean enable) {
|
||||
debug = enable;
|
||||
}
|
||||
|
||||
public static boolean isSuspended() {
|
||||
return suspended;
|
||||
}
|
||||
|
||||
public final Instances getInstances() {
|
||||
return instances;
|
||||
}
|
||||
}
|
@ -1,10 +1,12 @@
|
||||
package io.github.paldiu.simplexcore.ban;
|
||||
package io.github.simplexdev.simplexcore.ban;
|
||||
|
||||
import io.github.paldiu.simplexcore.chat.Messages;
|
||||
import io.github.paldiu.simplexcore.config.Yaml;
|
||||
import io.github.paldiu.simplexcore.config.YamlFactory;
|
||||
import io.github.paldiu.simplexcore.utils.Constants;
|
||||
import io.github.paldiu.simplexcore.utils.Utilities;
|
||||
import io.github.simplexdev.api.IBan;
|
||||
import io.github.simplexdev.simplexcore.chat.Messages;
|
||||
import io.github.simplexdev.simplexcore.config.Yaml;
|
||||
import io.github.simplexdev.simplexcore.config.YamlFactory;
|
||||
import io.github.simplexdev.simplexcore.utils.Constants;
|
||||
import io.github.simplexdev.simplexcore.utils.Utilities;
|
||||
import io.github.simplexdev.simplexcore.listener.SimplexListener;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -17,8 +19,8 @@ import java.util.Date;
|
||||
* This class provides a way for you to handle your own banning.
|
||||
* Simply extend this class and create a new instance of the subclass.
|
||||
* Alternatively, you may use {@link BanFactory#create} to create a new Ban instance.
|
||||
* Use this in synchrony with {@link io.github.paldiu.simplexcore.listener.SimplexListener} to process bans on player login/join.
|
||||
* Use this in synchrony with {@link io.github.paldiu.simplexcore.config.YamlFactory} to create a new yaml file to store your bans, or to create an individual yaml file per user ban.
|
||||
* Use this in synchrony with {@link SimplexListener} to process bans on player login/join.
|
||||
* Use this in synchrony with {@link YamlFactory} to create a new yaml file to store your bans, or to create an individual yaml file per user ban.
|
||||
*/
|
||||
public abstract class Ban implements IBan {
|
||||
private final Player player;
|
||||
@ -35,7 +37,7 @@ public abstract class Ban implements IBan {
|
||||
}
|
||||
|
||||
public Ban(Player player, CommandSender sender, BanType type) {
|
||||
this(player, sender, type, Constants.getTimeValues().DAY());
|
||||
this(player, sender, type, Constants.getPlugin().getInstances().getTimeValues().DAY());
|
||||
}
|
||||
|
||||
public Ban(Player player, CommandSender sender, BanType type, long banDuration) {
|
@ -1,9 +1,10 @@
|
||||
package io.github.paldiu.simplexcore.ban;
|
||||
package io.github.simplexdev.simplexcore.ban;
|
||||
|
||||
import io.github.paldiu.simplexcore.chat.Messages;
|
||||
import io.github.paldiu.simplexcore.functional.Guard;
|
||||
import io.github.paldiu.simplexcore.utils.Constants;
|
||||
import io.github.paldiu.simplexcore.utils.Utilities;
|
||||
import io.github.simplexdev.api.IBan;
|
||||
import io.github.simplexdev.simplexcore.chat.Messages;
|
||||
import io.github.simplexdev.api.func.Guard;
|
||||
import io.github.simplexdev.simplexcore.utils.Constants;
|
||||
import io.github.simplexdev.simplexcore.utils.Utilities;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -26,7 +27,6 @@ public final class BanFactory {
|
||||
this.type = type;
|
||||
|
||||
this.banReason = Messages.BAN.getMessage();
|
||||
assignBanDuration().verify();
|
||||
|
||||
banId = createBanId();
|
||||
}
|
||||
@ -99,11 +99,11 @@ public final class BanFactory {
|
||||
private Guard assignBanDuration() {
|
||||
return () -> {
|
||||
if (type.equals(BanType.PERMANENT)) {
|
||||
banDuration = Constants.getTimeValues().YEAR() * 99;
|
||||
banDuration = Constants.getPlugin().getInstances().getTimeValues().YEAR() * 99;
|
||||
} else if (type.equals(BanType.TEMPORARY)) {
|
||||
banDuration = Constants.getTimeValues().DAY();
|
||||
banDuration = Constants.getPlugin().getInstances().getTimeValues().DAY();
|
||||
} else {
|
||||
banDuration = Constants.getTimeValues().MINUTE() * 5;
|
||||
banDuration = Constants.getPlugin().getInstances().getTimeValues().MINUTE() * 5;
|
||||
}
|
||||
};
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package io.github.paldiu.simplexcore.ban;
|
||||
package io.github.simplexdev.simplexcore.ban;
|
||||
|
||||
public enum BanType {
|
||||
PERMANENT("P-"),
|
@ -1,6 +1,6 @@
|
||||
package io.github.paldiu.simplexcore.chat;
|
||||
package io.github.simplexdev.simplexcore.chat;
|
||||
|
||||
import io.github.paldiu.simplexcore.utils.Bean;
|
||||
import io.github.simplexdev.simplexcore.utils.Bean;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package io.github.paldiu.simplexcore.chat;
|
||||
package io.github.simplexdev.simplexcore.chat;
|
||||
|
||||
public enum Messages {
|
||||
NO_PERMS("You do not have permission to use this command!"),
|
@ -1,4 +1,4 @@
|
||||
package io.github.paldiu.simplexcore.chat;
|
||||
package io.github.simplexdev.simplexcore.chat;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
@ -1,7 +1,8 @@
|
||||
package io.github.paldiu.simplexcore.command;
|
||||
package io.github.simplexdev.simplexcore.command;
|
||||
|
||||
import io.github.paldiu.simplexcore.command.defaults.DefaultCommand;
|
||||
import io.github.paldiu.simplexcore.utils.Constants;
|
||||
import io.github.simplexdev.api.annotations.CommandInfo;
|
||||
import io.github.simplexdev.simplexcore.command.defaults.DefaultCommand;
|
||||
import io.github.simplexdev.simplexcore.utils.Constants;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.*;
|
||||
import org.bukkit.plugin.Plugin;
|
@ -1,7 +1,7 @@
|
||||
package io.github.paldiu.simplexcore.command;
|
||||
package io.github.simplexdev.simplexcore.command;
|
||||
|
||||
import io.github.paldiu.simplexcore.utils.Constants;
|
||||
import io.github.paldiu.simplexcore.utils.Utilities;
|
||||
import io.github.simplexdev.simplexcore.utils.Constants;
|
||||
import io.github.simplexdev.simplexcore.utils.Utilities;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
@ -1,7 +1,7 @@
|
||||
package io.github.paldiu.simplexcore.command.defaults;
|
||||
package io.github.simplexdev.simplexcore.command.defaults;
|
||||
|
||||
import io.github.paldiu.simplexcore.command.CommandInfo;
|
||||
import io.github.paldiu.simplexcore.command.SimplexCommand;
|
||||
import io.github.simplexdev.api.annotations.CommandInfo;
|
||||
import io.github.simplexdev.simplexcore.command.SimplexCommand;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
@ -1,7 +1,7 @@
|
||||
package io.github.paldiu.simplexcore.command.defaults;
|
||||
package io.github.simplexdev.simplexcore.command.defaults;
|
||||
|
||||
import io.github.paldiu.simplexcore.command.CommandInfo;
|
||||
import io.github.paldiu.simplexcore.command.SimplexCommand;
|
||||
import io.github.simplexdev.api.annotations.CommandInfo;
|
||||
import io.github.simplexdev.simplexcore.command.SimplexCommand;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
@ -1,7 +1,7 @@
|
||||
package io.github.paldiu.simplexcore.concurrent;
|
||||
package io.github.simplexdev.simplexcore.concurrent;
|
||||
|
||||
import io.github.paldiu.simplexcore.chat.Messages;
|
||||
import io.github.paldiu.simplexcore.utils.Constants;
|
||||
import io.github.simplexdev.simplexcore.chat.Messages;
|
||||
import io.github.simplexdev.simplexcore.utils.Constants;
|
||||
import org.apache.commons.lang.math.RandomUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
@ -1,7 +1,7 @@
|
||||
package io.github.paldiu.simplexcore.concurrent;
|
||||
package io.github.simplexdev.simplexcore.concurrent;
|
||||
|
||||
import io.github.paldiu.simplexcore.plugin.SimplexAddon;
|
||||
import io.github.paldiu.simplexcore.utils.Constants;
|
||||
import io.github.simplexdev.simplexcore.plugin.SimplexAddon;
|
||||
import io.github.simplexdev.simplexcore.utils.Constants;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.util.Date;
|
||||
@ -24,8 +24,8 @@ public abstract class SimplexTask implements Consumer<BukkitTask> {
|
||||
}
|
||||
|
||||
protected SimplexTask() {
|
||||
DELAY = Constants.getTimeValues().SECOND() * 30; // 30 seconds until the task triggers for the first time.
|
||||
INTERVAL = Constants.getTimeValues().MINUTE() * 5; // Task will run at 5 minute intervals once the first trigger has been called.
|
||||
DELAY = Constants.getPlugin().getInstances().getTimeValues().SECOND() * 30; // 30 seconds until the task triggers for the first time.
|
||||
INTERVAL = Constants.getPlugin().getInstances().getTimeValues().MINUTE() * 5; // Task will run at 5 minute intervals once the first trigger has been called.
|
||||
}
|
||||
|
||||
public <T extends SimplexTask> void register(T task, SimplexAddon<?> plugin, boolean repeating, boolean delayed) {
|
@ -0,0 +1,4 @@
|
||||
package io.github.simplexdev.simplexcore.concurrent;
|
||||
|
||||
public final class TaskFactory {
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package io.github.paldiu.simplexcore.config;
|
||||
package io.github.simplexdev.simplexcore.config;
|
||||
|
||||
import io.github.simplexdev.api.IConfig;
|
||||
import io.github.simplexdev.api.func.Path;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import java.util.List;
|
@ -1,4 +1,4 @@
|
||||
package io.github.paldiu.simplexcore.config;
|
||||
package io.github.simplexdev.simplexcore.config;
|
||||
|
||||
public final class JsonFactory {
|
||||
// TODO: Write a JSON Object Factory.
|
@ -1,7 +1,9 @@
|
||||
package io.github.paldiu.simplexcore.config;
|
||||
package io.github.simplexdev.simplexcore.config;
|
||||
|
||||
import io.github.paldiu.simplexcore.plugin.SimplexAddon;
|
||||
import io.github.paldiu.simplexcore.utils.Constants;
|
||||
import io.github.simplexdev.api.IConfig;
|
||||
import io.github.simplexdev.api.func.Path;
|
||||
import io.github.simplexdev.simplexcore.plugin.SimplexAddon;
|
||||
import io.github.simplexdev.simplexcore.utils.Constants;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
@ -1,7 +1,7 @@
|
||||
package io.github.paldiu.simplexcore.config;
|
||||
package io.github.simplexdev.simplexcore.config;
|
||||
|
||||
import io.github.paldiu.simplexcore.plugin.SimplexAddon;
|
||||
import io.github.paldiu.simplexcore.utils.Trio;
|
||||
import io.github.simplexdev.simplexcore.plugin.SimplexAddon;
|
||||
import io.github.simplexdev.simplexcore.utils.Trio;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -1,9 +1,10 @@
|
||||
package io.github.paldiu.simplexcore.gui;
|
||||
package io.github.simplexdev.simplexcore.gui;
|
||||
|
||||
import io.github.simplexdev.api.func.Action;
|
||||
import io.github.simplexdev.api.IGUI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
@ -1,5 +1,7 @@
|
||||
package io.github.paldiu.simplexcore.gui;
|
||||
package io.github.simplexdev.simplexcore.gui;
|
||||
|
||||
import io.github.simplexdev.api.func.Action;
|
||||
import io.github.simplexdev.api.IGUI;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
@ -1,7 +1,7 @@
|
||||
package io.github.paldiu.simplexcore.listener;
|
||||
package io.github.simplexdev.simplexcore.listener;
|
||||
|
||||
import io.github.paldiu.simplexcore.functional.Validate;
|
||||
import io.github.paldiu.simplexcore.utils.Constants;
|
||||
import io.github.simplexdev.api.func.Validate;
|
||||
import io.github.simplexdev.simplexcore.utils.Constants;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.server.PluginEnableEvent;
|
@ -1,7 +1,7 @@
|
||||
package io.github.paldiu.simplexcore.listener;
|
||||
package io.github.simplexdev.simplexcore.listener;
|
||||
|
||||
import io.github.paldiu.simplexcore.plugin.SimplexAddon;
|
||||
import io.github.paldiu.simplexcore.utils.Constants;
|
||||
import io.github.simplexdev.simplexcore.plugin.SimplexAddon;
|
||||
import io.github.simplexdev.simplexcore.utils.Constants;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
@ -1,6 +1,6 @@
|
||||
package io.github.paldiu.simplexcore.math;
|
||||
package io.github.simplexdev.simplexcore.math;
|
||||
|
||||
import io.github.paldiu.simplexcore.utils.Constants;
|
||||
import io.github.simplexdev.simplexcore.utils.Constants;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
@ -44,6 +44,6 @@ public final class Cuboid {
|
||||
|
||||
};
|
||||
|
||||
Constants.getScheduler().runTaskLaterAsynchronously(Constants.getPlugin(), task, Constants.getTimeValues().SECOND());
|
||||
Constants.getScheduler().runTaskLaterAsynchronously(Constants.getPlugin(), task, Constants.getPlugin().getInstances().getTimeValues().SECOND());
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package io.github.paldiu.simplexcore.math;
|
||||
package io.github.simplexdev.simplexcore.math;
|
||||
|
||||
import io.github.paldiu.simplexcore.utils.Constants;
|
||||
import io.github.simplexdev.simplexcore.utils.Constants;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
@ -1,4 +1,4 @@
|
||||
package io.github.paldiu.simplexcore.math;
|
||||
package io.github.simplexdev.simplexcore.math;
|
||||
|
||||
public enum Size {
|
||||
SMALL(1, 1, 1),
|
@ -1,6 +1,6 @@
|
||||
package io.github.paldiu.simplexcore.plugin;
|
||||
package io.github.simplexdev.simplexcore.plugin;
|
||||
|
||||
import io.github.paldiu.simplexcore.utils.Constants;
|
||||
import io.github.simplexdev.simplexcore.utils.Constants;
|
||||
|
||||
public final class AddonManager {
|
||||
public AddonManager() {
|
@ -1,4 +1,4 @@
|
||||
package io.github.paldiu.simplexcore.plugin;
|
||||
package io.github.simplexdev.simplexcore.plugin;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
@ -1,4 +1,4 @@
|
||||
package io.github.paldiu.simplexcore.plugin;
|
||||
package io.github.simplexdev.simplexcore.plugin;
|
||||
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
import com.comphenix.protocol.ProtocolManager;
|
@ -1,4 +1,4 @@
|
||||
package io.github.paldiu.simplexcore.plugin;
|
||||
package io.github.simplexdev.simplexcore.plugin;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.github.paldiu.simplexcore.potion;
|
||||
package io.github.simplexdev.simplexcore.potion;
|
||||
|
||||
import io.github.paldiu.simplexcore.utils.Utilities;
|
||||
import io.github.simplexdev.api.IPotionEffect;
|
||||
import io.github.simplexdev.simplexcore.utils.Utilities;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package io.github.paldiu.simplexcore.structures;
|
||||
package io.github.simplexdev.simplexcore.structures;
|
||||
|
||||
public class Structure {
|
||||
// TODO: Write this file to parse schematics.
|
@ -1,4 +1,4 @@
|
||||
package io.github.paldiu.simplexcore.utils;
|
||||
package io.github.simplexdev.simplexcore.utils;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
@ -0,0 +1,43 @@
|
||||
package io.github.simplexdev.simplexcore.utils;
|
||||
|
||||
import io.github.simplexdev.simplexcore.SimplexCorePlugin;
|
||||
import io.github.simplexdev.simplexcore.command.CommandLoader;
|
||||
import io.github.simplexdev.simplexcore.config.Yaml;
|
||||
import io.github.simplexdev.simplexcore.config.YamlFactory;
|
||||
import io.github.simplexdev.simplexcore.plugin.AddonRegistry;
|
||||
import io.github.simplexdev.simplexcore.plugin.DependencyManagement;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public final class Constants {
|
||||
private static final SimplexCorePlugin plugin = JavaPlugin.getPlugin(SimplexCorePlugin.class);
|
||||
private static final Server server = plugin.getServer();
|
||||
private static final Logger logger = plugin.getLogger();
|
||||
private static final PluginManager manager = server.getPluginManager();
|
||||
private static final BukkitScheduler scheduler = server.getScheduler();
|
||||
|
||||
public static SimplexCorePlugin getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public static Server getServer() {
|
||||
return server;
|
||||
}
|
||||
|
||||
public static Logger getLogger() {
|
||||
return logger;
|
||||
}
|
||||
|
||||
public static PluginManager getManager() {
|
||||
return manager;
|
||||
}
|
||||
|
||||
public static BukkitScheduler getScheduler() {
|
||||
return scheduler;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,33 @@
|
||||
package io.github.simplexdev.simplexcore.utils;
|
||||
|
||||
import io.github.simplexdev.simplexcore.command.CommandLoader;
|
||||
import io.github.simplexdev.simplexcore.config.Yaml;
|
||||
import io.github.simplexdev.simplexcore.config.YamlFactory;
|
||||
import io.github.simplexdev.simplexcore.plugin.AddonRegistry;
|
||||
import io.github.simplexdev.simplexcore.plugin.DependencyManagement;
|
||||
|
||||
public class Instances {
|
||||
private final DependencyManagement dpm = new DependencyManagement();
|
||||
private final Yaml config = new YamlFactory(Constants.getPlugin()).setDefaultPathways();
|
||||
private final TimeValues time = new TimeValues();
|
||||
|
||||
public synchronized AddonRegistry getRegistry() {
|
||||
return AddonRegistry.getInstance();
|
||||
}
|
||||
|
||||
public synchronized CommandLoader getCommandLoader() {
|
||||
return CommandLoader.getInstance();
|
||||
}
|
||||
|
||||
public DependencyManagement getDependencyManager() {
|
||||
return dpm;
|
||||
}
|
||||
|
||||
public TimeValues getTimeValues() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public Yaml getConfig() {
|
||||
return config;
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package io.github.simplexdev.simplexcore.utils;
|
||||
|
||||
public final class TimeValues {
|
||||
public long SECOND() {
|
||||
return 20L;
|
||||
}
|
||||
|
||||
public long MINUTE() {
|
||||
return 1200L;
|
||||
}
|
||||
|
||||
public long HOUR() {
|
||||
return 72000L;
|
||||
}
|
||||
|
||||
public long DAY() {
|
||||
return 1728000L;
|
||||
}
|
||||
|
||||
public long MONTH() {
|
||||
return 51840000L;
|
||||
}
|
||||
|
||||
public long YEAR() {
|
||||
return 622080000L;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package io.github.paldiu.simplexcore.utils;
|
||||
package io.github.simplexdev.simplexcore.utils;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
@ -1,6 +1,7 @@
|
||||
package io.github.paldiu.simplexcore.utils;
|
||||
package io.github.simplexdev.simplexcore.utils;
|
||||
|
||||
import io.github.paldiu.simplexcore.ban.BanType;
|
||||
import io.github.simplexdev.api.func.Guard;
|
||||
import io.github.simplexdev.simplexcore.ban.BanType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -68,4 +69,4 @@ public final class Utilities {
|
||||
String temp = String.valueOf(character).toUpperCase();
|
||||
return temp.charAt(0);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package io.github.paldiu.simplexcore.utils;
|
||||
package io.github.simplexdev.simplexcore.utils;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import io.github.paldiu.simplexcore.ban.BanType;
|
||||
import io.github.simplexdev.simplexcore.ban.BanType;
|
||||
|
||||
public class UtilitiesTest extends TestCase {
|
||||
public void testGenerateBanId() {
|
Loading…
Reference in New Issue
Block a user