I was able to dig up a scoreboard to work for my server. My issue now is that it only pulls up players that are currently online.
"for(Player p : World.getPlayers()) {"
How do I change that so that it will also check the player save files for those that are offline?
Code:
public static ArrayList<ScoreboardEntry> getUpdatedList(Scoreboard scoreboard) {
ArrayList<ScoreboardEntry> entries = new ArrayList<ScoreboardEntry>();
for(Player p : World.getPlayers()) {
if(p == null)
continue;
if(scoreboard == Scoreboards.TOP_PKERS) {
int kc = p.getPlayerKillingAttributes().getPlayerKills();
int dc = p.getPlayerKillingAttributes().getPlayerDeaths();
double kdr = (double) ((kc < 2 || dc < 2) ? (0) : (kc/dc));
entries.add(new ScoreboardEntry(p.getUsername(), new String[]{String.valueOf(kdr), String.valueOf(kc), String.valueOf(dc)}));
} else if(scoreboard == Scoreboards.TOP_KILLSTREAKS) {
entries.add(new ScoreboardEntry(p.getUsername(), new String[]{String.valueOf(p.getPlayerKillingAttributes().getPlayerKillStreak())}));
} else if(scoreboard == Scoreboards.TOP_TOTAL_EXP) {
entries.add(new ScoreboardEntry(p.getUsername(), new String[]{String.valueOf(p.getSkillManager().getTotalExp())}));
} else if(scoreboard == Scoreboards.TOP_ACHIEVER) {
entries.add(new ScoreboardEntry(p.getUsername(), new String[]{String.valueOf(p.getPointsHandler().getAchievementPoints())}));
}
}
scoreboard.resort(entries);
return entries;
}