mirror of
https://github.com/TheDeus-Group/TFM-4.3-Reloaded.git
synced 2024-12-23 08:25:12 +00:00
Truncate string argument on calls calls to setPlayerListName. Resolves #262.
This commit is contained in:
parent
00e22dc56e
commit
d5d6f18fb4
1 changed files with 16 additions and 5 deletions
|
@ -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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue