So, I need to sort a "scores" hashmap. the hashmap layout is HashMap<Player, Integer(which is the score i need to sort>
if you're asking why? its because i need to make a leaderboard.
here is my code:
public static Player[] sortPlayersByElo() {
Map<String, Object> map = RankingConfig.get().getConfigurationSection("data").getValues(false);
Map<Player, Integer> eloMap = new HashMap<>(); // Here is the map i need to sort.
for (String s : map.keySet()) {
Player player = Bukkit.getPlayer(s);
eloMap.put(player, RankingConfig.get().getInt("data."+s+".elo"));
}
Player[] players = new Player[eloMap.size()];
return players;
}