fix NPE in IPlayerManager#getOnlyVisibleFor(...)
This commit is contained in:
parent
db27f9e15f
commit
b2c2d98dd1
@ -115,12 +115,13 @@ public abstract class IPlayerManager<OP extends IOnlinePlayer, OF extends IOffPl
|
|||||||
|
|
||||||
public List<OP> getOnlyVisibleFor(OF viewer) {
|
public List<OP> getOnlyVisibleFor(OF viewer) {
|
||||||
List<OP> players = getAll();
|
List<OP> players = getAll();
|
||||||
players.removeIf(op -> op.isVanishedFor(viewer));
|
if (viewer != null)
|
||||||
|
players.removeIf(op -> op.isVanishedFor(viewer));
|
||||||
return players;
|
return players;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OP> getOnlyVisibleFor(OP viewer, boolean sameServerOnly) {
|
public List<OP> getOnlyVisibleFor(OP viewer, boolean sameServerOnly) {
|
||||||
if (sameServerOnly && viewer.getServerName() == null)
|
if (sameServerOnly && (viewer == null || viewer.getServerName() == null))
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
Loading…
Reference in New Issue
Block a user