Files
PocketMine-MP/src/event/block/StructureGrowEvent.php
Dylan K. Taylor c8a7a53d70 event: modernize property declarations where possible
only private fields are modified; protected ones can't be changed in case someone extended the classes
2022-04-25 00:06:26 +01:00

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;
}
}