Skip to content

PlayerItemUseEvent ​

class · pocketmine\event\player\PlayerItemUseEvent · source

Extends PlayerEvent
Implements Cancellable

Called when a player uses its held item, for example when throwing a projectile.

Methods ​

__construct() ​

php
public function __construct(\pocketmine\player\Player $player, \pocketmine\item\Item $item, \pocketmine\math\Vector3 $directionVector)

getDirectionVector() ​

php
public function getDirectionVector() : \pocketmine\math\Vector3

Returns the direction the player is aiming when activating this item. Used for projectile direction.

getItem() ​

php
public function getItem() : \pocketmine\item\Item

Returns the item used.

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.