Fix IllegalArgumentException with UtilPlayer method

This commit is contained in:
Shaun Bennett 2015-06-06 15:02:16 -05:00
parent 1f92564ea1
commit b2bdfe384b

View File

@ -620,7 +620,7 @@ public class UtilPlayer
public static Player getRandomTarget(Location location, double maxDist)
{
List<Player> nearby = getNearby(location, maxDist);
return nearby.get(RANDOM.nextInt(nearby.size()));
return nearby.size() > 0 ? nearby.get(RANDOM.nextInt(nearby.size())) : null;
}
public static boolean isSpectator(Entity player)