FFS Leaderboards will only update every 10 minutes

This commit is contained in:
nossr50 2013-01-16 12:02:41 -08:00
parent fd4f0f4096
commit 67a4efa03e
2 changed files with 7 additions and 1 deletions

View File

@ -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 {

View File

@ -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;