Dodge another ProtocolLib temporary player.

This commit is contained in:
Olof Larsson 2016-05-31 11:56:05 +02:00
parent cbf50c5741
commit 7ec9908c63
No known key found for this signature in database
GPG Key ID: BBEF14F97DA52474

View File

@ -678,7 +678,18 @@ public class IdUtil implements Listener, Runnable
public static String getIdFromSender(CommandSender sender) public static String getIdFromSender(CommandSender sender)
{ {
if (sender instanceof Player) return ((Player) sender).getUniqueId().toString(); if (sender instanceof Player)
{
try
{
return ((Player) sender).getUniqueId().toString();
}
catch (UnsupportedOperationException e)
{
// ProtocolLib: The method getUniqueId is not supported for temporary players.
return null;
}
}
if (sender instanceof ConsoleCommandSender) return CONSOLE_ID; if (sender instanceof ConsoleCommandSender) return CONSOLE_ID;
// We blacklist all entities other than players. // We blacklist all entities other than players.