@Override public void onDisable() { // Disable listeners HandlerList.unregisterAll(this); // Stop shedulers getServer().getScheduler().cancelTasks(this); if (p == null) { return; } // save Data to Disk DataSave.save(true); // save LanguageReader languageReader.save(); // delete Data from Ram Barrel.barrels.clear(); BCauldron.bcauldrons.clear(); BIngredients.possibleIngredients.clear(); BIngredients.recipes.clear(); BIngredients.cookedNames.clear(); BPlayer.clear(); Brew.potions.clear(); Wakeup.wakeups.clear(); Words.words.clear(); this.log(this.getDescription().getName() + " disabled!"); }
public void reload(CommandSender sender) { // clear all existent config Data BIngredients.possibleIngredients.clear(); BIngredients.recipes.clear(); BIngredients.cookedNames.clear(); Words.words.clear(); BPlayer.drainItems.clear(); if (useLB) { try { LogBlockBarrel.clear(); } catch (Exception e) { e.printStackTrace(); } } // load the Config try { if (!readConfig()) { p = null; getServer().getPluginManager().disablePlugin(this); return; } } catch (Exception e) { e.printStackTrace(); p = null; getServer().getPluginManager().disablePlugin(this); return; } // save and load LanguageReader languageReader.save(); languageReader = new LanguageReader(new File(p.getDataFolder(), "languages/" + language + ".yml")); // Reload Recipes Boolean successful = true; for (Brew brew : Brew.potions.values()) { if (!brew.reloadRecipe()) { successful = false; } } if (!successful) { msg(sender, p.languageReader.get("Error_Recipeload")); } }