@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 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()); } } }
public void removePermissions(Player p) { for (String s : RanksManager.getPlayersRank(p).getPermissions()) perms.playerRemove(p, s); }
public void addPermissions(Player p) { for (String s : RanksManager.getPlayersRank(p).getPermissions()) perms.playerAdd(p, s); }