Debug for MMOCore skill Tree. When creating nodes and using /mmocore reload

This commit is contained in:
Ka0rX 2022-10-29 06:20:52 +02:00
parent 2adca395c0
commit 6965ebafcf
2 changed files with 18 additions and 0 deletions

View File

@ -382,6 +382,11 @@ public class MMOCore extends JavaPlugin {
if (clearBefore) if (clearBefore)
PlayerData.getAll().forEach(PlayerData::update); 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) { public static void log(String message) {

View File

@ -187,6 +187,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
node.getExperienceTable().claimStatTriggers(this, node); node.getExperienceTable().claimStatTriggers(this, node);
} }
} }
statLoaded=true;
} }
@ -344,6 +345,18 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
skillTree.setupNodeState(this); 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<SkillTreeNode, NodeState> getNodeStates() { public Map<SkillTreeNode, NodeState> getNodeStates() {
return new HashMap<>(nodeStates); return new HashMap<>(nodeStates);
} }