@EventHandler public void onNameTag(org.kitteh.tag.PlayerReceiveNameTagEvent e) { if (!pvptag.isSafe(e.getNamedPlayer().getName())) { Player p = e.getNamedPlayer(); e.setTag(pvptag.nameTagColor + p.getName()); } else { e.setTag(e.getNamedPlayer().getName()); } }
@EventHandler public void onNameTag(PlayerReceiveNameTagEvent event) { Player player = event.getNamedPlayer(); if (Teams.getInstance().inLobby(player.getName())) { event.setTag(ChatColor.GREEN + player.getName()); } else if (Teams.getInstance().inBlueTeam(player.getName())) { event.setTag(ChatColor.DARK_BLUE + player.getName()); } else if (Teams.getInstance().inRedTeam(player.getName())) { event.setTag(ChatColor.DARK_RED + player.getName()); } }
@EventHandler(priority = EventPriority.HIGHEST) private void onNameTag(PlayerReceiveNameTagEvent evt) { String target = evt.getNamedPlayer().getName(); String user = evt.getPlayer().getDisplayName(); PlayerDataClass targetData = plugin.getPlayerHandler().findPlayer(target); PlayerDataClass userData = plugin.getPlayerHandler().findPlayer(user); if (targetData != null && userData != null) { if (targetData.getTeam() == userData.getTeam()) { if (userData.getTeam() == "red") { evt.setTag(ChatColor.RED + target); } if (userData.getTeam() == "blue") { evt.setTag(ChatColor.BLUE + target); } } if (targetData.getTeam() != userData.getTeam()) { if (targetData.getDisguised() == null) { if (userData.getTeam() == "red") { evt.setTag(""); } if (userData.getTeam() == "blue") { evt.setTag(""); } } if (targetData.getDisguised() != null) { if (userData.getTeam() == "red") { evt.setTag(ChatColor.RED + targetData.getDisguised()); } if (userData.getTeam() == "blue") { evt.setTag(ChatColor.BLUE + targetData.getDisguised()); } } } } else { evt.setTag(""); } }
@EventHandler public void onVisible(PlayerReceiveNameTagEvent event) { event.setTag(event.getNamedPlayer().getPlayerListName()); }