From 260bd8c7c4a2700d697ea23e2f693f4cb1f17d2e Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sun, 16 Jun 2019 11:13:42 +1000 Subject: [PATCH] Optimize getEntitiesByClasses slightly By: blablubbabc --- .../src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 6091f1a34f..48ccc0d851 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/paper-server/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; } }