mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-05 02:22:12 +01:00
SPIGOT-6369: Add ItemStack to HangingPlaceEvent
By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
parent
2e77f4180e
commit
a2f69a4ad8
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.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
@ -18,12 +19,19 @@ public class HangingPlaceEvent extends HangingEvent implements Cancellable {
|
||||||
private final Player player;
|
private final Player player;
|
||||||
private final Block block;
|
private final Block block;
|
||||||
private final BlockFace blockFace;
|
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) {
|
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);
|
super(hanging);
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.block = block;
|
this.block = block;
|
||||||
this.blockFace = blockFace;
|
this.blockFace = blockFace;
|
||||||
|
this.itemStack = itemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,6 +64,16 @@ public class HangingPlaceEvent extends HangingEvent implements Cancellable {
|
||||||
return blockFace;
|
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
|
@Override
|
||||||
public boolean isCancelled() {
|
public boolean isCancelled() {
|
||||||
return cancelled;
|
return cancelled;
|
||||||
|
|
Loading…
Reference in a new issue