From dcf35e531220b75437dcdacb198b6a68da9d5cbf Mon Sep 17 00:00:00 2001 From: sk89q Date: Mon, 31 Mar 2014 17:43:21 -0700 Subject: [PATCH] Fixed FastModeExtent not properly handling dirty chunks. --- .../worldedit/extent/FastModeExtent.java | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/extent/FastModeExtent.java b/src/main/java/com/sk89q/worldedit/extent/FastModeExtent.java index 750b26b3f..50f0853c7 100644 --- a/src/main/java/com/sk89q/worldedit/extent/FastModeExtent.java +++ b/src/main/java/com/sk89q/worldedit/extent/FastModeExtent.java @@ -82,27 +82,29 @@ public class FastModeExtent extends ExtentDelegate { @Override public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException { - dirtyChunks.add(new BlockVector2D(location.getBlockX() >> 4, location.getBlockZ() >> 4)); - return world.setBlock(location, block, !enabled); + if (enabled) { + dirtyChunks.add(new BlockVector2D(location.getBlockX() >> 4, location.getBlockZ() >> 4)); + return world.setBlock(location, block, false); + } else { + return world.setBlock(location, block, true); + } } @Override protected Operation commitBefore() { - if (dirtyChunks.size() > 0) { - return new Operation() { - @Override - public Operation resume() throws WorldEditException { + return new Operation() { + @Override + public Operation resume() throws WorldEditException { + if (dirtyChunks.size() > 0) { world.fixAfterFastMode(dirtyChunks); - return null; } + return null; + } - @Override - public void cancel() { - } - }; - } else { - return null; - } + @Override + public void cancel() { + } + }; } }