From b7fea42777bc65e64b5c22ffcb9018dcd707e928 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 31 May 2019 06:56:00 +1000 Subject: [PATCH] SPIGOT-5010: World.getEntities returns entities in border chunks --- src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 8b95301c3e..b5052e1a1e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -811,7 +811,7 @@ public class CraftWorld implements World { Entity bukkitEntity = mcEnt.getBukkitEntity(); // Assuming that bukkitEntity isn't null - if (bukkitEntity != null) { + if (bukkitEntity != null && bukkitEntity.isValid()) { list.add(bukkitEntity); } } @@ -830,7 +830,7 @@ public class CraftWorld implements World { Entity bukkitEntity = mcEnt.getBukkitEntity(); // Assuming that bukkitEntity isn't null - if (bukkitEntity != null && bukkitEntity instanceof LivingEntity) { + if (bukkitEntity != null && bukkitEntity instanceof LivingEntity && bukkitEntity.isValid()) { list.add((LivingEntity) bukkitEntity); } }