mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-10-31 09:13:43 +01:00 
			
		
		
		
	Useless else statements.
This commit is contained in:
		| @@ -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; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -22,11 +22,11 @@ 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 | ||||
|     	} | ||||
|         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 | ||||
|         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; | ||||
|             int destination; | ||||
|              | ||||
|         	//How many lines to skip through | ||||
|             //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; | ||||
| 	    		} | ||||
|             for(PlayerStat ps : statsList) { | ||||
|                 if(currentPos == 10) | ||||
|                     break; | ||||
|                 if(destination > 1) { | ||||
|                     destination--; | ||||
|                     continue; | ||||
|                 } | ||||
|                  | ||||
| 	    		info[currentPos] = ps.name+":"+ps.statVal; | ||||
| 	    		currentPos++; | ||||
| 	    	} | ||||
|                 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; | ||||
|         		} | ||||
|         	} | ||||
|         if (statsList != null) { | ||||
|             for (PlayerStat stat : statsList) { | ||||
|                 if (stat.name.equalsIgnoreCase(playerName)) { | ||||
|                     return new int[] {currentPos, stat.statVal}; | ||||
|                 } | ||||
|                  | ||||
|         	return new int[] {0}; | ||||
|         } else { | ||||
|         	return new int[] {0}; | ||||
|                 currentPos++; | ||||
|                 continue; | ||||
|             } | ||||
|             return new int[] {0}; | ||||
|         } | ||||
|  | ||||
|         return new int[] {0}; | ||||
|     } | ||||
|      | ||||
|     private static class SkillComparator implements Comparator<PlayerStat> { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 GJ
					GJ