@EventHandler(priority = EventPriority.NORMAL) public void onPluginDisable(PluginDisableEvent event) { ProtectionPlugins protectionPlugin; try { protectionPlugin = ProtectionPlugins.valueOf(event.getPlugin().getName()); } catch (Exception e) { return; } this.instance.getLogger().info("Unloading protection plugin: " + event.getPlugin().getName()); protectionPlugin.removeHandler(); }
void pluginEnable(String pluginName) { ProtectionPlugins protectionPlugin; try { protectionPlugin = ProtectionPlugins.valueOf(pluginName); } catch (Exception e1) { return; } if (protectionPlugin.isEnabled()) { try { this.instance.getLogger().info("Loading protection plugin: " + pluginName); protectionPlugin.createHandler(); } catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); } } }