Package org.bukkit.event.block

# Class BlockBreakEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.block.BlockEvent
org.bukkit.event.block.BlockExpEvent
org.bukkit.event.block.BlockBreakEvent

All Implemented Interfaces:
  `Cancellable`

public class BlockBreakEvent extends BlockExpEvent implements Cancellable
Called when a block is broken by a player.

If you wish to have the block drop experience, you must set the experience value above 0. By default, experience will be set in the event if:

1. The player is not in creative or adventure mode
2. The player can loot the block (ie: does not destroy it completely, by using the correct tool)
3. The player does not have silk touch
4. The block drops experience in vanilla Minecraft

Note: Plugins wanting to simulate a traditional block drop should set the block to air and utilize their own methods for determining what the default drop for the block being broken is and what to do about it, if anything.

If a Block Break event is cancelled, the block will not break and experience will not drop.

## 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
`BlockBreakEvent(@NotNull Block theBlock, @NotNull Player player)`

## Method Summary

Modifier and Type
Method
Description
`@NotNull Player`
`getPlayer()`
Gets the Player that is breaking the block involved in this event.
`boolean`
`isCancelled()`
Gets the cancellation state of this event.
`boolean`
`isDropItems()`
Gets whether or not the block will attempt to drop items.
`void`
`setCancelled(boolean cancel)`
Sets the cancellation state of this event.
`void`
`setDropItems(boolean dropItems)`
Sets whether or not the block will attempt to drop items as it normally would.

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

`getExpToDrop, getHandlerList, getHandlers, setExpToDrop`

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

### BlockBreakEvent

public BlockBreakEvent(@NotNull @NotNull Block theBlock, @NotNull @NotNull Player player)

## Method Details

### getPlayer

@NotNull public @NotNull Player getPlayer()
Gets the Player that is breaking the block involved in this event.

Returns:
  The Player that is breaking the block involved in this event

### setDropItems

public void setDropItems(boolean dropItems)
Sets whether or not the block will attempt to drop items as it normally would. If and only if this is false then `BlockDropItemEvent` will not be called after this event.

Parameters:
  `dropItems` - Whether or not the block will attempt to drop items

### isDropItems

public boolean isDropItems()
Gets whether or not the block will attempt to drop items. If and only if this is false then `BlockDropItemEvent` will not be called after this event.

Returns:
  Whether or not the block will attempt to drop items

### 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:
  true if this event is cancelled

### setCancelled

public void setCancelled(boolean cancel)
Description copied from interface: `Cancellable`
Sets 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:
  `setCancelled` in interface `Cancellable`
Parameters:
  `cancel` - true if you wish to cancel this event