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 6cc0b87b..93e4e5da 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -382,6 +382,11 @@ 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 529f4a86..f99fde29 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 @@ -187,6 +187,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc node.getExperienceTable().claimStatTriggers(this, node); } } + statLoaded=true; } @@ -344,6 +345,18 @@ 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); }