Class PlayerShearBlockEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
io.papermc.paper.event.block.PlayerShearBlockEvent
All Implemented Interfaces:
Cancellable

@NullMarked public class PlayerShearBlockEvent extends PlayerEvent implements 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.

  • Constructor Details

  • Method Details

    • getBlock

      public Block getBlock()
      Gets the block being sheared in this event.
      Returns:
      The Block which block is being sheared in this event.
    • getItem

      public ItemStack getItem()
      Gets the item used to shear the block.
      Returns:
      The ItemStack of the shears.
    • getHand

      public EquipmentSlot getHand()
      Gets the hand used to shear the block.
      Returns:
      Either EquipmentSlot.HAND OR EquipmentSlot.OFF_HAND.
    • getDrops

      public List<ItemStack> getDrops()
      Gets the resulting drops of this event.
      Returns:
      A mutable list of items that will be dropped as result of this event.
    • isCancelled

      public boolean isCancelled()
      Gets whether the shearing of the block should be cancelled or not.
      Specified by:
      isCancelled in interface Cancellable
      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 interface Cancellable
      Parameters:
      cancel - whether the shearing of the block should be cancelled or not.
    • getHandlers

      public HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
    • getHandlerList

      public static HandlerList getHandlerList()