コード例 #1
0
 private boolean setupVault() {
   if (!config.getVault()) return false;
   try {
     RegisteredServiceProvider<Economy> ep =
         server.getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
     RegisteredServiceProvider<Permission> pe =
         server
             .getServicesManager()
             .getRegistration(net.milkbowl.vault.permission.Permission.class);
     if (ep == null) return false;
     else if (pe == null) return false;
     else econ = ep.getProvider();
     perm = pe.getProvider();
     return true;
   } catch (NoClassDefFoundError e) {
     return false;
   }
 }
コード例 #2
0
  public APIWrapperMethods(Server server) {
    bukget = new BukGetAPIMethods(server);
    jsonapi = new JSONAPIAPIMethods(server);
    permissions = new PermissionWrapper(server);

    if (server.getPluginManager().getPlugin("Vault") != null) {
      RegisteredServiceProvider<Economy> rsp =
          server.getServicesManager().getRegistration(Economy.class);
      if (rsp != null) {
        econ = rsp.getProvider();
      }
      RegisteredServiceProvider<Chat> rsp2 =
          server.getServicesManager().getRegistration(Chat.class);
      if (rsp2 != null) {
        chat = rsp2.getProvider();
      }
    }
  }
コード例 #3
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);
      }
    }
  }
コード例 #4
0
 @Override
 public ServicesManager getServicesManager() {
   return server.getServicesManager();
 }