#788: Add getHand() to all relevant events
By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
@@ -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.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -19,18 +20,20 @@ public class HangingPlaceEvent extends HangingEvent implements Cancellable {
|
||||
private final Player player;
|
||||
private final Block block;
|
||||
private final BlockFace blockFace;
|
||||
private final EquipmentSlot hand;
|
||||
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 final EquipmentSlot hand) {
|
||||
this(hanging, player, block, blockFace, hand, null);
|
||||
}
|
||||
|
||||
public HangingPlaceEvent(@NotNull final Hanging hanging, @Nullable final Player player, @NotNull final Block block, @NotNull final BlockFace blockFace, @Nullable ItemStack itemStack) {
|
||||
public HangingPlaceEvent(@NotNull final Hanging hanging, @Nullable final Player player, @NotNull final Block block, @NotNull final BlockFace blockFace, @Nullable final EquipmentSlot hand, @Nullable ItemStack itemStack) {
|
||||
super(hanging);
|
||||
this.player = player;
|
||||
this.block = block;
|
||||
this.blockFace = blockFace;
|
||||
this.hand = hand;
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
|
||||
@@ -64,6 +67,17 @@ public class HangingPlaceEvent extends HangingEvent implements Cancellable {
|
||||
return blockFace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the hand that was used to place the hanging entity, or null
|
||||
* if a player did not place the hanging entity.
|
||||
*
|
||||
* @return the hand
|
||||
*/
|
||||
@Nullable
|
||||
public EquipmentSlot getHand() {
|
||||
return hand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item from which the hanging entity originated
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user