mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Truncate string argument on calls calls to setPlayerListName. Resolves #262.
This commit is contained in:
parent
00e22dc56e
commit
d5d6f18fb4
@ -858,26 +858,37 @@ public class TFM_PlayerListener implements Listener
|
|||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public static void onPlayerJoinEvent(PlayerJoinEvent event)
|
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()))
|
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]");
|
TFM_PlayerData.getPlayerData(player).setTag("&8[&5Developer&8]");
|
||||||
}
|
}
|
||||||
else if (TFM_AdminList.isSeniorAdmin(player))
|
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]");
|
TFM_PlayerData.getPlayerData(player).setTag("&8[&dSenior Admin&8]");
|
||||||
}
|
}
|
||||||
else if (TFM_AdminList.isTelnetAdmin(player, true))
|
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]");
|
TFM_PlayerData.getPlayerData(player).setTag("&8[&2Telnet Admin&8]");
|
||||||
}
|
}
|
||||||
else if (TFM_AdminList.isSuperAdmin(player))
|
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]");
|
TFM_PlayerData.getPlayerData(player).setTag("&8[&BSuper Admin&8]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
player.setPlayerListName(name.substring(0, 16));
|
||||||
|
}
|
||||||
|
catch (IllegalArgumentException ex)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user