Default world might be null

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

View File

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