Don't include child skills in these loops. Fixes #577

This commit is contained in:
GJ 2013-01-24 09:08:30 -05:00
parent bba23de31c
commit b7bb3f4487
6 changed files with 26 additions and 7 deletions

View File

@ -58,6 +58,9 @@ public class McrankCommand implements CommandExecutor {
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Player", new Object[] {playerName})); sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Player", new Object[] {playerName}));
for (SkillType skillType : SkillType.values()) { for (SkillType skillType : SkillType.values()) {
int[] rankInts = Leaderboard.getPlayerRank(playerName, skillType); int[] rankInts = Leaderboard.getPlayerRank(playerName, skillType);
if (skillType.isChildSkill()) {
continue;
}
if (skillType.equals(SkillType.ALL)) { if (skillType.equals(SkillType.ALL)) {
continue; // We want the overall ranking to be at the bottom continue; // We want the overall ranking to be at the bottom

View File

@ -85,7 +85,7 @@ public class McMMOPlayer {
public void addXPOverride(SkillType skillType, int xp) { public void addXPOverride(SkillType skillType, int xp) {
if (skillType.equals(SkillType.ALL)) { if (skillType.equals(SkillType.ALL)) {
for (SkillType type : SkillType.values()) { for (SkillType type : SkillType.values()) {
if (type.equals(SkillType.ALL)) { if (type.equals(SkillType.ALL) || type.isChildSkill()) {
continue; continue;
} }

View File

@ -70,7 +70,7 @@ public class PlayerProfile {
} }
for (SkillType skillType : SkillType.values()) { for (SkillType skillType : SkillType.values()) {
if (skillType != SkillType.ALL) { if (skillType != SkillType.ALL && !skillType.isChildSkill()) {
skills.put(skillType, 0); skills.put(skillType, 0);
skillsXp.put(skillType, 0); skillsXp.put(skillType, 0);
} }
@ -945,6 +945,10 @@ public class PlayerProfile {
public void resetSkill(SkillType skillType) public void resetSkill(SkillType skillType)
{ {
if (skillType.isChildSkill()) {
return;
}
//do a single skilltype //do a single skilltype
if (skillType != SkillType.ALL) if (skillType != SkillType.ALL)
skills.put(skillType, 0); skills.put(skillType, 0);
@ -1060,6 +1064,10 @@ public class PlayerProfile {
* @param xp Amount of xp to remove * @param xp Amount of xp to remove
*/ */
public void removeXP(SkillType skillType, int xp) { public void removeXP(SkillType skillType, int xp) {
if (skillType.isChildSkill()) {
return;
}
if (skillType.equals(SkillType.ALL)) { if (skillType.equals(SkillType.ALL)) {
for (SkillType skill : SkillType.values()) { for (SkillType skill : SkillType.values()) {
if (skill.equals(SkillType.ALL)) { if (skill.equals(SkillType.ALL)) {
@ -1082,6 +1090,10 @@ public class PlayerProfile {
* @param newValue New level value for the skill * @param newValue New level value for the skill
*/ */
public void modifySkill(SkillType skillType, int newValue) { public void modifySkill(SkillType skillType, int newValue) {
if (skillType.isChildSkill()) {
return;
}
if (skillType.equals(SkillType.ALL)) { if (skillType.equals(SkillType.ALL)) {
for (SkillType skill : SkillType.values()) { for (SkillType skill : SkillType.values()) {
if (skill.equals(SkillType.ALL)) { if (skill.equals(SkillType.ALL)) {
@ -1106,6 +1118,10 @@ public class PlayerProfile {
* @param levels Number of levels to add * @param levels Number of levels to add
*/ */
public void addLevels(SkillType skillType, int levels) { public void addLevels(SkillType skillType, int levels) {
if (skillType.isChildSkill()) {
return;
}
if (skillType.equals(SkillType.ALL)) { if (skillType.equals(SkillType.ALL)) {
for (SkillType skill : SkillType.values()) { for (SkillType skill : SkillType.values()) {
if (skill.equals(SkillType.ALL)) { if (skill.equals(SkillType.ALL)) {

View File

@ -256,7 +256,7 @@ public class Skills {
public static void xpCheckAll(Player player, PlayerProfile profile) { public static void xpCheckAll(Player player, PlayerProfile profile) {
for (SkillType skillType : SkillType.values()) { for (SkillType skillType : SkillType.values()) {
//Don't want to do anything with this one //Don't want to do anything with this one
if (skillType == SkillType.ALL) { if (skillType == SkillType.ALL || skillType.isChildSkill()) {
continue; continue;
} }

View File

@ -136,7 +136,7 @@ public class SpoutStuff {
//Standard XP Icons //Standard XP Icons
for (SkillType y : SkillType.values()) { for (SkillType y : SkillType.values()) {
if (y.equals(SkillType.ALL)) { if (y.equals(SkillType.ALL) || y.isChildSkill()) {
continue; continue;
} }
@ -197,7 +197,7 @@ public class SpoutStuff {
/* Standard XP Icons */ /* Standard XP Icons */
for (SkillType y : SkillType.values()) { for (SkillType y : SkillType.values()) {
if (y.equals(SkillType.ALL)) { if (y.equals(SkillType.ALL) || y.isChildSkill()) {
continue; continue;
} }

View File

@ -20,7 +20,7 @@ public abstract class Hardcore {
int totalLost = 0; int totalLost = 0;
for (SkillType skillType : SkillType.values()) { for (SkillType skillType : SkillType.values()) {
if (skillType.equals(SkillType.ALL)) { if (skillType.equals(SkillType.ALL) || skillType.isChildSkill()) {
continue; continue;
} }
@ -52,7 +52,7 @@ public abstract class Hardcore {
int totalStolen = 0; int totalStolen = 0;
for (SkillType skillType : SkillType.values()) { for (SkillType skillType : SkillType.values()) {
if (skillType.equals(SkillType.ALL)) { if (skillType.equals(SkillType.ALL) || skillType.isChildSkill()) {
continue; continue;
} }