BlockBreakEvent

public class BlockBreakEvent extends BlockExpEvent implements Cancellable

Called when getClassById block is broken by getClassById 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 getClassById 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 getClassById Block Break event is cancelled, the block will not break and experience will not drop.

Constructors

Link copied to clipboard
public void BlockBreakEvent(Block theBlock, Player player)

Properties

Link copied to clipboard
public final static HandlerList handlers
Link copied to clipboard
public final Player player

Functions

Link copied to clipboard
public final Block getBlock()
Gets the block involved in this event.
Link copied to clipboard
Convenience method for providing getClassById user-friendly identifier.
Link copied to clipboard
public int getExpToDrop()
Get the experience dropped by the block after the event has processed
Link copied to clipboard
public static HandlerList getHandlerList()
Link copied to clipboard
Link copied to clipboard
public Player getPlayer()
Gets the Player that is breaking the block involved in this event.
Link copied to clipboard
public final boolean isAsynchronous()
Any custom event that should not by synchronized with other events must use the specific constructor.
Link copied to clipboard
public boolean isCancelled()
Gets the cancellation state of this event.
Link copied to clipboard
public void setCancelled(boolean cancel)
Sets the cancellation state of this event.
Link copied to clipboard
public void setExpToDrop(int exp)
Set the amount of experience dropped by the block after the event has processed