Esempio n. 1
0
  private void setupVault(PluginManager pm) {
    if (pm.getPlugin("Vault") == null) {
      MessageSender.getInstance().log("Vault was not found, economy features are not available.");
    } else {
      RegisteredServiceProvider<Economy> econProvider =
          getServer().getServicesManager().getRegistration(Economy.class);
      if (econProvider != null) {
        Econ.getInstance().init(econProvider.getProvider());
      }

      RegisteredServiceProvider<Permission> permProvider =
          getServer().getServicesManager().getRegistration(Permission.class);
      if (permProvider != null) {
        Perms.getInstance().init(permProvider.getProvider());
      }
    }
  }
Esempio n. 2
0
  @Override
  public void onDisable() {
    try {
      Bukkit.getScheduler().cancelTasks(this);

      if (plugin == null) {
        return;
      }

      Vanilla.removeCustomRecipes();

      Furnaces.save();
      Furnaces.clean();

      BrewingStands.save();
      BrewingStands.clean();

      Workbenches.clean();
      Players.clean();
      Vanilla.clean();

      recipes.clean();
      recipes = null;

      recipeBooks.clean();
      recipeBooks = null;

      events.clean();
      events = null;

      Settings.clean();

      Econ.getInstance().clean();
      Perms.getInstance().clean();

      if (metrics != null) {
        metrics.stop();
        metrics = null;
      }

      plugin = null;
    } catch (Throwable e) {
      MessageSender.getInstance().error(null, e, null);
    }
  }