mirror of
https://github.com/Melledy/Nebula.git
synced 2025-12-13 04:45:02 +01:00
Add a config option for leaderboard refresh time
This commit is contained in:
@@ -101,6 +101,7 @@ public class Config {
|
||||
public boolean skipIntro = false;
|
||||
public boolean unlockInstances = true;
|
||||
public int dailyResetHour = 0;
|
||||
public int leaderboardRefreshTime = 60;
|
||||
public WelcomeMail welcomeMail = new WelcomeMail();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@ public class ScoreBossModule extends GameContextModule {
|
||||
this.ranking = new ArrayList<>();
|
||||
}
|
||||
|
||||
private long getRefreshTime() {
|
||||
return Nebula.getConfig().getServerOptions().leaderboardRefreshTime * 1000;
|
||||
}
|
||||
|
||||
public synchronized List<ScoreBossRankData> getRanking() {
|
||||
if (System.currentTimeMillis() > this.nextUpdate) {
|
||||
this.updateRanking();
|
||||
@@ -46,7 +50,7 @@ public class ScoreBossModule extends GameContextModule {
|
||||
this.ranking.add(entry.toProto());
|
||||
}
|
||||
|
||||
this.nextUpdate = System.currentTimeMillis() + 1000;
|
||||
this.nextUpdate = System.currentTimeMillis() + this.getRefreshTime();
|
||||
this.lastUpdate = Nebula.getCurrentTime();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user