diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/MMOCore.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/MMOCore.java index 93e4e5da..6cc0b87b 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -382,11 +382,6 @@ public class MMOCore extends JavaPlugin { if (clearBefore) PlayerData.getAll().forEach(PlayerData::update); - else - //We update the skill tree data if some new skill tree has been - // created and updated with the /mmocore reload command. - PlayerData.getAll().forEach(PlayerData::updateSkillTree); - } public static void log(String message) { diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index f99fde29..f5bb8f56 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -172,11 +172,20 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc } finally { j++; } + + for(SkillTree skillTree:profess.getSkillTrees()) { + for(SkillTreeNode node: skillTree.getNodes()) { + if(!nodeLevels.containsKey(node)) + nodeLevels.put(node,0); + } + } + + setupSkillTree(); } public void setupSkillTree() { //Node states setup - for (SkillTree skillTree : MMOCore.plugin.skillTreeManager.getAll()) + for (SkillTree skillTree : profess.getSkillTrees()) skillTree.setupNodeState(this); @@ -345,18 +354,6 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc skillTree.setupNodeState(this); } - - public void updateSkillTree() { - nodeStates.clear(); - for (SkillTree tree : profess.getSkillTrees()) { - for (SkillTreeNode node : tree.getNodes()) { - if (!nodeLevels.containsKey(node)) - nodeLevels.put(node, 0); - } - } - setupSkillTree(); - } - public Map getNodeStates() { return new HashMap<>(nodeStates); }