mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
More datatype cleanup.
This commit is contained in:
parent
05d16e7c15
commit
d2edbe207d
@ -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"),
|
||||
|
@ -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<PlayerStat> order = root.inOrder(new ArrayList<PlayerStat>());
|
||||
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<PlayerStat> x = new ArrayList<PlayerStat>();
|
||||
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<PlayerStat> order = root.inOrder(new ArrayList<PlayerStat>());
|
||||
|
||||
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<PlayerStat> x = new ArrayList<PlayerStat>();
|
||||
PlayerStat y = new PlayerStat();
|
||||
|
||||
y.name = "$mcMMO_DummyInfo";
|
||||
y.statVal = 0;
|
||||
x.add(y);
|
||||
|
||||
return x.toArray(new PlayerStat[x.size()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user