Paper/patches/server/0377-add-hand-to-BlockMultiPlaceEvent.patch
2021-11-30 17:31:13 -08:00

31 lines
1.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Trigary <trigary0@gmail.com>
Date: Sun, 1 Mar 2020 22:43:24 +0100
Subject: [PATCH] add hand to BlockMultiPlaceEvent
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 61c95f98a3e3e52a23f65f7c957019f7f1aa7417..bf7c61c767bdfe8ddb63367f1b38dbbeba17ba02 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -344,13 +344,18 @@ public class CraftEventFactory {
}
org.bukkit.inventory.ItemStack item;
+ // Paper start - add hand to BlockMultiPlaceEvent
+ EquipmentSlot equipmentSlot;
if (hand == InteractionHand.MAIN_HAND) {
item = player.getInventory().getItemInMainHand();
+ equipmentSlot = EquipmentSlot.HAND;
} else {
item = player.getInventory().getItemInOffHand();
+ equipmentSlot = EquipmentSlot.OFF_HAND;
}
- BlockMultiPlaceEvent event = new BlockMultiPlaceEvent(blockStates, blockClicked, item, player, canBuild);
+ BlockMultiPlaceEvent event = new BlockMultiPlaceEvent(blockStates, blockClicked, item, player, canBuild, equipmentSlot);
+ // Paper end
craftServer.getPluginManager().callEvent(event);
return event;