mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +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.Herbalism;
|
||||||
import com.gmail.nossr50.skills.Mining;
|
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"),
|
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"),
|
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"),
|
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 {
|
public class Tree {
|
||||||
|
|
||||||
TreeNode root = null;
|
private TreeNode root = null;
|
||||||
|
|
||||||
public Tree(){}
|
public Tree(){}
|
||||||
|
|
||||||
public void add(String p, int in)
|
/**
|
||||||
{
|
* Add a node to this tree.
|
||||||
if(root == null){
|
*
|
||||||
root = new TreeNode(p, in);
|
* @param p Player name
|
||||||
}
|
* @param in Stat value
|
||||||
else
|
*/
|
||||||
root.add(p,in);
|
public void add(String p, int in) {
|
||||||
}
|
if (root == null) {
|
||||||
|
root = new TreeNode(p, in);
|
||||||
public PlayerStat[] inOrder()
|
}
|
||||||
{
|
else {
|
||||||
if(root != null){
|
root.add(p, in);
|
||||||
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()]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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