From 8b69bdd0d1c4a6f6cfc32e60e30751f5f6440ce7 Mon Sep 17 00:00:00 2001 From: AgentLV Date: Mon, 14 Mar 2016 23:26:23 +0100 Subject: [PATCH] Add hand used to BlockPlaceEvent. --- .../java/org/bukkit/craftbukkit/event/CraftEventFactory.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 859de8a290..0abfc60834 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -132,13 +132,16 @@ public class CraftEventFactory { boolean canBuild = canBuild(craftWorld, player, placedBlock.getX(), placedBlock.getZ()); org.bukkit.inventory.ItemStack item; + EquipmentSlot equipmentSlot; if (hand == EnumHand.MAIN_HAND) { item = player.getInventory().getItemInMainHand(); + equipmentSlot = EquipmentSlot.HAND; } else { item = player.getInventory().getItemInOffHand(); + equipmentSlot = EquipmentSlot.OFF_HAND; } - BlockPlaceEvent event = new BlockPlaceEvent(placedBlock, replacedBlockState, blockClicked, item, player, canBuild); + BlockPlaceEvent event = new BlockPlaceEvent(placedBlock, replacedBlockState, blockClicked, item, player, canBuild, equipmentSlot); craftServer.getPluginManager().callEvent(event); return event;