Skill Tree Debug

This commit is contained in:
Ka0rX 2022-08-18 17:38:35 +02:00
parent e51ae7cf9e
commit 1e23f4147c
4 changed files with 13 additions and 20 deletions

View File

@ -175,12 +175,8 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
public void setupNodeState() { public void setupNodeState() {
for (SkillTree skillTree : MMOCore.plugin.skillTreeManager.getAll()) for (SkillTree skillTree : MMOCore.plugin.skillTreeManager.getAll())
if (skillTree instanceof LinkedSkillTree) {
LinkedSkillTree linkedSkillTree = (LinkedSkillTree) skillTree;
linkedSkillTree.setupNodeState(this);
} else {
skillTree.setupNodeState(this); skillTree.setupNodeState(this);
}
} }
public void setSkillTreePoints(String treeId, int points) { public void setSkillTreePoints(String treeId, int points) {

View File

@ -11,6 +11,7 @@ import net.Indyuce.mmocore.manager.data.DataProvider;
import net.Indyuce.mmocore.manager.data.PlayerDataManager; import net.Indyuce.mmocore.manager.data.PlayerDataManager;
import net.Indyuce.mmocore.tree.SkillTreeNode; import net.Indyuce.mmocore.tree.SkillTreeNode;
import org.apache.commons.lang.Validate; import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -78,9 +79,6 @@ public class YAMLPlayerDataManager extends PlayerDataManager {
} }
data.setupNodeState(); data.setupNodeState();
for (SkillTreeNode node : MMOCore.plugin.skillTreeManager.getAllNodes()) {
MMOCore.log(node.getFullId()+" " +data.getNodeState(node)+"");
}
if (config.contains("times-claimed")) if (config.contains("times-claimed"))
for (String key : config.getConfigurationSection("times-claimed").getKeys(true)) for (String key : config.getConfigurationSection("times-claimed").getKeys(true))

View File

@ -44,13 +44,14 @@ public class CustomSkillTree extends SkillTree {
} }
} }
} }
setupRoots();
} }
private void setupRoots() { private void setupRoots() {
//We find the roots of the tree which don't have any parents //We find the roots of the tree which don't have any parents
for (SkillTreeNode node : nodes.values()) { for (SkillTreeNode node : nodes.values()) {
if (node.getSoftParents().size()+node.getStrongParents().size() == 0) { if (node.getSoftParents().size()+node.getStrongParents().size() == 0) {
//We mark the node as a root also //We mark the node as a root also
roots.add(node); roots.add(node);

View File

@ -102,7 +102,7 @@ public abstract class SkillTree extends PostLoadObject implements RegisteredObje
} }
} }
} catch (Exception e) { } catch (Exception e) {
Bukkit.getLogger().log(Level.WARNING, "Couldn't load icons for the skill tree " + id); MMOCore.log( "Couldn't load icons for the skill tree " + id);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -182,9 +182,8 @@ public abstract class SkillTree extends PostLoadObject implements RegisteredObje
* Recursively go through the skill trees to update the the node states * Recursively go through the skill trees to update the the node states
*/ */
public void setupNodeState(PlayerData playerData) { public void setupNodeState(PlayerData playerData) {
Bukkit.broadcastMessage(getId()+(this instanceof CustomSkillTree)+" "+roots.size());
for (SkillTreeNode root : roots) for (SkillTreeNode root : roots)
root.getTree().setupNodeStateFrom(root, playerData); setupNodeStateFrom(root, playerData);
} }
@ -296,7 +295,6 @@ public abstract class SkillTree extends PostLoadObject implements RegisteredObje
return nodes.containsKey(name); return nodes.containsKey(name);
} }
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;