@EventHandler public void onInfectedLeave(InfectedCommandEvent e) { if (!e.isCancelled() && e.getArgs()[0].toLowerCase().equals("leave")) { Player p = e.getP(); if (RanksManager.canRankUp(p)) RanksManager.setPlayersRank(p, RanksManager.getNextRank(p)); removePermissions(p); } }
@EventHandler public void onInfectedCommand(InfectedCommandEvent event) { if (event.getArgs().length >= 1) { if (event.getArgs()[0].equalsIgnoreCase("Rank") || event.getArgs()[0].equalsIgnoreCase("Ranks") && event.getP() != null) { event.setCancelled(true); Player p = event.getP(); if (RanksManager.canRankUp(p)) RanksManager.setPlayersRank(p, RanksManager.getNextRank(p)); Rank rank = RanksManager.getPlayersRank(p); Rank nextRank = RanksManager.getNextRank(p); p.sendMessage(Msgs.Format_Header.getString("<title>", "Ranks")); if (rank.isMaxRank()) p.sendMessage("" + ChatColor.RED + ChatColor.BOLD + " MAX RANK"); p.sendMessage( "" + ChatColor.GREEN + ChatColor.BOLD + "Your Current Rank: " + ChatColor.GRAY + rank.getPrefix()); p.sendMessage( ChatColor.GRAY + "Your Score: " + ChatColor.RED + InfPlayerManager.getInfPlayer(p).getScore()); if (!rank.isMaxRank()) p.sendMessage( ChatColor.GRAY + "Score to next rank: " + ChatColor.RED + (nextRank.getScoreNeeded() - InfPlayerManager.getInfPlayer(p).getScore())); if (!rank.isMaxRank()) p.sendMessage( "" + ChatColor.GREEN + ChatColor.BOLD + "Next Rank: " + nextRank.getPrefix() + ChatColor.RED + " - " + ChatColor.GRAY + " Unlocks at " + ChatColor.RED + nextRank.getScoreNeeded()); if (rank.isMaxRank()) p.sendMessage("" + ChatColor.RED + ChatColor.BOLD + " MAX RANK"); p.sendMessage(Msgs.Format_Line.getString()); } } }
@EventHandler public void onInfectedJoin(InfectedCommandEvent e) { if (!e.isCancelled() && e.getArgs()[0].toLowerCase().equals("join")) { Player p = e.getP(); if (RanksManager.canRankUp(p)) RanksManager.setPlayersRank(p, RanksManager.getNextRank(p)); InfPlayer ip = InfPlayerManager.getInfPlayer(p); ip.setInfClass(Team.Human, RanksManager.getPlayersRank(p).getHumanClass()); ip.setInfClass(Team.Zombie, RanksManager.getPlayersRank(p).getZombieClass()); addPermissions(p); } }
@EventHandler public void onInfectedGameEnd(InfectedEndGame event) { for (Player u : event.getPlayers()) if (RanksManager.canRankUp(u)) RanksManager.setPlayersRank(u, RanksManager.getNextRank(u)); }