Fixed an issue with /mm reload

This commit is contained in:
Indyuce 2022-03-12 14:20:49 +01:00
parent 30fa13ffb1
commit 56996788a9
3 changed files with 7 additions and 9 deletions

View File

@ -383,7 +383,8 @@ public class MMOCore extends LuminePlugin {
* @param clearBefore True when issuing a plugin reload * @param clearBefore True when issuing a plugin reload
*/ */
public void initializePlugin(boolean clearBefore) { public void initializePlugin(boolean clearBefore) {
reloadConfig(); if (clearBefore)
reloadConfig();
configManager = new ConfigManager(); configManager = new ConfigManager();
@ -417,6 +418,9 @@ public class MMOCore extends LuminePlugin {
actionBarManager.reload(getConfig().getConfigurationSection("action-bar")); actionBarManager.reload(getConfig().getConfigurationSection("action-bar"));
StatType.load(); StatType.load();
if (clearBefore)
PlayerData.getAll().forEach(PlayerData::update);
} }
public static void log(String message) { public static void log(String message) {

View File

@ -18,15 +18,11 @@ public class ReloadCommandTreeNode extends CommandTreeNode {
sender.sendMessage(ChatColor.YELLOW + "Reloading " + MMOCore.plugin.getName() + " " + MMOCore.plugin.getDescription().getVersion() + "..."); sender.sendMessage(ChatColor.YELLOW + "Reloading " + MMOCore.plugin.getName() + " " + MMOCore.plugin.getDescription().getVersion() + "...");
long ms = System.currentTimeMillis(); long ms = System.currentTimeMillis();
MMOCore.plugin.reloadConfig();
MMOCore.plugin.initializePlugin(true); MMOCore.plugin.initializePlugin(true);
PlayerData.getAll().forEach(PlayerData::update);
ms = System.currentTimeMillis() - ms; ms = System.currentTimeMillis() - ms;
sender.sendMessage(ChatColor.YELLOW + MMOCore.plugin.getName() + " " + MMOCore.plugin.getDescription().getVersion() + " successfully reloaded."); sender.sendMessage(ChatColor.YELLOW + MMOCore.plugin.getName() + " " + MMOCore.plugin.getDescription().getVersion() + " successfully reloaded.");
sender.sendMessage(ChatColor.YELLOW + "Time Taken: " + ChatColor.GOLD + ms + ChatColor.YELLOW + "ms (" + ChatColor.GOLD + (double) ms / 50 + ChatColor.YELLOW + " ticks)"); sender.sendMessage(ChatColor.YELLOW + "Time Taken: " + ChatColor.GOLD + ms + ChatColor.YELLOW + "ms (" + ChatColor.GOLD + (double) ms / 50 + ChatColor.YELLOW + " ticks)");
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} }
} }

View File

@ -41,10 +41,8 @@ public class MythicHook implements Listener {
// When MM is reloaded, reload placeholders because they are no longer registered // When MM is reloaded, reload placeholders because they are no longer registered
registerPlaceholders(); registerPlaceholders();
// Reload skills // Reload every god damn thing
MMOCore.plugin.skillManager.initialize(true); MMOCore.plugin.initializePlugin(true);
MMOCore.plugin.classManager.initialize(true);
PlayerData.getAll().forEach(PlayerData::update);
} }
private void registerPlaceholders() { private void registerPlaceholders() {