public StatistikPlayer getPlayer(Player player) { for (StatistikPlayer player2 : players) { if (player2.getName().equalsIgnoreCase(player.getName())) { return player2; } } return null; }
public void removePlayer(Player player) { for (StatistikPlayer player2 : players) { if (player2.getName().equalsIgnoreCase(player.getName())) { // Spieler Stats speichern und entfernen player2.save(); players.remove(player2); return; } } }
public void checkNewRanks() { if (players.size() > 0) { for (StatistikPlayer player : players) { Player spieler = plugin.getServer().getPlayer(player.getName()); ArrayList<Rank> ranks = Statistik.getInstance() .getRankManager() .getRanks(plugin.getServer().getPlayer(player.getName())); ArrayList<Rank> newRanks = Statistik.getInstance() .getRankManager() .getRanks(plugin.getServer().getPlayer(player.getName())); ArrayList<Rank> oldRanks = player.getAviableRanks(); if (oldRanks != null) { if (ranks != null) { if (ranks.size() > 0) { for (Rank rank : ranks) { for (Rank rank2 : oldRanks) { if (rank.equals(rank2)) { newRanks.remove(rank); } } } } if (ranks.size() > 0) { for (Rank rank : newRanks) { spieler.sendMessage( ChatColor.GOLD + "Du hast soeben den Titel " + rank.getName() + ChatColor.WHITE + " freigeschaltet, nutze nun " + ChatColor.GREEN + "/rank set " + rank.getTag() + ChatColor.GOLD + " um den Titel festzulegen."); } } } } else { if (ranks != null) { for (Rank rank : ranks) { spieler.sendMessage( ChatColor.GOLD + "Du hast soeben den Titel " + rank.getName() + ChatColor.WHITE + " freigeschaltet, nutze nun " + ChatColor.GREEN + "/rank set " + rank.getTag() + ChatColor.GOLD + " um den Titel festzulegen."); } } } player.setAviableRanks(ranks); } } }