diff --git a/src/world/WorldManager.php b/src/world/WorldManager.php index aa906e4ab4..bbf4e6c061 100644 --- a/src/world/WorldManager.php +++ b/src/world/WorldManager.php @@ -154,12 +154,12 @@ class WorldManager{ $this->server->getLogger()->info($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_level_unloading($world->getDisplayName()))); try{ - $safeSpawn = $this->defaultWorld !== null ? $this->defaultWorld->getSafeSpawn() : null; + $safeSpawn = $this->defaultWorld !== null && $this->defaultWorld !== $world ? $this->defaultWorld->getSafeSpawn() : null; }catch(WorldException $e){ $safeSpawn = null; } foreach($world->getPlayers() as $player){ - if($world === $this->defaultWorld or $safeSpawn === null){ + if($safeSpawn === null){ $player->disconnect("Forced default world unload"); }else{ $player->teleport($safeSpawn);