mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15: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.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.
|
||||||
|
*
|
||||||
|
* @param p Player name
|
||||||
|
* @param in Stat value
|
||||||
|
*/
|
||||||
|
public void add(String p, int in) {
|
||||||
if (root == null) {
|
if (root == null) {
|
||||||
root = new TreeNode(p, in);
|
root = new TreeNode(p, in);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
root.add(p, in);
|
root.add(p, in);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public PlayerStat[] inOrder()
|
/**
|
||||||
{
|
* Retrieve an array of PlayerStats from the Tree.
|
||||||
|
*
|
||||||
|
* @return the player stats of this tree, in order
|
||||||
|
*/
|
||||||
|
public PlayerStat[] inOrder() {
|
||||||
if (root != null) {
|
if (root != null) {
|
||||||
ArrayList<PlayerStat> order = root.inOrder(new ArrayList<PlayerStat>());
|
ArrayList<PlayerStat> order = root.inOrder(new ArrayList<PlayerStat>());
|
||||||
|
|
||||||
return order.toArray(new PlayerStat[order.size()]);
|
return order.toArray(new PlayerStat[order.size()]);
|
||||||
} else {
|
}
|
||||||
//Throw some dummy info in case the users file is empty
|
else {
|
||||||
//It's not a good fix but its better than rewriting the whole system
|
|
||||||
|
/* 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>();
|
ArrayList<PlayerStat> x = new ArrayList<PlayerStat>();
|
||||||
PlayerStat y = new PlayerStat();
|
PlayerStat y = new PlayerStat();
|
||||||
|
|
||||||
y.name = "$mcMMO_DummyInfo";
|
y.name = "$mcMMO_DummyInfo";
|
||||||
y.statVal = 0;
|
y.statVal = 0;
|
||||||
x.add(y);
|
x.add(y);
|
||||||
|
|
||||||
return x.toArray(new PlayerStat[x.size()]);
|
return x.toArray(new PlayerStat[x.size()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user