Compartmentalize plugin initialization
This commit is contained in:
parent
ee9f962fac
commit
da495eb88a
@ -25,16 +25,27 @@ public final class InvTweaksPlugin extends JavaPlugin {
|
||||
public void onEnable() {
|
||||
logger.info(LOG_PLUGIN_NAME + " Plugin enabled");
|
||||
|
||||
final PluginManager pluginManager = getServer().getPluginManager();
|
||||
|
||||
pluginManager.registerEvents(new StackReplaceListener(), this);
|
||||
pluginManager.registerEvents(new SortListener(), this);
|
||||
initCommands();
|
||||
initEvents();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
logger.info(LOG_PLUGIN_NAME + " Plugin disabled");
|
||||
|
||||
// Un-register all listeners
|
||||
HandlerList.unregisterAll(this);
|
||||
}
|
||||
|
||||
|
||||
private void initCommands() {
|
||||
Objects.requireNonNull(getCommand("sort")).setExecutor(new SortCommandExecutor());
|
||||
}
|
||||
|
||||
private void initEvents() {
|
||||
final PluginManager pluginManager = getServer().getPluginManager();
|
||||
|
||||
pluginManager.registerEvents(new StackReplaceListener(), this);
|
||||
pluginManager.registerEvents(new SortListener(), this);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user