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`

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.

## 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

Constructors
Constructor
Description
`PlayerShearBlockEvent(@NotNull Player who, @NotNull Block block, @NotNull ItemStack item, @NotNull EquipmentSlot hand, @NotNull List<ItemStack> drops)`

## Method Summary

Modifier and Type
Method
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.

### Methods inherited from class org.bukkit.event.player.PlayerEvent

`getPlayer`

### Methods inherited from class org.bukkit.event.Event

`callEvent, getEventName, isAsynchronous`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### PlayerShearBlockEvent

public PlayerShearBlockEvent(@NotNull @NotNull Player who, @NotNull @NotNull Block block, @NotNull @NotNull ItemStack item, @NotNull @NotNull EquipmentSlot hand, @NotNull @NotNull List<ItemStack> drops)

## Method Details

### getBlock

@NotNull public @NotNull Block getBlock()
Gets the block being sheared in this event.

Returns:
  The `Block` which block is being sheared in this event.

### getItem

@NotNull public @NotNull ItemStack getItem()
Gets the item used to shear the block.

Returns:
  The `ItemStack` of the shears.

### getHand

@NotNull public @NotNull EquipmentSlot getHand()
Gets the hand used to shear the block.

Returns:
  Either `EquipmentSlot.HAND` OR `EquipmentSlot.OFF_HAND`.

### getDrops

@NotNull public @NotNull List<ItemStack> getDrops()
Gets the resulting drops of this event.

Returns:
  A `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

@NotNull public @NotNull HandlerList getHandlers()

Specified by:
  `getHandlers` in class `Event`

### getHandlerList

@NotNull public static @NotNull HandlerList getHandlerList()