Interface BlockBreakEvent

All Superinterfaces:
Cancellable, Event, PlayerEvent

public interface BlockBreakEvent extends PlayerEvent, Cancellable
Fired when a player breaks a block, before the block is removed from the world.

drops() holds what the block is about to drop and can be modified: what is left in it once the event is over is dropped where the block stood. Cancelling the event keeps the block in place, drops nothing and resyncs the position to the client.

Fired on the thread of the region owning the block.

Since:
0.1.0
  • Method Details

    • world

      World world()
      Returns the world the block belongs to, that is the world of the player.
      Returns:
      the world the block belongs to, that is the world of the player
      Since:
      0.1.0
    • position

      BlockPosition position()
      Returns the position of the block.
      Returns:
      the position of the block
      Since:
      0.1.0
    • block

      BlockData block()
      Returns the state of the block being broken.
      Returns:
      the state of the block being broken
      Since:
      0.1.0
    • tool

      ItemStack tool()
      Returns what the player breaks the block with, ItemStack.EMPTY for a bare hand.
      Returns:
      what the player breaks the block with, ItemStack.EMPTY for a bare hand
      Since:
      0.1.0
    • drops

      List<ItemStack> drops()
      Returns the stacks about to be dropped, which listeners may add to, remove from or replace.

      They are rolled from the loot table of the block with tool(), so the list starts empty in creative mode, with the block_drops game rule off, or when the block needs a tool the player does not hold. What listeners leave in it is dropped whatever the game mode and the game rule.

      A block taking part in farming starts with an empty list: its harvest is worked out once the event is over by FarmingWorld.harvest(BlockPosition, Player, ItemStack), which fires a HarvestEvent. What listeners add here drops along with it.

      Returns:
      the stacks about to be dropped, which listeners may add to, remove from or replace
      Since:
      0.1.0