Check for null values better.
This commit is contained in:
parent
690c7349a8
commit
2aa29b3c81
|
@ -73,7 +73,8 @@ public class ActiveMinionHolder implements IActiveHolder {
|
||||||
// this.livingEntityMap.clear();
|
// this.livingEntityMap.clear();
|
||||||
|
|
||||||
// grab list of all valid entities by UUID that can be removed
|
// grab list of all valid entities by UUID that can be removed
|
||||||
Map<Integer, Entity> toRemove = this.livingEntityMap.entrySet().stream().filter(Objects::nonNull)
|
Map<Integer, Entity> toRemove = this.livingEntityMap.entrySet().stream()
|
||||||
|
.filter(e -> e != null && e.getValue() != null && ServerUtils.get().getEntity(e.getValue()) != null)
|
||||||
.collect(Collectors.toMap(Map.Entry::getKey, e -> ServerUtils.get().getEntity(e.getValue())))
|
.collect(Collectors.toMap(Map.Entry::getKey, e -> ServerUtils.get().getEntity(e.getValue())))
|
||||||
.entrySet().stream()
|
.entrySet().stream()
|
||||||
.filter(e -> e.getValue() != null && e.getValue().getWorld().isChunkLoaded(
|
.filter(e -> e.getValue() != null && e.getValue().getWorld().isChunkLoaded(
|
||||||
|
|
Loading…
Reference in New Issue