Implemented Respawn Anchor (#6646)

PlayerRespawnAnchorUseEvent is also added with options SET_SPAWN and EXPLODE, which allows plugins to customise the outcome of using the anchor in PM, which currently doesn't support dimensions. The event is also cancellable.
This commit is contained in:
Adam
2025-05-28 02:57:28 +06:00
committed by GitHub
parent 059f4ee7bf
commit bf33a625c9
19 changed files with 711 additions and 14 deletions

View File

@ -43,13 +43,15 @@ class EntityExplodeEvent extends EntityEvent implements Cancellable{
/**
* @param Block[] $blocks
* @param float $yield 0-100
* @param float $yield 0-100
* @param Block[] $ignitions
*/
public function __construct(
Entity $entity,
protected Position $position,
protected array $blocks,
protected float $yield
protected float $yield,
private array $ignitions
){
$this->entity = $entity;
if($yield < 0.0 || $yield > 100.0){
@ -98,4 +100,23 @@ class EntityExplodeEvent extends EntityEvent implements Cancellable{
}
$this->yield = $yield;
}
/**
* Set the list of blocks that will be replaced by fire.
*
* @param Block[] $ignitions
*/
public function setIgnitions(array $ignitions) : void{
Utils::validateArrayValueType($ignitions, fn(Block $block) => null);
$this->ignitions = $ignitions;
}
/**
* Returns a list of affected blocks that will be replaced by fire.
*
* @return Block[]
*/
public function getIgnitions() : array{
return $this->ignitions;
}
}