PlayerRespawnEvent: harden setRespawnPosition()

apparently plugins like to pass around positions which have null worlds, which aside from being quite stupid, also breaks a lot of stuff and makes it look like PM is to blame when it's just trying to make everything work the way it's supposed to ...
This commit is contained in:
Dylan K. Taylor 2020-07-10 20:37:45 +01:00
parent cd022f1592
commit 2b1a0e1e72

View File

@ -43,6 +43,9 @@ class PlayerRespawnEvent extends PlayerEvent{
}
public function setRespawnPosition(Position $position) : void{
if(!$position->isValid()){
throw new \InvalidArgumentException("Spawn position must reference a valid and loaded World");
}
$this->position = $position;
}
}