Search in sources :

Example 1 with LeaderboardSorter

use of com.archyx.aureliumskills.leaderboard.LeaderboardSorter in project AureliumSkills by Archy-X.

the class StorageProvider method sortLeaderboards.

protected void sortLeaderboards(Map<Skill, List<SkillValue>> leaderboards, List<SkillValue> powerLeaderboard, List<SkillValue> averageLeaderboard) {
    LeaderboardManager manager = plugin.getLeaderboardManager();
    LeaderboardSorter sorter = new LeaderboardSorter();
    for (Skill skill : Skills.values()) {
        leaderboards.get(skill).sort(sorter);
    }
    powerLeaderboard.sort(sorter);
    AverageSorter averageSorter = new AverageSorter();
    averageLeaderboard.sort(averageSorter);
    // Add skill leaderboards to map
    for (Skill skill : Skills.values()) {
        manager.setLeaderboard(skill, leaderboards.get(skill));
    }
    manager.setPowerLeaderboard(powerLeaderboard);
    manager.setAverageLeaderboard(averageLeaderboard);
    manager.setSorting(false);
}
Also used : LeaderboardSorter(com.archyx.aureliumskills.leaderboard.LeaderboardSorter) Skill(com.archyx.aureliumskills.skills.Skill) LeaderboardManager(com.archyx.aureliumskills.leaderboard.LeaderboardManager) AverageSorter(com.archyx.aureliumskills.leaderboard.AverageSorter)

Aggregations

AverageSorter (com.archyx.aureliumskills.leaderboard.AverageSorter)1 LeaderboardManager (com.archyx.aureliumskills.leaderboard.LeaderboardManager)1 LeaderboardSorter (com.archyx.aureliumskills.leaderboard.LeaderboardSorter)1 Skill (com.archyx.aureliumskills.skills.Skill)1