Esempio n. 1
0
  /** Things to be run when the plugin is disabled. */
  @Override
  public void onDisable() {
    try {
      Alchemy
          .finishAllBrews(); // Finish all partially complete AlchemyBrewTasks to prevent vanilla
                             // brewing continuation on restart
      UserManager.saveAll(); // Make sure to save player information if the server shuts down
      PartyManager.saveParties(); // Save our parties
      ScoreboardManager.teardownAll();
      formulaManager.saveFormula();
      placeStore.saveAll(); // Save our metadata
      placeStore.cleanUp(); // Cleanup empty metadata stores
    } catch (NullPointerException e) {
    }

    getServer().getScheduler().cancelTasks(this); // This removes our tasks
    HandlerList.unregisterAll(this); // Cancel event registrations

    if (Config.getInstance().getBackupsEnabled()) {
      // Remove other tasks BEFORE starting the Backup, or we just cancel it straight away.
      try {
        ZipLibrary.mcMMOBackup();
      } catch (IOException e) {
        getLogger().severe(e.toString());
      } catch (Throwable e) {
        if (e instanceof NoClassDefFoundError) {
          getLogger().severe("Backup class not found!");
          getLogger().info("Please do not replace the mcMMO jar while the server is running.");
        } else {
          getLogger().severe(e.toString());
        }
      }
    }

    debug("Was disabled."); // How informative!
  }