mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 10:53:05 +00:00
only private fields are modified; protected ones can't be changed in case someone extended the classes
40 lines
903 B
PHP
40 lines
903 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace pocketmine\event\block;
|
|
|
|
use pocketmine\block\Block;
|
|
use pocketmine\event\Cancellable;
|
|
use pocketmine\event\CancellableTrait;
|
|
use pocketmine\player\Player;
|
|
use pocketmine\world\BlockTransaction;
|
|
|
|
/**
|
|
* Called when structures such as Saplings or Bamboo grow.
|
|
* These types of plants tend to change multiple blocks at once upon growing.
|
|
*/
|
|
class StructureGrowEvent extends BlockEvent implements Cancellable{
|
|
use CancellableTrait;
|
|
|
|
public function __construct(
|
|
Block $block,
|
|
private BlockTransaction $transaction,
|
|
private ?Player $player
|
|
){
|
|
parent::__construct($block);
|
|
}
|
|
|
|
public function getTransaction() : BlockTransaction{
|
|
return $this->transaction;
|
|
}
|
|
|
|
/**
|
|
* It returns the player which grows the structure.
|
|
* It returns null when the structure grows by itself.
|
|
*/
|
|
public function getPlayer() : ?Player{
|
|
return $this->player;
|
|
}
|
|
}
|