Harden APIs which accept Vector3/Position/Location in event namespace

This commit is contained in:
Dylan K. Taylor
2022-03-09 22:22:37 +00:00
parent 879476d8e0
commit f97ce6afef
5 changed files with 35 additions and 0 deletions

View File

@ -27,6 +27,7 @@ use pocketmine\block\Block;
use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait;
use pocketmine\math\Vector3;
use pocketmine\utils\Utils;
class BlockTeleportEvent extends BlockEvent implements Cancellable{
use CancellableTrait;
@ -44,6 +45,7 @@ class BlockTeleportEvent extends BlockEvent implements Cancellable{
}
public function setTo(Vector3 $to) : void{
Utils::checkVector3NotInfOrNaN($to);
$this->to = $to;
}
}