Check for null values better.

This commit is contained in:
Brianna 2020-04-16 04:48:12 -04:00
parent 690c7349a8
commit 2aa29b3c81
1 changed files with 2 additions and 1 deletions

View File

@ -73,7 +73,8 @@ public class ActiveMinionHolder implements IActiveHolder {
// this.livingEntityMap.clear();
// 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())))
.entrySet().stream()
.filter(e -> e.getValue() != null && e.getValue().getWorld().isChunkLoaded(