mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
ExplosionPrimeEvent: require a positive explosion radius
This commit is contained in:
parent
3dd7c09351
commit
2ec65ba799
@ -44,6 +44,9 @@ class ExplosionPrimeEvent extends EntityEvent implements Cancellable{
|
|||||||
private $blockBreaking;
|
private $blockBreaking;
|
||||||
|
|
||||||
public function __construct(Entity $entity, float $force){
|
public function __construct(Entity $entity, float $force){
|
||||||
|
if($force <= 0){
|
||||||
|
throw new \InvalidArgumentException("Explosion radius must be positive");
|
||||||
|
}
|
||||||
$this->entity = $entity;
|
$this->entity = $entity;
|
||||||
$this->force = $force;
|
$this->force = $force;
|
||||||
$this->blockBreaking = true;
|
$this->blockBreaking = true;
|
||||||
@ -54,6 +57,9 @@ class ExplosionPrimeEvent extends EntityEvent implements Cancellable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function setForce(float $force) : void{
|
public function setForce(float $force) : void{
|
||||||
|
if($force <= 0){
|
||||||
|
throw new \InvalidArgumentException("Explosion radius must be positive");
|
||||||
|
}
|
||||||
$this->force = $force;
|
$this->force = $force;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user