예제 #1
0
  @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();
  }
예제 #2
0
  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();
      }
    }
  }