PocketMine-MP 5.17.1 git-df4ada81e5d74a14046f27cf44a37dcee69d657e
pocketmine\event\player\PlayerInteractEvent Class Reference
+ Inheritance diagram for pocketmine\event\player\PlayerInteractEvent:
+ Collaboration diagram for pocketmine\event\player\PlayerInteractEvent:

Public Member Functions

 __construct (Player $player, protected Item $item, protected Block $blockTouched, ?Vector3 $touchVector, protected int $blockFace, protected int $action=PlayerInteractEvent::RIGHT_CLICK_BLOCK)
 call ()
 getAction ()
 getBlock ()
 getEventName ()
 getFace ()
 getItem ()
 getPlayer ()
 getTouchVector ()
 isCancelled ()

Static Public Member Functions

static hasHandlers ()

Public Attributes


Protected Attributes

string $eventName = null
Player $player
Vector3 $touchVector

Detailed Description

Called when a player interacts or touches a block. This is called for both left click (start break) and right click (use).

Definition at line 37 of file PlayerInteractEvent.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\event\player\PlayerInteractEvent::__construct ( Player  $player,
protected Item  $item,
protected Block  $blockTouched,
?Vector3  $touchVector,
protected int  $blockFace,
protected int  $action = PlayerInteractEvent::RIGHT_CLICK_BLOCK 

Definition at line 45 of file PlayerInteractEvent.php.

Member Function Documentation

◆ call()

pocketmine\event\Event::call ( )

Calls event handlers registered for this event.


RuntimeException if event call recursion reaches the max depth limit

Definition at line 49 of file Event.php.

◆ getAction()

pocketmine\event\player\PlayerInteractEvent::getAction ( )

Definition at line 57 of file PlayerInteractEvent.php.

◆ getBlock()

pocketmine\event\player\PlayerInteractEvent::getBlock ( )

Definition at line 65 of file PlayerInteractEvent.php.

◆ getEventName()

pocketmine\event\Event::getEventName ( )

Definition at line 40 of file Event.php.

◆ getFace()

pocketmine\event\player\PlayerInteractEvent::getFace ( )

Definition at line 73 of file PlayerInteractEvent.php.

◆ getItem()

pocketmine\event\player\PlayerInteractEvent::getItem ( )

Definition at line 61 of file PlayerInteractEvent.php.

◆ getPlayer()

pocketmine\event\player\PlayerEvent::getPlayer ( )

Definition at line 35 of file PlayerEvent.php.

◆ getTouchVector()

pocketmine\event\player\PlayerInteractEvent::getTouchVector ( )

Definition at line 69 of file PlayerInteractEvent.php.

◆ hasHandlers()

static pocketmine\event\Event::hasHandlers ( )

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 ( )

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

Definition at line 38 of file Event.php.

◆ $player

Player pocketmine\event\player\PlayerEvent::$player

Definition at line 33 of file PlayerEvent.php.

◆ $touchVector

Vector3 pocketmine\event\player\PlayerInteractEvent::$touchVector

Definition at line 43 of file PlayerInteractEvent.php.


const pocketmine\event\player\PlayerInteractEvent::LEFT_CLICK_BLOCK = 0

Definition at line 40 of file PlayerInteractEvent.php.


const pocketmine\event\player\PlayerInteractEvent::RIGHT_CLICK_BLOCK = 1

Definition at line 41 of file PlayerInteractEvent.php.

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