Selaa lähdekoodia

FFS Leaderboards will only update every 10 minutes

nossr50 12 vuotta sitten
vanhempi
sitoutus
67a4efa03e

+ 0 - 1
src/main/java/com/gmail/nossr50/commands/mc/McrankCommand.java

@@ -12,7 +12,6 @@ import com.gmail.nossr50.datatypes.SkillType;
 import com.gmail.nossr50.locale.LocaleLoader;
 import com.gmail.nossr50.runnables.mcRankAsync;
 import com.gmail.nossr50.util.Leaderboard;
-import com.gmail.nossr50.util.Misc;
 import com.gmail.nossr50.util.Skills;
 
 public class McrankCommand implements CommandExecutor {

+ 7 - 0
src/main/java/com/gmail/nossr50/util/Leaderboard.java

@@ -16,11 +16,18 @@ public class Leaderboard {
     private static mcMMO plugin = mcMMO.p;
     private final static String location = mcMMO.getUsersFile();
     private static HashMap<SkillType, List<PlayerStat>> playerStatHash = new HashMap<SkillType, List<PlayerStat>>();
+    private static long lastUpdate = 0;
     
     /**
      * 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
+    	
         //Initialize lists
         List<PlayerStat> mining, woodcutting, herbalism, excavation, acrobatics, repair, swords, axes, archery, unarmed, taming, fishing, powerlevel;