From 5ce1dd48e168c258d2fadba212f50db6fd5b7a2b Mon Sep 17 00:00:00 2001 From: Gergely Sarkozi Date: Mon, 2 Mar 2020 21:55:31 +0100 Subject: [PATCH] Add hand to BlockMultiPlaceEvent (fixes #2997) (#2998) --- ...192-add-hand-to-BlockMultiPlaceEvent.patch | 31 +++++++++++++++++ ...444-add-hand-to-BlockMultiPlaceEvent.patch | 33 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 Spigot-API-Patches/0192-add-hand-to-BlockMultiPlaceEvent.patch create mode 100644 Spigot-Server-Patches/0444-add-hand-to-BlockMultiPlaceEvent.patch diff --git a/Spigot-API-Patches/0192-add-hand-to-BlockMultiPlaceEvent.patch b/Spigot-API-Patches/0192-add-hand-to-BlockMultiPlaceEvent.patch new file mode 100644 index 0000000000..89ea24ac59 --- /dev/null +++ b/Spigot-API-Patches/0192-add-hand-to-BlockMultiPlaceEvent.patch @@ -0,0 +1,31 @@ +From 1735e9e48b344eb98d739f46cda33177ba37107e Mon Sep 17 00:00:00 2001 +From: Trigary +Date: Sun, 1 Mar 2020 22:43:34 +0100 +Subject: [PATCH] add hand to BlockMultiPlaceEvent + + +diff --git a/src/main/java/org/bukkit/event/block/BlockMultiPlaceEvent.java b/src/main/java/org/bukkit/event/block/BlockMultiPlaceEvent.java +index fe2ec79dd..8460aa4f5 100644 +--- a/src/main/java/org/bukkit/event/block/BlockMultiPlaceEvent.java ++++ b/src/main/java/org/bukkit/event/block/BlockMultiPlaceEvent.java +@@ -18,9 +18,17 @@ import org.jetbrains.annotations.NotNull; + public class BlockMultiPlaceEvent extends BlockPlaceEvent { + private final List states; + ++ @Deprecated // Paper + public BlockMultiPlaceEvent(@NotNull List states, @NotNull Block clicked, @NotNull ItemStack itemInHand, @NotNull Player thePlayer, boolean canBuild) { +- super(states.get(0).getBlock(), states.get(0), clicked, itemInHand, thePlayer, canBuild); ++ //Paper start - add hand to BlockMultiPlaceEvent ++ this(states, clicked, itemInHand, thePlayer, canBuild, org.bukkit.inventory.EquipmentSlot.HAND); ++ } ++ ++ ++ public BlockMultiPlaceEvent(@NotNull List states, @NotNull Block clicked, @NotNull ItemStack itemInHand, @NotNull Player thePlayer, boolean canBuild, @NotNull org.bukkit.inventory.EquipmentSlot hand) { ++ super(states.get(0).getBlock(), states.get(0), clicked, itemInHand, thePlayer, canBuild, hand); + this.states = ImmutableList.copyOf(states); ++ //Paper end + } + + /** +-- +2.25.0 diff --git a/Spigot-Server-Patches/0444-add-hand-to-BlockMultiPlaceEvent.patch b/Spigot-Server-Patches/0444-add-hand-to-BlockMultiPlaceEvent.patch new file mode 100644 index 0000000000..9961cbc792 --- /dev/null +++ b/Spigot-Server-Patches/0444-add-hand-to-BlockMultiPlaceEvent.patch @@ -0,0 +1,33 @@ +From c314f5a599f6d42e936911ab1bd72d0885d056fe Mon Sep 17 00:00:00 2001 +From: Trigary +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 39ce40bd5..1f5d15bb4 100644 +--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java ++++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +@@ -296,13 +296,18 @@ public class CraftEventFactory { + } + + org.bukkit.inventory.ItemStack item; ++ //Paper start - add hand to BlockMultiPlaceEvent ++ EquipmentSlot equipmentSlot; + if (hand == EnumHand.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; +-- +2.16.1.windows.4 +