From f1efe717bddde600ec40dc66f6964748eab3e372 Mon Sep 17 00:00:00 2001 From: feildmaster Date: Sun, 20 Jan 2013 00:34:55 -0600 Subject: [PATCH] Call BlockPlaceEvent for skulls the same as other blocks. BUKKIT-3406 When the skull BlockPlaceEvent was added it was made so the event would be called after all the data has been set, however this is a behavior change that is inconsistent with other BlockPlaceEvents. Instead, if people wish to get the block data they should schedule a task. Relates to: BUKKIT-3438 --- .../java/net/minecraft/server/ItemSkull.java | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/src/main/java/net/minecraft/server/ItemSkull.java b/src/main/java/net/minecraft/server/ItemSkull.java index facd5d4472..bf2cd4f300 100644 --- a/src/main/java/net/minecraft/server/ItemSkull.java +++ b/src/main/java/net/minecraft/server/ItemSkull.java @@ -1,7 +1,5 @@ package net.minecraft.server; -import org.bukkit.craftbukkit.block.CraftBlockState; // CraftBukkit - public class ItemSkull extends Item { private static final String[] a = new String[] { "skeleton", "wither", "zombie", "char", "creeper"}; @@ -20,8 +18,6 @@ public class ItemSkull extends Item { } else if (!world.getMaterial(i, j, k).isBuildable()) { return false; } else { - int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit - if (l == 1) { ++j; } @@ -47,9 +43,13 @@ public class ItemSkull extends Item { } else if (!Block.SKULL.canPlace(world, i, j, k)) { return false; } else { - CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit - - world.setTypeIdAndData(i, j, k, Block.SKULL.id, l); + // CraftBukkit start - handle in ItemBlock + // world.setTypeIdAndData(i, j, k, Block.SKULL.id, l); + if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, Block.SKULL.id, l)) { + return false; + } + l = world.getData(i, j, k); + // CraftBukkit end int i1 = 0; if (l == 1) { @@ -70,15 +70,6 @@ public class ItemSkull extends Item { ((BlockSkull) Block.SKULL).a(world, i, j, k, (TileEntitySkull) tileentity); } - // CraftBukkit start - org.bukkit.event.block.BlockPlaceEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ); - - if (event.isCancelled() || !event.canBuild()) { - event.getBlockPlaced().setTypeIdAndData(blockState.getTypeId(), blockState.getRawData(), false); - return false; - } - // CraftBukkit end - --itemstack.count; return true; }