From c947083640ccc5075893525b690f06874b0560c5 Mon Sep 17 00:00:00 2001 From: sk89q Date: Fri, 15 Oct 2010 10:22:55 -0700 Subject: [PATCH] Added a workaround for onBlockDestroy providing (0, 0, 0). Setting air no longer sets the data. --- src/EditSession.java | 27 +++++++++++++++------------ src/SMWorldEditListener.java | 6 ++++++ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/EditSession.java b/src/EditSession.java index c0e80a17d..b70fa320d 100644 --- a/src/EditSession.java +++ b/src/EditSession.java @@ -113,20 +113,23 @@ public class EditSession { */ private boolean rawSetBlock(Vector pt, BaseBlock block) { boolean result = server.setBlockType(pt, block.getID()); - // Changes in block data don't take effect if the block type doesn't - // change, so here's a hack! - if (!result && block.getID() != 0) { - server.setBlockType(pt, 0); - result = server.setBlockType(pt, block.getID()); - } - server.setBlockData(pt, block.getData()); + if (block.getID() != 0) { + // Changes in block data don't take effect if the block type doesn't + // change, so here's a hack! + if (!result) { + server.setBlockType(pt, 0); + result = server.setBlockType(pt, block.getID()); + } + server.setBlockData(pt, block.getData()); - // Signs - if (block instanceof SignBlock) { - SignBlock signBlock = (SignBlock)block; - String[] text = signBlock.getText(); - server.setSignText(pt, text); + // Signs + if (block instanceof SignBlock) { + SignBlock signBlock = (SignBlock)block; + String[] text = signBlock.getText(); + server.setSignText(pt, text); + } } + return result; } diff --git a/src/SMWorldEditListener.java b/src/SMWorldEditListener.java index a642e7a0e..c81d71160 100644 --- a/src/SMWorldEditListener.java +++ b/src/SMWorldEditListener.java @@ -92,6 +92,12 @@ public class SMWorldEditListener extends PluginListener { blockClicked.getY(), blockClicked.getZ()); + // Bug workaround + if (cur.getBlockX() == 0 && cur.getBlockY() == 0 + && cur.getBlockZ() == 0) { + return false; + } + try { if (session.getPos1().equals(cur)) { return false;