@Override public void onEnable() { plugin = this; commands.register(TargetCommands.class); commands.register(MovementCommands.class); commands.register(ManagementCommands.class); PluginManager pm = getServer().getPluginManager(); pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Priority.Normal, this); pm.registerEvent(Event.Type.ENTITY_TARGET, entityListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_ANIMATION, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_DROP_ITEM, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_INTERACT, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_INTERACT_ENTITY, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.CHUNK_UNLOAD, worldListener, Priority.Normal, this); pm.registerEvent(Event.Type.CHUNK_LOAD, worldListener, Priority.Normal, this); PluginDescriptionFile pdfFile = this.getDescription(); DataHandler.loadSettings(); DataHandler.loadUsers(); getServer().getScheduler().scheduleSyncRepeatingTask(this, new TickTask(), 5, 1); Messaging.log("version [" + pdfFile.getVersion() + "] (" + codename + ") loaded"); }
@Override public void onDisable() { DataHandler.saveAll(); PluginDescriptionFile pdfFile = this.getDescription(); Messaging.log("version [" + pdfFile.getVersion() + "] (" + codename + ") disabled"); }