From 3e8b2edff9c791ea2e42759f6c8a1a410d0a07a7 Mon Sep 17 00:00:00 2001 From: sk89q Date: Mon, 17 Jan 2011 21:26:18 -0800 Subject: [PATCH] Fixed block bags not being flushed in super pickaxe modes. --- src/com/sk89q/worldedit/superpickaxe/BlockReplacer.java | 7 +++++-- src/com/sk89q/worldedit/superpickaxe/SphereBrush.java | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/com/sk89q/worldedit/superpickaxe/BlockReplacer.java b/src/com/sk89q/worldedit/superpickaxe/BlockReplacer.java index 0ba8c0461..52007e17c 100644 --- a/src/com/sk89q/worldedit/superpickaxe/BlockReplacer.java +++ b/src/com/sk89q/worldedit/superpickaxe/BlockReplacer.java @@ -20,6 +20,7 @@ package com.sk89q.worldedit.superpickaxe; import com.sk89q.worldedit.*; +import com.sk89q.worldedit.bags.BlockBag; import com.sk89q.worldedit.blocks.BaseBlock; /** @@ -37,15 +38,17 @@ public class BlockReplacer implements SuperPickaxeMode { @Override public boolean act(ServerInterface server, LocalConfiguration config, LocalPlayer player, LocalSession session, WorldVector clicked) { + + BlockBag bag = session.getBlockBag(player); LocalWorld world = clicked.getWorld(); - EditSession editSession = new EditSession(server, world, -1, - session.getBlockBag(player)); + EditSession editSession = new EditSession(server, world, -1, bag); try { editSession.setBlock(clicked, targetBlock); } catch (MaxChangedBlocksException e) { } finally { + bag.flushChanges(); session.remember(editSession); } diff --git a/src/com/sk89q/worldedit/superpickaxe/SphereBrush.java b/src/com/sk89q/worldedit/superpickaxe/SphereBrush.java index 4806805c2..7badd5548 100644 --- a/src/com/sk89q/worldedit/superpickaxe/SphereBrush.java +++ b/src/com/sk89q/worldedit/superpickaxe/SphereBrush.java @@ -20,6 +20,7 @@ package com.sk89q.worldedit.superpickaxe; import com.sk89q.worldedit.*; +import com.sk89q.worldedit.bags.BlockBag; import com.sk89q.worldedit.blocks.BaseBlock; /** @@ -47,9 +48,11 @@ public class SphereBrush implements SuperPickaxeMode { player.printError("No block in sight!"); return true; } - + + BlockBag bag = session.getBlockBag(player); + ReplacingEditSession editSession = new ReplacingEditSession(server, target.getWorld(), - session.getBlockChangeLimit(), session.getBlockBag(player)); + session.getBlockChangeLimit(), bag); if (nonReplacing) { editSession.disableReplacing(); @@ -60,6 +63,7 @@ public class SphereBrush implements SuperPickaxeMode { } catch (MaxChangedBlocksException e) { player.printError("Max blocks change limit reached."); } finally { + bag.flushChanges(); editSession.enableReplacing(); session.remember(editSession); }