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

Public Member Functions

 __construct (protected Player $player, protected BlockTransaction $transaction, protected Block $blockAgainst, protected Item $item)
 
 call ()
 
 getBlockAgainst ()
 
 getEventName ()
 
 getItem ()
 
 getPlayer ()
 
 getTransaction ()
 
 isCancelled ()
 

Static Public Member Functions

static hasHandlers ()
 

Protected Attributes

string $eventName = null
 

Detailed Description

Called when a player initiates a block placement action. More than one block may be changed by a single placement action, for example when placing a door.

Definition at line 38 of file BlockPlaceEvent.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\event\block\BlockPlaceEvent::__construct ( protected Player  $player,
protected BlockTransaction  $transaction,
protected Block  $blockAgainst,
protected Item  $item 
)

Definition at line 41 of file BlockPlaceEvent.php.

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.

◆ getBlockAgainst()

pocketmine\event\block\BlockPlaceEvent::getBlockAgainst ( )

Definition at line 78 of file BlockPlaceEvent.php.

◆ getEventName()

pocketmine\event\Event::getEventName ( )
finalinherited

Definition at line 40 of file Event.php.

◆ getItem()

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

Gets the item in hand

Definition at line 63 of file BlockPlaceEvent.php.

◆ getPlayer()

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

Returns the player who is placing the block.

Definition at line 56 of file BlockPlaceEvent.php.

◆ getTransaction()

pocketmine\event\block\BlockPlaceEvent::getTransaction ( )

Returns a BlockTransaction object containing all the block positions that will be changed by this event, and the states they will be changed to.

This will usually contain only one block, but may contain more if the block being placed is a multi-block structure such as a door or bed.

Definition at line 74 of file BlockPlaceEvent.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.

Member Data Documentation

◆ $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: