diff --git a/paper-api/src/main/java/org/bukkit/event/hanging/HangingPlaceEvent.java b/paper-api/src/main/java/org/bukkit/event/hanging/HangingPlaceEvent.java index 959b9f3fb4..1bcff119ec 100644 --- a/paper-api/src/main/java/org/bukkit/event/hanging/HangingPlaceEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/hanging/HangingPlaceEvent.java @@ -6,6 +6,7 @@ import org.bukkit.entity.Hanging; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; +import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -18,12 +19,19 @@ public class HangingPlaceEvent extends HangingEvent implements Cancellable { private final Player player; private final Block block; private final BlockFace blockFace; + private final ItemStack itemStack; + @Deprecated public HangingPlaceEvent(@NotNull final Hanging hanging, @Nullable final Player player, @NotNull final Block block, @NotNull final BlockFace blockFace) { + this(hanging, player, block, blockFace, null); + } + + public HangingPlaceEvent(@NotNull final Hanging hanging, @Nullable final Player player, @NotNull final Block block, @NotNull final BlockFace blockFace, @Nullable ItemStack itemStack) { super(hanging); this.player = player; this.block = block; this.blockFace = blockFace; + this.itemStack = itemStack; } /** @@ -56,6 +64,16 @@ public class HangingPlaceEvent extends HangingEvent implements Cancellable { return blockFace; } + /** + * Gets the item from which the hanging entity originated + * + * @return the item from which the hanging entity originated + */ + @Nullable + public ItemStack getItemStack() { + return itemStack; + } + @Override public boolean isCancelled() { return cancelled;