package eu.univento.impact.commands; import eu.univento.core.Core; import eu.univento.core.api.command.Command; import eu.univento.core.api.command.CommandArgs; import eu.univento.core.api.command.Completer; import eu.univento.core.api.player.CustomPlayer; import java.util.LinkedList; import java.util.List; /** * @author joethei * @version 1.0 */ public class PlayerCommands { @Command(name = "stats", description = "view statistics", usage = "/stats ", inGameOnly = true) public void stats(CommandArgs args) { CustomPlayer p = args.getPlayer(); if (args.length() == 1) { CustomPlayer t = CustomPlayer.getPlayer(args.getArg(0)); if (t == null) { p.sendMessage("§cDieser Spieler ist nicht online"); } else { Core.getCommons().getGameStatistics().getImpact().get(t.getDatabasePlayer()).whenComplete((impactStatistics, throwable) -> { p.sendMessage("Impact Stats von " + t.getDisplayName()); p.sendMessage("Gespielte Spiele: " + impactStatistics.getGamesPlayed()); p.sendMessage("Gewonne Spiele: " + impactStatistics.getGamesWon()); p.sendMessage("Verlorene Spiele: " + impactStatistics.getGamesLost()); p.sendMessage("Kills: " + impactStatistics.getKills()); p.sendMessage("Deaths: " + impactStatistics.getDeaths()); }); } } else { Core.getCommons().getGameStatistics().getImpact().get(p.getDatabasePlayer()).whenComplete((impactStatistics, throwable) -> { p.sendMessage("Deine Impact Stats"); p.sendMessage("Gespielte Spiele: " + impactStatistics.getGamesPlayed()); p.sendMessage("Gewonne Spiele: " + impactStatistics.getGamesWon()); p.sendMessage("Verlorene Spiele: " + impactStatistics.getGamesLost()); p.sendMessage("Kills: " + impactStatistics.getKills()); p.sendMessage("Deaths: " + impactStatistics.getDeaths()); }); } } @Completer(name = "stats") public List statsCompleter(CommandArgs args) { List list = new LinkedList<>(); for (CustomPlayer player : Core.getOnlinePlayers()) list.add(player.getDisplayName()); return list; } }