public static void setPvPState(Player player, boolean state) { if (state) { player.setMetadata(PVP_META, new FixedMetadataValue(PLUGIN, true)); player.setPlayerListName(ChatColor.RED + player.getName()); } else { player.removeMetadata(PVP_META, PLUGIN); player.setPlayerListName(null); } OneB.sendMsg(player, "PvP " + getPvPStateString(player) + "."); }
/** * Tab now shows the names of players with PvP enabled in red, making this function redundant. * * @param receiver The receiver of the player list */ public static void listPlayers(CommandSender receiver) { for (Player player : Bukkit.getServer().getOnlinePlayers()) { ChatColor colour; if (getPvPState(player)) { colour = ChatColor.RED; } else { colour = ChatColor.GREEN; } OneB.sendMsg(receiver, colour + player.getName()); } }