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

This commit is contained in:
Ka0rX 2022-10-29 11:27:32 +02:00
parent 6965ebafcf
commit aa90e9bc6c
2 changed files with 10 additions and 18 deletions

View File

@ -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) {

View File

@ -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<SkillTreeNode, NodeState> getNodeStates() {
return new HashMap<>(nodeStates);
}