@EventHandler(priority = EventPriority.MONITOR) public void onPluginEnable(final PluginEnableEvent event) { if (plugin.iConomy == null) { Plugin iConomy = plugin.getServer().getPluginManager().getPlugin("iConomy"); if (iConomy != null) { if (iConomy.isEnabled() && iConomy.getClass().getName().equals("com.iConomy.iConomy")) { plugin.iConomy = (iConomy) iConomy; System.out.println("[MyPlugin] hooked into iConomy."); } } } }
@EventHandler(priority = EventPriority.MONITOR) public void onPluginDisable(final PluginDisableEvent event) { if (plugin.iConomy != null) { if (event.getPlugin().getDescription().getName().equals("iConomy")) { plugin.iConomy = null; System.out.println("[MyPlugin] un-hooked from iConomy."); } } }
public server(Core plugin) { this.plugin = plugin; plugin.getServer().getPluginManager().registerEvents(this, plugin); }