Skip to content

BlockPlaceEvent ​

class · pocketmine\event\block\BlockPlaceEvent · source

Extends Event
Implements Cancellable

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.

Properties ​

$blockAgainst ​

php
public \pocketmine\block\Block $blockAgainst

$item ​

php
public \pocketmine\item\Item $item

$player ​

php
public \pocketmine\player\Player $player

$transaction ​

php
public \pocketmine\world\BlockTransaction $transaction

Methods ​

__construct() ​

php
public function __construct(\pocketmine\player\Player $player, \pocketmine\world\BlockTransaction $transaction, \pocketmine\block\Block $blockAgainst, \pocketmine\item\Item $item)

getBlockAgainst() ​

php
public function getBlockAgainst() : \pocketmine\block\Block

getItem() ​

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

Gets the item in hand

getPlayer() ​

php
public function getPlayer() : \pocketmine\player\Player

Returns the player who is placing the block.

getTransaction() ​

php
public function getTransaction() : \pocketmine\world\BlockTransaction

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.

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