Useless else statements.

This commit is contained in:
GJ 2013-01-21 17:15:53 -05:00
parent 9512879cc7
commit 900623461a
2 changed files with 49 additions and 48 deletions

View File

@ -119,16 +119,18 @@ public enum SkillType {
}
public static SkillType getSkill(String skillName) {
if(skillName.equalsIgnoreCase("powerlevel") || skillName.equalsIgnoreCase("all")) {
return SkillType.ALL;
} else {
for(SkillType st : SkillType.values()) {
if(st.name().equalsIgnoreCase(skillName))
return st;
}
System.out.println("[DEBUG] Invalid mcMMO skill ("+skillName+")");
return null;
}
if (skillName.equalsIgnoreCase("powerlevel") || skillName.equalsIgnoreCase("all")) {
return SkillType.ALL;
}
for (SkillType type : SkillType.values()) {
if (type.name().equalsIgnoreCase(skillName)) {
return type;
}
}
System.out.println("[DEBUG] Invalid mcMMO skill (" + skillName + ")");
return null;
}
/**

View File

@ -22,12 +22,12 @@ public class Leaderboard {
* Update the leader boards.
*/
public static void updateLeaderboards() {
if(System.currentTimeMillis() < lastUpdate + 600000) {
return; //Only update FFS leaderboards every 10 minutes.. this puts a lot of strain on the server (depending on the size of the database) and should not be done frequently
}
lastUpdate = System.currentTimeMillis(); //Log when the last update was run
if(System.currentTimeMillis() < lastUpdate + 600000) {
return; //Only update FFS leaderboards every 10 minutes.. this puts a lot of strain on the server (depending on the size of the database) and should not be done frequently
}
lastUpdate = System.currentTimeMillis(); //Log when the last update was run
//Initialize lists
List<PlayerStat> mining, woodcutting, herbalism, excavation, acrobatics, repair, swords, axes, archery, unarmed, taming, fishing, powerlevel;
@ -171,14 +171,14 @@ public class Leaderboard {
* @return the requested leaderboard information
*/
public static String[] retrieveInfo(SkillType skillType, int pagenumber) {
String[] info = new String[10];
String[] info = new String[10];
List<PlayerStat> statsList = playerStatHash.get(skillType);
if(statsList != null) {
int destination;
//How many lines to skip through
int destination;
//How many lines to skip through
if (pagenumber == 1) {
destination = 0;
}
@ -186,45 +186,44 @@ public class Leaderboard {
destination = (pagenumber * 10) - 9;
}
int currentPos = 0;
int currentPos = 0;
for(PlayerStat ps : statsList) {
if(currentPos == 10)
break;
if(destination > 1) {
destination--;
continue;
}
info[currentPos] = ps.name+":"+ps.statVal;
currentPos++;
}
for(PlayerStat ps : statsList) {
if(currentPos == 10)
break;
if(destination > 1) {
destination--;
continue;
}
info[currentPos] = ps.name+":"+ps.statVal;
currentPos++;
}
} else {
info[0] = "DummyPlayer:0"; //Coming up with a better solution soon...
info[0] = "DummyPlayer:0"; //Coming up with a better solution soon...
}
return info;
}
public static int[] getPlayerRank(String playerName, SkillType skillType) {
int currentPos = 1;
int currentPos = 1;
List<PlayerStat> statsList = playerStatHash.get(skillType);
if(statsList != null) {
for(PlayerStat ps : statsList) {
if(ps.name.equalsIgnoreCase(playerName)) {
return new int[] {currentPos, ps.statVal};
} else {
currentPos++;
continue;
}
}
return new int[] {0};
} else {
return new int[] {0};
if (statsList != null) {
for (PlayerStat stat : statsList) {
if (stat.name.equalsIgnoreCase(playerName)) {
return new int[] {currentPos, stat.statVal};
}
currentPos++;
continue;
}
return new int[] {0};
}
return new int[] {0};
}
private static class SkillComparator implements Comparator<PlayerStat> {