Documentation

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

$eventName

protected string|null $eventName = null

$eventCallDepth

private static int $eventCallDepth = 1

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
throws
RuntimeException

if event call recursion reaches the max depth limit

Return values
void

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

getXpDropAmount()

Returns how much XP will be dropped by breaking this block.

public getXpDropAmount() : int
Return values
int

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

Search results