mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-08-05 16:49:39 +00:00
SPIGOT-6369: Add ItemStack to HangingPlaceEvent
This commit is contained in:
parent
eec4aab001
commit
02d03f3536
1 changed files with 18 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue