BlockBreakEvent
extends BlockEvent
in package
implements
Cancellable
Uses
CancellableTrait
Called when a player destroys a block somewhere in the world.
Interfaces, Classes, Traits and Enums
- Cancellable
- This interface is implemented by an Event subclass if and only if it can be cancelled.
Table of Contents
- MAX_EVENT_CALL_DEPTH = 50
- $block : Block
- $blockDrops : array<string|int, Item>
- $eventName : string|null
- $instaBreak : bool
- $item : Item
- $player : Player
- $xpDrops : int
- $eventCallDepth : int
- $isCancelled : bool
- __construct() : mixed
- call() : void
- Calls event handlers registered for this event.
- cancel() : void
- getBlock() : Block
- getDrops() : array<string|int, Item>
- getEventName() : string
- getInstaBreak() : bool
- Returns whether the block may be broken in less than the amount of time calculated. This is usually true for creative players.
- getItem() : Item
- Returns the item used to destroy the block.
- getPlayer() : Player
- Returns the player who is destroying the block.
- getXpDropAmount() : int
- Returns how much XP will be dropped by breaking this block.
- isCancelled() : bool
- setDrops() : void
- setDropsVariadic() : void
- Variadic hack for easy array member type enforcement.
- setInstaBreak() : void
- setXpDropAmount() : void
- Sets how much XP will be dropped by breaking this block.
- uncancel() : void
Constants
MAX_EVENT_CALL_DEPTH
private
mixed
MAX_EVENT_CALL_DEPTH
= 50
Properties
$block
protected
Block
$block
$blockDrops
protected
array<string|int, Item>
$blockDrops
= []
$eventName
protected
string|null
$eventName
= null
$instaBreak
protected
bool
$instaBreak
= false
$item
protected
Item
$item
$player
protected
Player
$player
$xpDrops
protected
int
$xpDrops
$eventCallDepth
private
static int
$eventCallDepth
= 1
$isCancelled
private
bool
$isCancelled
= false
Methods
__construct()
public
__construct(Player $player, Block $block, Item $item[, bool $instaBreak = false ][, array<string|int, Item> $drops = [] ][, int $xpDrops = 0 ]) : mixed
Parameters
- $player : Player
- $block : Block
- $item : Item
- $instaBreak : bool = false
- $drops : array<string|int, Item> = []
- $xpDrops : int = 0
Return values
mixed —call()
Calls event handlers registered for this event.
public
call() : void
Tags
Return values
void —cancel()
public
cancel() : void
Return values
void —getBlock()
public
getBlock() : Block
Return values
Block —getDrops()
public
getDrops() : array<string|int, Item>
Return values
array<string|int, Item> —getEventName()
public
final getEventName() : string
Return values
string —getInstaBreak()
Returns whether the block may be broken in less than the amount of time calculated. This is usually true for creative players.
public
getInstaBreak() : bool
Return values
bool —getItem()
Returns the item used to destroy the block.
public
getItem() : Item
Return values
Item —getPlayer()
Returns the player who is destroying the block.
public
getPlayer() : Player
Return values
Player —getXpDropAmount()
Returns how much XP will be dropped by breaking this block.
public
getXpDropAmount() : int
Return values
int —isCancelled()
public
isCancelled() : bool
Return values
bool —setDrops()
public
setDrops(array<string|int, Item> $drops) : void
Parameters
- $drops : array<string|int, Item>
Return values
void —setDropsVariadic()
Variadic hack for easy array member type enforcement.
public
setDropsVariadic(Item ...$drops) : void
Parameters
- $drops : Item
Return values
void —setInstaBreak()
public
setInstaBreak(bool $instaBreak) : void
Parameters
- $instaBreak : bool
Return values
void —setXpDropAmount()
Sets how much XP will be dropped by breaking this block.
public
setXpDropAmount(int $amount) : void
Parameters
- $amount : int
Return values
void —uncancel()
public
uncancel() : void