mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 19:02:59 +00:00
BlockGrowEvent: add player information for bonemeal usage (#5596)
this is in line with StructureGrowEvent, which also has a similar API.
This commit is contained in:
@ -23,9 +23,27 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\event\block;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\player\Player;
|
||||
|
||||
/**
|
||||
* Called when plants or crops grow.
|
||||
*/
|
||||
class BlockGrowEvent extends BaseBlockChangeEvent{
|
||||
|
||||
public function __construct(
|
||||
Block $block,
|
||||
Block $newState,
|
||||
private ?Player $player = null,
|
||||
){
|
||||
parent::__construct($block, $newState);
|
||||
}
|
||||
|
||||
/**
|
||||
* It returns the player which grows the crop.
|
||||
* It returns null when the crop grows by itself.
|
||||
*/
|
||||
public function getPlayer() : ?Player{
|
||||
return $this->player;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user