From f42422267235fdf3b44124889435ac56e302c018 Mon Sep 17 00:00:00 2001 From: blablubbabc Date: Sun, 16 Jun 2019 11:13:42 +1000 Subject: [PATCH] Optimize getEntitiesByClasses slightly --- src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 6091f1a34f..48ccc0d851 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -885,8 +885,10 @@ public class CraftWorld implements World { Class bukkitClass = bukkitEntity.getClass(); for (Class clazz : classes) { - if (clazz.isAssignableFrom(bukkitClass) && bukkitEntity.isValid()) { - list.add(bukkitEntity); + if (clazz.isAssignableFrom(bukkitClass)) { + if (bukkitEntity.isValid()) { + list.add(bukkitEntity); + } break; } }