Ejemplo n.º 1
0
  public void disablePlugin(final Plugin plugin) {
    if (plugin.isEnabled()) {
      try {
        plugin.getPluginLoader().disablePlugin(plugin);
      } catch (Throwable ex) {
        server
            .getLogger()
            .log(
                Level.SEVERE,
                "Error occurred (in the plugin loader) while disabling "
                    + plugin.getDescription().getFullName()
                    + " (Is it up to date?)",
                ex);
      }

      try {
        server.getScheduler().cancelTasks(plugin);
      } catch (Throwable ex) {
        server
            .getLogger()
            .log(
                Level.SEVERE,
                "Error occurred (in the plugin loader) while cancelling tasks for "
                    + plugin.getDescription().getFullName()
                    + " (Is it up to date?)",
                ex);
      }

      try {
        server.getServicesManager().unregisterAll(plugin);
      } catch (Throwable ex) {
        server
            .getLogger()
            .log(
                Level.SEVERE,
                "Error occurred (in the plugin loader) while unregistering services for "
                    + plugin.getDescription().getFullName()
                    + " (Is it up to date?)",
                ex);
      }

      try {
        HandlerList.unregisterAll(plugin);
      } catch (Throwable ex) {
        server
            .getLogger()
            .log(
                Level.SEVERE,
                "Error occurred (in the plugin loader) while unregistering events for "
                    + plugin.getDescription().getFullName()
                    + " (Is it up to date?)",
                ex);
      }

      try {
        server.getMessenger().unregisterIncomingPluginChannel(plugin);
        server.getMessenger().unregisterOutgoingPluginChannel(plugin);
      } catch (Throwable ex) {
        server
            .getLogger()
            .log(
                Level.SEVERE,
                "Error occurred (in the plugin loader) while unregistering plugin channels for "
                    + plugin.getDescription().getFullName()
                    + " (Is it up to date?)",
                ex);
      }
    }
  }
Ejemplo n.º 2
0
 @Override
 public Messenger getMessenger() {
   return server.getMessenger();
 }