Fixed FastModeExtent not properly handling dirty chunks.

This commit is contained in:
sk89q 2014-03-31 17:43:21 -07:00
parent f688b3daa5
commit dcf35e5312

View File

@ -82,27 +82,29 @@ public void setEnabled(boolean enabled) {
@Override @Override
public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException { public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException {
dirtyChunks.add(new BlockVector2D(location.getBlockX() >> 4, location.getBlockZ() >> 4)); if (enabled) {
return world.setBlock(location, block, !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 @Override
protected Operation commitBefore() { protected Operation commitBefore() {
if (dirtyChunks.size() > 0) { return new Operation() {
return new Operation() { @Override
@Override public Operation resume() throws WorldEditException {
public Operation resume() throws WorldEditException { if (dirtyChunks.size() > 0) {
world.fixAfterFastMode(dirtyChunks); world.fixAfterFastMode(dirtyChunks);
return null;
} }
return null;
}
@Override @Override
public void cancel() { public void cancel() {
} }
}; };
} else {
return null;
}
} }
} }