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
*/
public void initializePlugin(boolean clearBefore) {
reloadConfig();
if (clearBefore)
reloadConfig();
configManager = new ConfigManager();
@ -417,6 +418,9 @@ public class MMOCore extends LuminePlugin {
actionBarManager.reload(getConfig().getConfigurationSection("action-bar"));
StatType.load();
if (clearBefore)
PlayerData.getAll().forEach(PlayerData::update);
}
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() + "...");
long ms = System.currentTimeMillis();
MMOCore.plugin.reloadConfig();
MMOCore.plugin.initializePlugin(true);
PlayerData.getAll().forEach(PlayerData::update);
ms = System.currentTimeMillis() - ms;
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)");
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
registerPlaceholders();
// Reload skills
MMOCore.plugin.skillManager.initialize(true);
MMOCore.plugin.classManager.initialize(true);
PlayerData.getAll().forEach(PlayerData::update);
// Reload every god damn thing
MMOCore.plugin.initializePlugin(true);
}
private void registerPlaceholders() {