@Override public void onEnable() { final PluginManager pluginManager = getServer().getPluginManager(); final IEssentials ess = (IEssentials)pluginManager.getPlugin("Essentials"); if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) { LOGGER.log(Level.WARNING, _("versionMismatchAll")); } if (!ess.isEnabled()) { this.setEnabled(false); return; } chatListener = new ConcurrentSkipListMap<String, IEssentialsChatListener>(); final Map<PlayerChatEvent, String> charges = new HashMap<PlayerChatEvent, String>(); final EssentialsChatPlayerListenerLowest playerListenerLowest = new EssentialsChatPlayerListenerLowest(getServer(), ess, chatListener); final EssentialsChatPlayerListenerNormal playerListenerNormal = new EssentialsChatPlayerListenerNormal(getServer(), ess, chatListener, charges); final EssentialsChatPlayerListenerHighest playerListenerHighest = new EssentialsChatPlayerListenerHighest(getServer(), ess, chatListener, charges); pluginManager.registerEvent(Type.PLAYER_CHAT, playerListenerLowest, Priority.Lowest, this); pluginManager.registerEvent(Type.PLAYER_CHAT, playerListenerNormal, Priority.Normal, this); pluginManager.registerEvent(Type.PLAYER_CHAT, playerListenerHighest, Priority.Highest, this); LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team")); }
public void onEnable() { final PluginManager pm = this.getServer().getPluginManager(); ess = (IEssentials) pm.getPlugin("Essentials"); final EssentialsProtectPlayerListener playerListener = new EssentialsProtectPlayerListener(this); pm.registerEvent(Type.PLAYER_INTERACT, playerListener, Priority.Low, this); final EssentialsProtectBlockListener blockListener = new EssentialsProtectBlockListener(this); pm.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Highest, this); pm.registerEvent(Type.BLOCK_FROMTO, blockListener, Priority.Highest, this); pm.registerEvent(Type.BLOCK_IGNITE, blockListener, Priority.Highest, this); pm.registerEvent(Type.BLOCK_BURN, blockListener, Priority.Highest, this); pm.registerEvent(Type.BLOCK_BREAK, blockListener, Priority.Highest, this); pm.registerEvent(Type.BLOCK_PISTON_EXTEND, blockListener, Priority.Highest, this); pm.registerEvent(Type.BLOCK_PISTON_RETRACT, blockListener, Priority.Highest, this); final EssentialsProtectEntityListener entityListener = new EssentialsProtectEntityListener(this); pm.registerEvent(Type.ENTITY_EXPLODE, entityListener, Priority.Highest, this); pm.registerEvent(Type.ENTITY_DAMAGE, entityListener, Priority.Highest, this); pm.registerEvent(Type.CREATURE_SPAWN, entityListener, Priority.Highest, this); pm.registerEvent(Type.ENTITY_TARGET, entityListener, Priority.Highest, this); pm.registerEvent(Type.EXPLOSION_PRIME, entityListener, Priority.Highest, this); final EssentialsProtectWeatherListener weatherListener = new EssentialsProtectWeatherListener(this); pm.registerEvent(Type.LIGHTNING_STRIKE, weatherListener, Priority.Highest, this); pm.registerEvent(Type.THUNDER_CHANGE, weatherListener, Priority.Highest, this); pm.registerEvent(Type.WEATHER_CHANGE, weatherListener, Priority.Highest, this); reloadConfig(); ess.addReloadListener(this); if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) { LOGGER.log(Level.WARNING, Util.i18n("versionMismatchAll")); } LOGGER.info( Util.format( "loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team")); }