getSafeSpawn() may throw if the target terrain is not generated

This commit is contained in:
Dylan K. Taylor 2021-05-08 16:22:13 +01:00
parent e9f3cefe94
commit 2ce6a87d05
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -150,7 +150,11 @@ class WorldManager{
}
$this->server->getLogger()->info($this->server->getLanguage()->translateString("pocketmine.level.unloading", [$world->getDisplayName()]));
$safeSpawn = $this->defaultWorld !== null ? $this->defaultWorld->getSafeSpawn() : null;
try{
$safeSpawn = $this->defaultWorld !== null ? $this->defaultWorld->getSafeSpawn() : null;
}catch(WorldException $e){
$safeSpawn = null;
}
foreach($world->getPlayers() as $player){
if($world === $this->defaultWorld or $safeSpawn === null){
$player->disconnect("Forced default world unload");