use of de.Keyle.MyPet.api.skill.experience.ExperienceCalculatorManager in project MyPet by xXKeyleXx.
the class CommandOptionReload method reloadConfig.
protected void reloadConfig(CommandSender sender) {
int oldMaxPetCount = Configuration.Misc.MAX_STORED_PET_COUNT;
ConfigurationLoader.loadConfiguration();
ConfigurationLoader.loadCompatConfiguration();
if (MyPetApi.getLogger() instanceof MyPetLogger) {
((MyPetLogger) MyPetApi.getLogger()).updateDebugLoggerLogLevel();
}
Translation.init();
if (Configuration.Misc.MAX_STORED_PET_COUNT > oldMaxPetCount) {
for (int i = oldMaxPetCount + 1; i <= Configuration.Misc.MAX_STORED_PET_COUNT; i++) {
try {
Bukkit.getPluginManager().addPermission(new Permission("MyPet.petstorage.limit." + i));
} catch (Exception ignored) {
}
}
} else if (oldMaxPetCount > Configuration.Misc.MAX_STORED_PET_COUNT) {
for (int i = oldMaxPetCount; i > Configuration.Misc.MAX_STORED_PET_COUNT; i--) {
try {
Bukkit.getPluginManager().removePermission("MyPet.petstorage.limit." + i);
} catch (Exception ignored) {
}
}
}
ExperienceCalculatorManager calculatorManager = MyPetApi.getServiceManager().getService(ExperienceCalculatorManager.class).get();
calculatorManager.switchCalculator(Configuration.LevelSystem.CALCULATION_MODE);
MyPetApi.getPluginHookManager().getConfig().loadConfig();
for (PluginHook hook : MyPetApi.getPluginHookManager().getHooks()) {
ConfigurationSection pluginSection = MyPetApi.getPluginHookManager().getConfig().getConfig().getConfigurationSection(hook.getPluginName());
if (pluginSection != null) {
hook.loadConfig(pluginSection);
}
}
if (!(sender instanceof ConsoleCommandSender)) {
sender.sendMessage("[" + ChatColor.DARK_GREEN + "MyPet" + ChatColor.RESET + "] config reloaded!");
}
MyPetApi.getLogger().info("Config reloaded!");
}
Aggregations