public class PlayerShearBlockEvent extends PlayerEvent implements Cancellable
This event is not called when breaking blocks with shears but instead only when a player uses the sheer item on a block to garner drops from said block and/or change its state.
Examples include shearing a pumpkin to turn it into a carved pumpkin or shearing a beehive to get honeycomb.
Event.Result
player
Constructor and Description |
---|
PlayerShearBlockEvent(@NotNull Player who,
@NotNull Block block,
@NotNull ItemStack item,
@NotNull EquipmentSlot hand,
@NotNull List<ItemStack> drops) |
Modifier and Type | Method and Description |
---|---|
@NotNull Block |
getBlock()
Gets the block being sheared in this event.
|
@NotNull List<ItemStack> |
getDrops()
Gets the resulting drops of this event.
|
@NotNull EquipmentSlot |
getHand()
Gets the hand used to shear the block.
|
static @NotNull HandlerList |
getHandlerList() |
@NotNull HandlerList |
getHandlers() |
@NotNull ItemStack |
getItem()
Gets the item used to shear the block.
|
boolean |
isCancelled()
Gets whether the shearing of the block should be cancelled or not.
|
void |
setCancelled(boolean cancel)
Sets whether the shearing of the block should be cancelled or not.
|
getPlayer
callEvent, getEventName, isAsynchronous
@NotNull public @NotNull Block getBlock()
Block
which block is being sheared in this event.@NotNull public @NotNull ItemStack getItem()
ItemStack
of the shears.@NotNull public @NotNull EquipmentSlot getHand()
EquipmentSlot.HAND
OR EquipmentSlot.OFF_HAND
.@NotNull public @NotNull List<ItemStack> getDrops()
public boolean isCancelled()
isCancelled
in interface Cancellable
public void setCancelled(boolean cancel)
setCancelled
in interface Cancellable
cancel
- whether the shearing of the block should be cancelled or not.@NotNull public @NotNull HandlerList getHandlers()
getHandlers
in class Event
@NotNull public static @NotNull HandlerList getHandlerList()
Copyright © 2021. All rights reserved.