mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-22 02:35:21 +01:00
Made use of BSModule and CommandsManager in BSAddon and BSkyBlock main class
This commit is contained in:
parent
2c8a36ed54
commit
b8a5b0151f
@ -8,6 +8,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import us.tastybento.bskyblock.api.BSModule;
|
||||
import us.tastybento.bskyblock.commands.AdminCommand;
|
||||
import us.tastybento.bskyblock.commands.IslandCommand;
|
||||
import us.tastybento.bskyblock.config.BSBLocale;
|
||||
@ -26,6 +27,7 @@ import us.tastybento.bskyblock.listeners.protection.IslandGuard;
|
||||
import us.tastybento.bskyblock.listeners.protection.IslandGuard1_8;
|
||||
import us.tastybento.bskyblock.listeners.protection.IslandGuard1_9;
|
||||
import us.tastybento.bskyblock.listeners.protection.NetherEvents;
|
||||
import us.tastybento.bskyblock.managers.CommandsManager;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
import us.tastybento.bskyblock.util.VaultHelper;
|
||||
import us.tastybento.bskyblock.util.nms.NMSAbstraction;
|
||||
@ -35,7 +37,7 @@ import us.tastybento.bskyblock.util.nms.NMSAbstraction;
|
||||
* @author Tastybento
|
||||
* @author Poslovitch
|
||||
*/
|
||||
public class BSkyBlock extends JavaPlugin {
|
||||
public class BSkyBlock extends JavaPlugin implements BSModule {
|
||||
|
||||
private static BSkyBlock plugin;
|
||||
|
||||
@ -47,9 +49,8 @@ public class BSkyBlock extends JavaPlugin {
|
||||
// Metrics
|
||||
private Metrics metrics;
|
||||
|
||||
// Commands
|
||||
private IslandCommand islandCommand;
|
||||
private AdminCommand adminCommand;
|
||||
// Managers
|
||||
private CommandsManager commandsManager;
|
||||
|
||||
protected LocaleManager localeManager;
|
||||
|
||||
@ -79,8 +80,9 @@ public class BSkyBlock extends JavaPlugin {
|
||||
VaultHelper.setupPermissions();
|
||||
|
||||
// Set up commands
|
||||
islandCommand = new IslandCommand();
|
||||
adminCommand = new AdminCommand();
|
||||
commandsManager = new CommandsManager();
|
||||
commandsManager.registerCommand(this, new IslandCommand());
|
||||
commandsManager.registerCommand(this, new AdminCommand());
|
||||
|
||||
// These items have to be loaded when the server has done 1 tick.
|
||||
// Note Worlds are not loaded this early, so any Locations or World reference will be null
|
||||
@ -143,10 +145,6 @@ public class BSkyBlock extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
public IslandCommand getIslandCommand() {
|
||||
return islandCommand;
|
||||
}
|
||||
|
||||
private void registerListeners() {
|
||||
PluginManager manager = getServer().getPluginManager();
|
||||
// Player join events
|
||||
@ -248,4 +246,13 @@ public class BSkyBlock extends JavaPlugin {
|
||||
}
|
||||
return nmsHandler;
|
||||
}
|
||||
|
||||
public CommandsManager getCommandsManager() {
|
||||
return commandsManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return getDescription().getName();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,10 @@
|
||||
package us.tastybento.bskyblock.api.addons;
|
||||
|
||||
public abstract class BSAddon {
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.BSModule;
|
||||
import us.tastybento.bskyblock.managers.CommandsManager;
|
||||
|
||||
public abstract class BSAddon implements BSModule {
|
||||
|
||||
private AddonDescription description;
|
||||
private AddonState state;
|
||||
@ -17,4 +21,13 @@ public abstract class BSAddon {
|
||||
public boolean isEnabled() { return state == AddonState.ENABLED; }
|
||||
public boolean isDisabled() { return state == AddonState.DISABLED; }
|
||||
public boolean isIncompatible() { return state == AddonState.INCOMPATIBLE; }
|
||||
|
||||
public CommandsManager getCommandsManager() {
|
||||
return BSkyBlock.getPlugin().getCommandsManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return getDescription().getName();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user