diff --git a/src/main/java/com/gmail/nossr50/datatypes/AbilityType.java b/src/main/java/com/gmail/nossr50/datatypes/AbilityType.java index 7719306ae..32e12d139 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/AbilityType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/AbilityType.java @@ -10,8 +10,7 @@ import com.gmail.nossr50.skills.Excavation; import com.gmail.nossr50.skills.Herbalism; import com.gmail.nossr50.skills.Mining; -public enum AbilityType -{ +public enum AbilityType { BERSERK(LoadProperties.berserkCooldown, mcLocale.getString("Skills.BerserkOn"), mcLocale.getString("Skills.BerserkOff"), "Skills.BerserkPlayer", mcLocale.getString("Skills.YourBerserk"), "Skills.BerserkPlayerOff"), SUPER_BREAKER(LoadProperties.superBreakerCooldown, mcLocale.getString("Skills.SuperBreakerOn"), mcLocale.getString("Skills.SuperBreakerOff"), "Skills.SuperBreakerPlayer", mcLocale.getString("Skills.YourSuperBreaker"), "Skills.SuperBreakerPlayerOff"), GIGA_DRILL_BREAKER(LoadProperties.gigaDrillBreakerCooldown, mcLocale.getString("Skills.GigaDrillBreakerOn"), mcLocale.getString("Skills.GigaDrillBreakerOff"), "Skills.GigaDrillBreakerPlayer", mcLocale.getString("Skills.YourGigaDrillBreaker"), "Skills.GigaDrillBreakerPlayerOff"), diff --git a/src/main/java/com/gmail/nossr50/datatypes/Tree.java b/src/main/java/com/gmail/nossr50/datatypes/Tree.java index fd77da0ec..3fe54ea9c 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/Tree.java +++ b/src/main/java/com/gmail/nossr50/datatypes/Tree.java @@ -6,34 +6,49 @@ import com.gmail.nossr50.datatypes.PlayerStat; public class Tree { - TreeNode root = null; + private TreeNode root = null; - public Tree(){} + public Tree(){} - public void add(String p, int in) - { - if(root == null){ - root = new TreeNode(p, in); - } - else - root.add(p,in); - } - - public PlayerStat[] inOrder() - { - if(root != null){ - ArrayList order = root.inOrder(new ArrayList()); - return order.toArray(new PlayerStat[order.size()]); - } else { - //Throw some dummy info in case the users file is empty - //It's not a good fix but its better than rewriting the whole system - ArrayList x = new ArrayList(); - PlayerStat y = new PlayerStat(); - y.name = "$mcMMO_DummyInfo"; - y.statVal = 0; - x.add(y); - return x.toArray(new PlayerStat[x.size()]); - } - } + /** + * Add a node to this tree. + * + * @param p Player name + * @param in Stat value + */ + public void add(String p, int in) { + if (root == null) { + root = new TreeNode(p, in); + } + else { + root.add(p, in); + } + } + /** + * Retrieve an array of PlayerStats from the Tree. + * + * @return the player stats of this tree, in order + */ + public PlayerStat[] inOrder() { + if (root != null) { + ArrayList order = root.inOrder(new ArrayList()); + + return order.toArray(new PlayerStat[order.size()]); + } + else { + + /* Throw some dummy info in case the users file is empty. + * It's not a good fix but its better than rewriting the whole system. + */ + ArrayList x = new ArrayList(); + PlayerStat y = new PlayerStat(); + + y.name = "$mcMMO_DummyInfo"; + y.statVal = 0; + x.add(y); + + return x.toArray(new PlayerStat[x.size()]); + } + } }