Added a workaround for onBlockDestroy providing (0, 0, 0). Setting air no longer sets the data.

This commit is contained in:
sk89q 2010-10-15 10:22:55 -07:00
parent 9e9cd627a3
commit c947083640
2 changed files with 21 additions and 12 deletions

View File

@ -113,9 +113,10 @@ public class EditSession {
*/ */
private boolean rawSetBlock(Vector pt, BaseBlock block) { private boolean rawSetBlock(Vector pt, BaseBlock block) {
boolean result = server.setBlockType(pt, block.getID()); boolean result = server.setBlockType(pt, block.getID());
if (block.getID() != 0) {
// Changes in block data don't take effect if the block type doesn't // Changes in block data don't take effect if the block type doesn't
// change, so here's a hack! // change, so here's a hack!
if (!result && block.getID() != 0) { if (!result) {
server.setBlockType(pt, 0); server.setBlockType(pt, 0);
result = server.setBlockType(pt, block.getID()); result = server.setBlockType(pt, block.getID());
} }
@ -127,6 +128,8 @@ public class EditSession {
String[] text = signBlock.getText(); String[] text = signBlock.getText();
server.setSignText(pt, text); server.setSignText(pt, text);
} }
}
return result; return result;
} }

View File

@ -92,6 +92,12 @@ public class SMWorldEditListener extends PluginListener {
blockClicked.getY(), blockClicked.getY(),
blockClicked.getZ()); blockClicked.getZ());
// Bug workaround
if (cur.getBlockX() == 0 && cur.getBlockY() == 0
&& cur.getBlockZ() == 0) {
return false;
}
try { try {
if (session.getPos1().equals(cur)) { if (session.getPos1().equals(cur)) {
return false; return false;