Package io.papermc.paper.event.block
Class PlayerShearBlockEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
io.papermc.paper.event.block.PlayerShearBlockEvent
- All Implemented Interfaces:
Cancellable
Called when a player uses sheers on a block.
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
Field Summary
Fields inherited from class org.bukkit.event.player.PlayerEvent
player
-
Constructor Summary
ConstructorDescriptionPlayerShearBlockEvent
(Player player, Block block, ItemStack item, EquipmentSlot hand, List<ItemStack> drops) -
Method Summary
Modifier and TypeMethodDescriptiongetBlock()
Gets the block being sheared in this event.getDrops()
Gets the resulting drops of this event.getHand()
Gets the hand used to shear the block.static HandlerList
getItem()
Gets the item used to shear the block.boolean
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.Methods inherited from class org.bukkit.event.player.PlayerEvent
getPlayer
Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
PlayerShearBlockEvent
-
-
Method Details
-
getBlock
Gets the block being sheared in this event.- Returns:
- The
Block
which block is being sheared in this event.
-
getItem
Gets the item used to shear the block.- Returns:
- The
ItemStack
of the shears.
-
getHand
Gets the hand used to shear the block.- Returns:
- Either
EquipmentSlot.HAND
OREquipmentSlot.OFF_HAND
.
-
getDrops
Gets the resulting drops of this event. -
isCancelled
public boolean isCancelled()Gets whether the shearing of the block should be cancelled or not.- Specified by:
isCancelled
in interfaceCancellable
- Returns:
- Whether the shearing of the block should be cancelled or not.
-
setCancelled
public void setCancelled(boolean cancel) Sets whether the shearing of the block should be cancelled or not.- Specified by:
setCancelled
in interfaceCancellable
- Parameters:
cancel
- whether the shearing of the block should be cancelled or not.
-
getHandlers
- Specified by:
getHandlers
in classEvent
-
getHandlerList
-