use of com.ebicep.warlords.database.leaderboards.Leaderboard in project Warlords by ebicep.
the class LeaderboardCTF method addExtraLeaderboards.
@Override
public void addExtraLeaderboards(LeaderboardCategory<DatabasePlayerCTF> leaderboardCategory) {
List<Leaderboard> leaderboards = leaderboardCategory.getLeaderboards();
leaderboards.add(new Leaderboard("Flags Captured", new Location(world, -2540.5, 56, 712.5), databasePlayer -> leaderboardCategory.statFunction.apply(databasePlayer).getFlagsCaptured(), databasePlayer -> NumberFormat.addCommaAndRound(leaderboardCategory.statFunction.apply(databasePlayer).getFlagsCaptured())));
leaderboards.add(new Leaderboard("Flags Returned", new Location(world, -2608.5, 52, 737.5), databasePlayer -> leaderboardCategory.statFunction.apply(databasePlayer).getFlagsReturned(), databasePlayer -> NumberFormat.addCommaAndRound(leaderboardCategory.statFunction.apply(databasePlayer).getFlagsReturned())));
leaderboards.add(new Leaderboard("Mage Experience", new Location(world, -2523.5, 58, 734.5), databasePlayer -> leaderboardCategory.statFunction.apply(databasePlayer).getMage().getExperience(), databasePlayer -> NumberFormat.addCommaAndRound(leaderboardCategory.statFunction.apply(databasePlayer).getMage().getExperience())));
leaderboards.add(new Leaderboard("Warrior Experience", new Location(world, -2520.5, 58, 739.5), databasePlayer -> leaderboardCategory.statFunction.apply(databasePlayer).getWarrior().getExperience(), databasePlayer -> NumberFormat.addCommaAndRound(leaderboardCategory.statFunction.apply(databasePlayer).getWarrior().getExperience())));
leaderboards.add(new Leaderboard("Paladin Experience", new Location(world, -2516.5, 58, 744.5), databasePlayer -> leaderboardCategory.statFunction.apply(databasePlayer).getPaladin().getExperience(), databasePlayer -> NumberFormat.addCommaAndRound(leaderboardCategory.statFunction.apply(databasePlayer).getPaladin().getExperience())));
leaderboards.add(new Leaderboard("Shaman Experience", new Location(world, -2520.5, 58, 749.5), databasePlayer -> leaderboardCategory.statFunction.apply(databasePlayer).getShaman().getExperience(), databasePlayer -> NumberFormat.addCommaAndRound(leaderboardCategory.statFunction.apply(databasePlayer).getShaman().getExperience())));
leaderboards.add(new Leaderboard("Rogue Experience", new Location(world, -2523.5, 58, 754.5), databasePlayer -> leaderboardCategory.statFunction.apply(databasePlayer).getRogue().getExperience(), databasePlayer -> NumberFormat.addCommaAndRound(leaderboardCategory.statFunction.apply(databasePlayer).getRogue().getExperience())));
}
use of com.ebicep.warlords.database.leaderboards.Leaderboard in project Warlords by ebicep.
the class LeaderboardGeneral method addExtraLeaderboards.
@Override
public void addExtraLeaderboards(LeaderboardCategory<AbstractDatabaseStatInformation> leaderboardCategory) {
List<Leaderboard> leaderboards = leaderboardCategory.getLeaderboards();
Class<?> databasePlayerClass = leaderboardCategory.statFunction.apply(new DatabasePlayer()).getClass();
if (DatabasePlayer.class.equals(databasePlayerClass)) {
leaderboards.add(new Leaderboard("Mage Experience", new Location(world, -2523.5, 58, 734.5), databasePlayer -> applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayer.class).getMage().getExperience(), databasePlayer -> NumberFormat.addCommaAndRound(applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayer.class).getMage().getExperience())));
leaderboards.add(new Leaderboard("Warrior Experience", new Location(world, -2520.5, 58, 739.5), databasePlayer -> applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayer.class).getWarrior().getExperience(), databasePlayer -> NumberFormat.addCommaAndRound(applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayer.class).getWarrior().getExperience())));
leaderboards.add(new Leaderboard("Paladin Experience", new Location(world, -2516.5, 58, 744.5), databasePlayer -> applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayer.class).getPaladin().getExperience(), databasePlayer -> NumberFormat.addCommaAndRound(applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayer.class).getPaladin().getExperience())));
leaderboards.add(new Leaderboard("Shaman Experience", new Location(world, -2520.5, 58, 749.5), databasePlayer -> applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayer.class).getShaman().getExperience(), databasePlayer -> NumberFormat.addCommaAndRound(applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayer.class).getShaman().getExperience())));
leaderboards.add(new Leaderboard("Rogue Experience", new Location(world, -2523.5, 58, 754.5), databasePlayer -> applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayer.class).getRogue().getExperience(), databasePlayer -> NumberFormat.addCommaAndRound(applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayer.class).getRogue().getExperience())));
} else if (DatabasePlayerCompStats.class.equals(databasePlayerClass)) {
leaderboards.add(new Leaderboard("Mage Experience", new Location(world, -2523.5, 58, 734.5), databasePlayer -> applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayerCompStats.class).getMage().getExperience(), databasePlayer -> NumberFormat.addCommaAndRound(applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayerCompStats.class).getMage().getExperience())));
leaderboards.add(new Leaderboard("Warrior Experience", new Location(world, -2520.5, 58, 739.5), databasePlayer -> applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayerCompStats.class).getWarrior().getExperience(), databasePlayer -> NumberFormat.addCommaAndRound(applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayerCompStats.class).getWarrior().getExperience())));
leaderboards.add(new Leaderboard("Paladin Experience", new Location(world, -2516.5, 58, 744.5), databasePlayer -> applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayerCompStats.class).getPaladin().getExperience(), databasePlayer -> NumberFormat.addCommaAndRound(applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayerCompStats.class).getPaladin().getExperience())));
leaderboards.add(new Leaderboard("Shaman Experience", new Location(world, -2520.5, 58, 749.5), databasePlayer -> applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayerCompStats.class).getShaman().getExperience(), databasePlayer -> NumberFormat.addCommaAndRound(applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayerCompStats.class).getShaman().getExperience())));
leaderboards.add(new Leaderboard("Rogue Experience", new Location(world, -2523.5, 58, 754.5), databasePlayer -> applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayerCompStats.class).getRogue().getExperience(), databasePlayer -> NumberFormat.addCommaAndRound(applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayerCompStats.class).getRogue().getExperience())));
} else if (DatabasePlayerPubStats.class.equals(databasePlayerClass)) {
leaderboards.add(new Leaderboard("Mage Experience", new Location(world, -2523.5, 58, 734.5), databasePlayer -> applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayerPubStats.class).getMage().getExperience(), databasePlayer -> NumberFormat.addCommaAndRound(applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayerPubStats.class).getMage().getExperience())));
leaderboards.add(new Leaderboard("Warrior Experience", new Location(world, -2520.5, 58, 739.5), databasePlayer -> applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayerPubStats.class).getWarrior().getExperience(), databasePlayer -> NumberFormat.addCommaAndRound(applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayerPubStats.class).getWarrior().getExperience())));
leaderboards.add(new Leaderboard("Paladin Experience", new Location(world, -2516.5, 58, 744.5), databasePlayer -> applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayerPubStats.class).getPaladin().getExperience(), databasePlayer -> NumberFormat.addCommaAndRound(applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayerPubStats.class).getPaladin().getExperience())));
leaderboards.add(new Leaderboard("Shaman Experience", new Location(world, -2520.5, 58, 749.5), databasePlayer -> applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayerPubStats.class).getShaman().getExperience(), databasePlayer -> NumberFormat.addCommaAndRound(applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayerPubStats.class).getShaman().getExperience())));
leaderboards.add(new Leaderboard("Rogue Experience", new Location(world, -2523.5, 58, 754.5), databasePlayer -> applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayerPubStats.class).getRogue().getExperience(), databasePlayer -> NumberFormat.addCommaAndRound(applyAndCast(leaderboardCategory, databasePlayer, DatabasePlayerPubStats.class).getRogue().getExperience())));
}
}
use of com.ebicep.warlords.database.leaderboards.Leaderboard in project Warlords by ebicep.
the class CustomScoreboard method giveMainLobbyScoreboard.
public void giveMainLobbyScoreboard() {
if (scoreboard.getObjective("health") != null) {
scoreboard.getObjective("health").unregister();
health = null;
}
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
for (Team team : scoreboard.getTeams()) {
if (team.getName().equals(onlinePlayer.getName())) {
team.unregister();
break;
}
}
}
if (loaded) {
LeaderboardCategory<?> leaderboardCategory = getLeaderboardCategoryFromPlayer(player);
if (leaderboardCategory == null)
return;
Leaderboard leaderboard = leaderboardCategory.leaderboards.get(0);
List<DatabasePlayer> databasePlayerList;
switch(playerLeaderboardTime.getOrDefault(player.getUniqueId(), PlayersCollections.LIFETIME)) {
case LIFETIME:
databasePlayerList = leaderboard.getSortedAllTime();
break;
case SEASON_5:
databasePlayerList = leaderboard.getSortedSeason5();
break;
case SEASON_4:
databasePlayerList = leaderboard.getSortedSeason4();
break;
case WEEKLY:
databasePlayerList = leaderboard.getSortedWeekly();
break;
case DAILY:
databasePlayerList = leaderboard.getSortedDaily();
break;
default:
databasePlayerList = leaderboard.getSortedAllTime();
break;
}
LeaderboardManager.GameType selectedType = playerLeaderboardGameType.get(player.getUniqueId());
LeaderboardManager.Category selectedCategory = playerLeaderboardCategory.get(player.getUniqueId());
PlayersCollections selectedCollection = playerLeaderboardTime.get(player.getUniqueId());
if (selectedType == null)
selectedType = GameType.ALL;
if (selectedCollection == null)
selectedCategory = Category.ALL;
if (selectedCollection == null)
selectedCollection = PlayersCollections.LIFETIME;
String scoreboardSelection = "";
if (!selectedType.shortName.isEmpty()) {
scoreboardSelection += selectedType.shortName + "/";
}
if (!selectedCategory.shortName.isEmpty()) {
scoreboardSelection += selectedCategory.shortName + "/";
}
scoreboardSelection += selectedCollection.name;
Optional<DatabasePlayer> optionalDatabasePlayer = databasePlayerList.stream().filter(databasePlayer -> databasePlayer.getUuid().equalsIgnoreCase(player.getUniqueId().toString())).findAny();
if (optionalDatabasePlayer.isPresent()) {
DatabasePlayer databasePlayer = optionalDatabasePlayer.get();
AbstractDatabaseStatInformation playerInformation = leaderboardCategory.statFunction.apply(databasePlayer);
giveNewSideBar(true, ChatColor.GRAY + scoreboardSelection, "", "Kills: " + ChatColor.GREEN + NumberFormat.addCommaAndRound(playerInformation.getKills()), "Assists: " + ChatColor.GREEN + NumberFormat.addCommaAndRound(playerInformation.getAssists()), "Deaths: " + ChatColor.GREEN + NumberFormat.addCommaAndRound(playerInformation.getDeaths()), " " + "", "Wins: " + ChatColor.GREEN + NumberFormat.addCommaAndRound(playerInformation.getWins()), "Losses: " + ChatColor.GREEN + NumberFormat.addCommaAndRound(playerInformation.getLosses()), " " + "", "Damage: " + ChatColor.RED + NumberFormat.addCommaAndRound(playerInformation.getDamage()), "Healing: " + ChatColor.DARK_GREEN + NumberFormat.addCommaAndRound(playerInformation.getHealing()), "Absorbed: " + ChatColor.GOLD + NumberFormat.addCommaAndRound(playerInformation.getAbsorbed()), " ", " " + ChatColor.YELLOW + ChatColor.BOLD + "Update", " " + ChatColor.GOLD + ChatColor.BOLD + Warlords.VERSION);
}
return;
}
if (DatabaseManager.playerService == null) {
clearSideBar();
return;
}
DatabasePlayer databasePlayer = DatabaseManager.playerService.findByUUID(player.getUniqueId());
giveNewSideBar(true, ChatColor.GRAY + "Lifetime", " ", "Kills: " + ChatColor.GREEN + NumberFormat.addCommaAndRound(databasePlayer.getKills()), "Assists: " + ChatColor.GREEN + NumberFormat.addCommaAndRound(databasePlayer.getAssists()), "Deaths: " + ChatColor.GREEN + NumberFormat.addCommaAndRound(databasePlayer.getDeaths()), " " + "", "Wins: " + ChatColor.GREEN + NumberFormat.addCommaAndRound(databasePlayer.getWins()), "Losses: " + ChatColor.GREEN + NumberFormat.addCommaAndRound(databasePlayer.getLosses()), " " + "", "Damage: " + ChatColor.RED + NumberFormat.addCommaAndRound(databasePlayer.getDamage()), "Healing: " + ChatColor.DARK_GREEN + NumberFormat.addCommaAndRound(databasePlayer.getHealing()), "Absorbed: " + ChatColor.GOLD + NumberFormat.addCommaAndRound(databasePlayer.getAbsorbed()), " ", " " + ChatColor.YELLOW + ChatColor.BOLD + "Update", " " + ChatColor.GOLD + ChatColor.BOLD + Warlords.VERSION);
}
use of com.ebicep.warlords.database.leaderboards.Leaderboard in project Warlords by ebicep.
the class LeaderboardGameType method addBaseLeaderboards.
public void addBaseLeaderboards(LeaderboardCategory<T> leaderboardCategory) {
leaderboardCategory.getAllHolograms().forEach(Hologram::delete);
List<Leaderboard> leaderboards = leaderboardCategory.getLeaderboards();
leaderboards.clear();
leaderboards.add(new Leaderboard("Wins", new Location(world, -2558.5, 56, 712.5), databasePlayer -> leaderboardCategory.statFunction.apply(databasePlayer).getWins(), databasePlayer -> NumberFormat.addCommaAndRound(leaderboardCategory.statFunction.apply(databasePlayer).getWins())));
leaderboards.add(new Leaderboard("Losses", new Location(world, -2608.5, 52, 728.5), databasePlayer -> leaderboardCategory.statFunction.apply(databasePlayer).getLosses(), databasePlayer -> NumberFormat.addCommaAndRound(leaderboardCategory.statFunction.apply(databasePlayer).getLosses())));
leaderboards.add(new Leaderboard("Plays", new Location(world, -2564.5, 56, 712.5), databasePlayer -> leaderboardCategory.statFunction.apply(databasePlayer).getPlays(), databasePlayer -> NumberFormat.addCommaAndRound(leaderboardCategory.statFunction.apply(databasePlayer).getPlays())));
leaderboards.add(new Leaderboard("Kills", new Location(world, -2552.5, 56, 712.5), databasePlayer -> leaderboardCategory.statFunction.apply(databasePlayer).getKills(), databasePlayer -> NumberFormat.addCommaAndRound(leaderboardCategory.statFunction.apply(databasePlayer).getKills())));
leaderboards.add(new Leaderboard("Assists", new Location(world, -2616.5, 52, 733.5), databasePlayer -> leaderboardCategory.statFunction.apply(databasePlayer).getAssists(), databasePlayer -> NumberFormat.addCommaAndRound(leaderboardCategory.statFunction.apply(databasePlayer).getAssists())));
leaderboards.add(new Leaderboard("Deaths", new Location(world, -2616.5, 52, 723.5), databasePlayer -> leaderboardCategory.statFunction.apply(databasePlayer).getDeaths(), databasePlayer -> NumberFormat.addCommaAndRound(leaderboardCategory.statFunction.apply(databasePlayer).getDeaths())));
leaderboards.add(new Leaderboard("Damage", new Location(world, -2600.5, 52, 723.5), databasePlayer -> leaderboardCategory.statFunction.apply(databasePlayer).getDamage(), databasePlayer -> NumberFormat.addCommaAndRound(leaderboardCategory.statFunction.apply(databasePlayer).getDamage())));
leaderboards.add(new Leaderboard("Healing", new Location(world, -2608.5, 52, 719.5), databasePlayer -> leaderboardCategory.statFunction.apply(databasePlayer).getHealing(), databasePlayer -> NumberFormat.addCommaAndRound(leaderboardCategory.statFunction.apply(databasePlayer).getHealing())));
leaderboards.add(new Leaderboard("Absorbed", new Location(world, -2600.5, 52, 733.5), databasePlayer -> leaderboardCategory.statFunction.apply(databasePlayer).getAbsorbed(), databasePlayer -> NumberFormat.addCommaAndRound(leaderboardCategory.statFunction.apply(databasePlayer).getAbsorbed())));
leaderboards.add(new Leaderboard("DHP", new Location(world, -2619.5, 66.5, 721.5), databasePlayer -> leaderboardCategory.statFunction.apply(databasePlayer).getDHP(), databasePlayer -> NumberFormat.addCommaAndRound(leaderboardCategory.statFunction.apply(databasePlayer).getDHP())));
leaderboards.add(new Leaderboard("DHP Per Game", new Location(world, -2546.5, 56, 712.5), databasePlayer -> leaderboardCategory.statFunction.apply(databasePlayer).getDHPPerGame(), databasePlayer -> NumberFormat.addCommaAndRound(Math.round((double) (leaderboardCategory.statFunction.apply(databasePlayer).getDHPPerGame()) * 10) / 10d)));
leaderboards.add(new Leaderboard("Kills Per Game", new Location(world, -2619.5, 66.5, 735.5), databasePlayer -> leaderboardCategory.statFunction.apply(databasePlayer).getKillsPerGame(), databasePlayer -> String.valueOf(Math.round(leaderboardCategory.statFunction.apply(databasePlayer).getKillsPerGame() * 10) / 10d)));
leaderboards.add(new Leaderboard("Deaths Per Game", new Location(world, -2608.5, 67, 738.5), databasePlayer -> leaderboardCategory.statFunction.apply(databasePlayer).getDeathsPerGame(), databasePlayer -> String.valueOf(Math.round(leaderboardCategory.statFunction.apply(databasePlayer).getDeathsPerGame() * 10) / 10d)));
leaderboards.add(new Leaderboard("Kills/Assists Per Game", new Location(world, -2608.5, 67, 719.5), databasePlayer -> leaderboardCategory.statFunction.apply(databasePlayer).getKillsAssistsPerGame(), databasePlayer -> String.valueOf(Math.round(leaderboardCategory.statFunction.apply(databasePlayer).getKillsAssistsPerGame() * 10) / 10d)));
leaderboards.add(new Leaderboard("Experience", new Location(world, -2526.5, 57, 744.5), databasePlayer -> leaderboardCategory.statFunction.apply(databasePlayer).getExperience(), databasePlayer -> NumberFormat.addCommaAndRound(leaderboardCategory.statFunction.apply(databasePlayer).getExperience())));
this.addExtraLeaderboards(leaderboardCategory);
}
Aggregations