Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.event.block.BlockBreakEvent Class Reference
Inheritance diagram for org.bukkit.event.block.BlockBreakEvent:
org.bukkit.event.block.BlockExpEvent org.bukkit.event.Cancellable org.bukkit.event.block.BlockEvent org.bukkit.event.Event

Public Member Functions

 BlockBreakEvent (final Block theBlock, final Player player)
 
Player getPlayer ()
 
boolean isCancelled ()
 
void setCancelled (boolean cancel)
 
- Public Member Functions inherited from org.bukkit.event.block.BlockExpEvent
 BlockExpEvent (Block block, int exp)
 
int getExpToDrop ()
 
void setExpToDrop (int exp)
 
HandlerList getHandlers ()
 
- Public Member Functions inherited from org.bukkit.event.block.BlockEvent
 BlockEvent (final Block theBlock)
 
final Block getBlock ()
 
- Public Member Functions inherited from org.bukkit.event.Event
 Event ()
 
 Event (boolean isAsync)
 
String getEventName ()
 
abstract HandlerList getHandlers ()
 
final boolean isAsynchronous ()
 

Additional Inherited Members

- Static Public Member Functions inherited from org.bukkit.event.block.BlockExpEvent
static HandlerList getHandlerList ()
 
- Protected Attributes inherited from org.bukkit.event.block.BlockEvent
Block block
 

Detailed Description

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.

Definition at line 29 of file BlockBreakEvent.java.

Member Function Documentation

Player org.bukkit.event.block.BlockBreakEvent.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

Definition at line 44 of file BlockBreakEvent.java.

44  {
45  return player;
46  }
boolean org.bukkit.event.block.BlockBreakEvent.isCancelled ( )

Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins

Returns
true if this event is cancelled

Implements org.bukkit.event.Cancellable.

Definition at line 48 of file BlockBreakEvent.java.

48  {
49  return cancel;
50  }
void org.bukkit.event.block.BlockBreakEvent.setCancelled ( boolean  cancel)

Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.

Parameters
canceltrue if you wish to cancel this event

Implements org.bukkit.event.Cancellable.

Definition at line 52 of file BlockBreakEvent.java.

52  {
53  this.cancel = cancel;
54  }

The documentation for this class was generated from the following file: