diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java index e9b463a9b..747b71e97 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java @@ -33,7 +33,6 @@ import com.plotsquared.core.inject.factory.ChunkCoordinatorFactory; import com.plotsquared.core.queue.BasicQueueCoordinator; import com.plotsquared.core.queue.ChunkCoordinator; import com.plotsquared.core.queue.LocalChunk; -import com.plotsquared.core.util.BlockUtil; import com.plotsquared.core.util.ChunkUtil; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.WorldEditException; @@ -77,13 +76,8 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator { } @Override public BlockState getBlock(int x, int y, int z) { - org.bukkit.World worldObj = BukkitAdapter.adapt(getWorld()); - if (worldObj != null) { - Block block = worldObj.getBlockAt(x, y, z); - return BukkitBlockUtil.get(block); - } else { - return BlockUtil.get(0, 0); - } + Block block = getBukkitWorld().getBlockAt(x, y, z); + return BukkitBlockUtil.get(block); } @Override public void start() { @@ -227,11 +221,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator { } catch (WorldEditException ignored) { // Fallback to not so nice method BlockData blockData = BukkitAdapter.adapt(block); - - if (bukkitWorld == null) { - bukkitWorld = Bukkit.getWorld(getWorld().getName()); - } - Chunk chunk = bukkitWorld.getChunkAt(blockVector2.getX(), blockVector2.getZ()); + Chunk chunk = getBukkitWorld().getChunkAt(blockVector2.getX(), blockVector2.getZ()); Block existing = chunk.getBlock(x, y, z); final BlockState existingBaseBlock = BukkitAdapter.adapt(existing.getBlockData()); @@ -254,4 +244,11 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator { } } + private org.bukkit.World getBukkitWorld() { + if (bukkitWorld == null) { + bukkitWorld = Bukkit.getWorld(getWorld().getName()); + } + return bukkitWorld; + } + }