Throw BlockPlaceEvent when placing double slabs. Fixes BUKKIT-2469

This commit is contained in:
feildmaster
2013-01-16 05:39:13 -06:00
parent 647b82032b
commit 614ef2f8c5
2 changed files with 61 additions and 39 deletions

View File

@@ -37,7 +37,18 @@ public class ItemStep extends ItemBlock {
boolean flag = (j1 & 8) != 0;
if ((l == 1 && !flag || l == 0 && flag) && i1 == this.b.id && k1 == itemstack.getData()) {
return super.interactWith(itemstack, entityhuman, world, i, j, k, -1, f, f1, f2); // CraftBukkit - handle this in super
// CraftBukkit start - handle in processBlockPlace()
/*
if (world.b(this.c.e(world, i, j, k)) && world.setTypeIdAndData(i, j, k, this.c.id, k1)) {
world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.c.stepSound.getPlaceSound(), (this.c.stepSound.getVolume1() + 1.0F) / 2.0F, this.c.stepSound.getVolume2() * 0.8F);
--itemstack.count;
}
*/
if (world.b(this.c.e(world, i, j, k))) {
processBlockPlace(world, entityhuman, itemstack, i, j, k, this.c.id, k1);
}
// CraftBukkit end
return true;
} else {
return this.a(itemstack, entityhuman, world, i, j, k, l) ? true : super.interactWith(itemstack, entityhuman, world, i, j, k, l, f, f1, f2);
}
@@ -74,11 +85,17 @@ public class ItemStep extends ItemBlock {
int k1 = j1 & 7;
if (i1 == this.b.id && k1 == itemstack.getData()) {
// CraftBukkit start - handle in processBlockPlace()
/*
if (world.b(this.c.e(world, i, j, k)) && world.setTypeIdAndData(i, j, k, this.c.id, k1)) {
world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.c.stepSound.getPlaceSound(), (this.c.stepSound.getVolume1() + 1.0F) / 2.0F, this.c.stepSound.getVolume2() * 0.8F);
--itemstack.count;
}
*/
if (world.b(this.c.e(world, i, j, k))) {
processBlockPlace(world, entityhuman, itemstack, i, j, k, this.c.id, k1);
}
// CraftBukkit end
return true;
} else {
return false;