From 878c26a8f0f9098691403c1a08d37a7084539a33 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Sat, 24 Aug 2013 10:43:51 +0200 Subject: [PATCH] Control flow improvements. --- .../com/sk89q/worldedit/bukkit/BukkitWorld.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java index 71bc1dbe5..680715248 100644 --- a/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -1297,12 +1297,14 @@ public void simulateBlockMine(Vector pt) { public LocalEntity[] getEntities(Region region) { List entities = new ArrayList(); for (Vector2D pt : region.getChunks()) { - if (world.isChunkLoaded(pt.getBlockX(), pt.getBlockZ())) { - Entity[] ents = world.getChunkAt(pt.getBlockX(), pt.getBlockZ()).getEntities(); - for (Entity ent : ents) { - if (region.contains(BukkitUtil.toVector(ent.getLocation()))) { - entities.add(BukkitUtil.toLocalEntity(ent)); - } + if (!world.isChunkLoaded(pt.getBlockX(), pt.getBlockZ())) { + continue; + } + + final Entity[] ents = world.getChunkAt(pt.getBlockX(), pt.getBlockZ()).getEntities(); + for (Entity ent : ents) { + if (region.contains(BukkitUtil.toVector(ent.getLocation()))) { + entities.add(BukkitUtil.toLocalEntity(ent)); } } }