public void loadPlayer(Player player) { StatistikPlayer statistikPlayer = new StatistikPlayer(playerTable, player.getName()); players.add(statistikPlayer); statistikPlayer.setAviableRanks(plugin.getRankManager().getRanks(player)); }
public void savePlayers() { if (players.size() > 0) { for (StatistikPlayer player : players) { calculatePoints(player); player.save(); } } }
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); } } }
public void calculatePoints(StatistikPlayer player) { Integer points = 0; points = points + ((player.getPlayTime() / settingsManager.getPlayTimeFor()) * settingsManager.getPlayTimePoints()); points = points + ((player.getBlockBreak() / settingsManager.getBlockBreakFor()) * settingsManager.getBlockBreakPoints()); points = points + ((player.getBlockPlace() / settingsManager.getBlockPlaceFor()) * settingsManager.getBlockPlacePoints()); points = points + ((player.getPlayerKill() / settingsManager.getPlayerKillFor()) * settingsManager.getPlayerKillPoints()); points = points + ((player.getPlayerDeath() / settingsManager.getPlayerDeathFor()) * settingsManager.getPlayerDeathPoints()); points = points + ((player.getMonsterKill() / settingsManager.getMonsterKillFor()) * settingsManager.getMonsterKillPoints()); points = points + ((player.getMonsterDeath() / settingsManager.getMonsterDeathFor()) * settingsManager.getMonsterDeathPoints()); points = points + ((player.getOtherDeath() / settingsManager.getOtherDeathFor()) * settingsManager.getOtherDeathPoints()); points = points + ((player.getFishing() / settingsManager.getFishingFor()) * settingsManager.getFishingPoints()); points = points + ((player.getBlockMove() / settingsManager.getBlockMoveFor()) * settingsManager.getBlockMovePoints()); points = points + ((player.getBlockFall() / settingsManager.getBlockFallFor()) * settingsManager.getBlockFallPoints()); player.setPoints(points); }