Truncate string argument on calls calls to setPlayerListName. Resolves #262.

This commit is contained in:
StevenLawson 2014-08-07 20:47:15 -04:00
parent 00e22dc56e
commit d5d6f18fb4

View File

@ -858,26 +858,37 @@ public class TFM_PlayerListener implements Listener
@EventHandler(priority = EventPriority.HIGH)
public static void onPlayerJoinEvent(PlayerJoinEvent event)
{
Player player = event.getPlayer();
final Player player = event.getPlayer();
String name = player.getName();
if (TFM_Util.DEVELOPERS.contains(player.getName()))
{
player.setPlayerListName(ChatColor.DARK_PURPLE + player.getName());
name = ChatColor.DARK_PURPLE + name;
TFM_PlayerData.getPlayerData(player).setTag("&8[&5Developer&8]");
}
else if (TFM_AdminList.isSeniorAdmin(player))
{
player.setPlayerListName(ChatColor.LIGHT_PURPLE + player.getName());
name = ChatColor.LIGHT_PURPLE + name;
TFM_PlayerData.getPlayerData(player).setTag("&8[&dSenior Admin&8]");
}
else if (TFM_AdminList.isTelnetAdmin(player, true))
{
player.setPlayerListName(ChatColor.DARK_GREEN + player.getName());
name = ChatColor.DARK_GREEN + name;
TFM_PlayerData.getPlayerData(player).setTag("&8[&2Telnet Admin&8]");
}
else if (TFM_AdminList.isSuperAdmin(player))
{
player.setPlayerListName(ChatColor.AQUA + player.getName());
name = ChatColor.AQUA + name;
TFM_PlayerData.getPlayerData(player).setTag("&8[&BSuper Admin&8]");
}
try
{
player.setPlayerListName(name.substring(0, 16));
}
catch (IllegalArgumentException ex)
{
}
}
}