PocketMine-MP 5.15.1 git-5ef247620a7c6301a849b54e5ef1009217729fc8
pocketmine\event\block\BlockBreakEvent Class Reference
+ Inheritance diagram for pocketmine\event\block\BlockBreakEvent:
+ Collaboration diagram for pocketmine\event\block\BlockBreakEvent:

Public Member Functions

 __construct (protected Player $player, Block $block, protected Item $item, protected bool $instaBreak=false, array $drops=[], protected int $xpDrops=0)
 
 call ()
 
 getBlock ()
 
 getDrops ()
 
 getEventName ()
 
 getInstaBreak ()
 
 getItem ()
 
 getPlayer ()
 
 getXpDropAmount ()
 
 isCancelled ()
 
 setDrops (array $drops)
 
 setDropsVariadic (Item ... $drops)
 
 setInstaBreak (bool $instaBreak)
 
 setXpDropAmount (int $amount)
 

Static Public Member Functions

static hasHandlers ()
 

Protected Attributes

array $blockDrops = []
 
string $eventName = null
 

Detailed Description

Called when a player destroys a block somewhere in the world.

Definition at line 35 of file BlockBreakEvent.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\event\block\BlockBreakEvent::__construct ( protected Player  $player,
Block  $block,
protected Item  $item,
protected bool  $instaBreak = false,
array  $drops = [],
protected int  $xpDrops = 0 
)
Parameters
Item[]$drops

Definition at line 44 of file BlockBreakEvent.php.

References pocketmine\event\block\BlockBreakEvent\setDrops().

+ Here is the call graph for this function:

Member Function Documentation

◆ call()

pocketmine\event\Event::call ( )
inherited

Calls event handlers registered for this event.

Exceptions

RuntimeException if event call recursion reaches the max depth limit

Definition at line 49 of file Event.php.

◆ getBlock()

pocketmine\event\block\BlockEvent::getBlock ( )
inherited

Definition at line 37 of file BlockEvent.php.

◆ getDrops()

pocketmine\event\block\BlockBreakEvent::getDrops ( )
Returns
Item[]

Definition at line 85 of file BlockBreakEvent.php.

◆ getEventName()

pocketmine\event\Event::getEventName ( )
finalinherited

Definition at line 40 of file Event.php.

◆ getInstaBreak()

pocketmine\event\block\BlockBreakEvent::getInstaBreak ( )

Returns whether the block may be broken in less than the amount of time calculated. This is usually true for creative players.

Definition at line 74 of file BlockBreakEvent.php.

◆ getItem()

pocketmine\event\block\BlockBreakEvent::getItem ( )

Returns the item used to destroy the block.

Definition at line 66 of file BlockBreakEvent.php.

◆ getPlayer()

pocketmine\event\block\BlockBreakEvent::getPlayer ( )

Returns the player who is destroying the block.

Definition at line 59 of file BlockBreakEvent.php.

◆ getXpDropAmount()

pocketmine\event\block\BlockBreakEvent::getXpDropAmount ( )

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

Definition at line 106 of file BlockBreakEvent.php.

◆ hasHandlers()

static pocketmine\event\Event::hasHandlers ( )
staticinherited

Returns whether the current class context has any registered global handlers. This can be used in hot code paths to avoid unnecessary event object creation.

Usage: SomeEventClass::hasHandlers()

Definition at line 77 of file Event.php.

◆ isCancelled()

pocketmine\event\Cancellable::isCancelled ( )
inherited

Returns whether this instance of the event is currently cancelled.

If it is cancelled, only downstream handlers that declare @handleCancelled will be called with this event.

◆ setDrops()

pocketmine\event\block\BlockBreakEvent::setDrops ( array  $drops)
Parameters
Item[]$drops

Definition at line 92 of file BlockBreakEvent.php.

Referenced by pocketmine\event\block\BlockBreakEvent\__construct().

+ Here is the caller graph for this function:

◆ setDropsVariadic()

pocketmine\event\block\BlockBreakEvent::setDropsVariadic ( Item ...  $drops)

Variadic hack for easy array member type enforcement.

Definition at line 99 of file BlockBreakEvent.php.

◆ setInstaBreak()

pocketmine\event\block\BlockBreakEvent::setInstaBreak ( bool  $instaBreak)

Definition at line 78 of file BlockBreakEvent.php.

◆ setXpDropAmount()

pocketmine\event\block\BlockBreakEvent::setXpDropAmount ( int  $amount)

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

Definition at line 113 of file BlockBreakEvent.php.

Member Data Documentation

◆ $blockDrops

array pocketmine\event\block\BlockBreakEvent::$blockDrops = []
protected

Definition at line 39 of file BlockBreakEvent.php.

◆ $eventName

string pocketmine\event\Event::$eventName = null
protectedinherited

Definition at line 38 of file Event.php.


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