Package com.destroystokyo.paper.event.block

# Class BlockDestroyEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.block.BlockEvent
com.destroystokyo.paper.event.block.BlockDestroyEvent

All Implemented Interfaces:
  `Cancellable`

public class BlockDestroyEvent extends BlockEvent implements Cancellable
Fired anytime the server intends to 'destroy' a block through some triggering reason. This does not fire anytime a block is set to air, but only with more direct triggers such as physics updates, pistons, Entities changing blocks, commands set to "Destroy". This event is associated with the game playing a sound effect at the block in question, when something can be described as "intend to destroy what is there", Events such as leaves decaying, pistons retracting (where the block is moving), does NOT fire this event.

## Nested Class Summary

## Nested classes/interfaces inherited from class org.bukkit.event.Event

`Event.Result`

## Field Summary

### Fields inherited from class org.bukkit.event.block.BlockEvent

`block`

## Constructor Summary

Constructors
Constructor
Description
`BlockDestroyEvent(@NotNull Block block, @NotNull BlockData newState, boolean willDrop)`

## Method Summary

Modifier and Type
Method
Description
`static @NotNull HandlerList`
`getHandlerList()`
`@NotNull HandlerList`
`getHandlers()`
`@NotNull BlockData`
`getNewState()`
`boolean`
`isCancelled()`
Gets the cancellation state of this event.
`boolean`
`playEffect()`
`void`
`setCancelled(boolean cancel)`
If the event is cancelled, the block will remain in its previous state.
`void`
`setPlayEffect(boolean playEffect)`
`boolean`
`willDrop()`

### Methods inherited from class org.bukkit.event.block.BlockEvent

`getBlock`

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

### BlockDestroyEvent

public BlockDestroyEvent(@NotNull @NotNull Block block, @NotNull @NotNull BlockData newState, boolean willDrop)

## Method Details

### getNewState

@NotNull public @NotNull BlockData getNewState()

Returns:
  The new state of this block (Air, or a Fluid type)

### willDrop

public boolean willDrop()

Returns:
  If the server is going to drop the block in question with this destroy event

### playEffect

public boolean playEffect()

Returns:
  If the server is going to play the sound effect for this destruction

### setPlayEffect

public void setPlayEffect(boolean playEffect)

Parameters:
  `playEffect` - If the server should play the sound effect for this destruction

### isCancelled

public boolean isCancelled()
Description copied from interface: `Cancellable`
Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins

Specified by:
  `isCancelled` in interface `Cancellable`
Returns:
  If the event is cancelled, meaning the block will not be destroyed

### setCancelled

public void setCancelled(boolean cancel)
If the event is cancelled, the block will remain in its previous state.

Specified by:
  `setCancelled` in interface `Cancellable`
Parameters:
  `cancel` - true if you wish to cancel this event

### getHandlers

@NotNull public @NotNull HandlerList getHandlers()

Specified by:
  `getHandlers` in class `Event`

### getHandlerList

@NotNull public static @NotNull HandlerList getHandlerList()