EntityExplodeEvent: clamp yield in range 0-100

This commit is contained in:
Dylan K. Taylor 2022-05-21 22:44:45 +01:00
parent 7eaf1246a0
commit afc6e8878d
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -53,6 +53,9 @@ class EntityExplodeEvent extends EntityEvent implements Cancellable{
$this->entity = $entity;
$this->position = $position;
$this->blocks = $blocks;
if($yield < 0.0 || $yield > 100.0){
throw new \InvalidArgumentException("Yield must be in range 0.0 - 100.0");
}
$this->yield = $yield;
}
@ -80,6 +83,9 @@ class EntityExplodeEvent extends EntityEvent implements Cancellable{
}
public function setYield(float $yield) : void{
if($yield < 0.0 || $yield > 100.0){
throw new \InvalidArgumentException("Yield must be in range 0.0 - 100.0");
}
$this->yield = $yield;
}
}