Fix NPE with /list in console

This commit is contained in:
KHobbits 2014-06-27 03:48:26 +01:00
parent 6269ce9a3f
commit 9b69403ee1

View File

@ -51,7 +51,7 @@ public class PlayerList
int hiddenCount = 0; int hiddenCount = 0;
for (Player onlinePlayer : server.getOnlinePlayers()) for (Player onlinePlayer : server.getOnlinePlayers())
{ {
if (ess.getUser(onlinePlayer).isHidden(user.getBase())) if (ess.getUser(onlinePlayer).isHidden() || (user != null && !user.getBase().canSee(onlinePlayer)))
{ {
playerHidden++; playerHidden++;
if (showHidden || user.getBase().canSee(onlinePlayer)) if (showHidden || user.getBase().canSee(onlinePlayer))
@ -80,7 +80,8 @@ public class PlayerList
for (Player onlinePlayer : server.getOnlinePlayers()) for (Player onlinePlayer : server.getOnlinePlayers())
{ {
final User onlineUser = ess.getUser(onlinePlayer); final User onlineUser = ess.getUser(onlinePlayer);
if (onlineUser.isHidden(sender.getBase()) && !showHidden && (sender != null && !sender.getBase().canSee(onlinePlayer))) if ((sender == null && !showHidden && onlineUser.isHidden()) ||
(sender != null && !showHidden && !sender.getBase().canSee(onlinePlayer)))
{ {
continue; continue;
} }