mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-06 01:51:51 +00:00
WorldManager: do not calculate safe spawn if there are no players in the unloaded world
This commit is contained in:
parent
712ffb3e31
commit
1dc0d5f96a
@ -153,6 +153,7 @@ class WorldManager{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->server->getLogger()->info($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_level_unloading($world->getDisplayName())));
|
$this->server->getLogger()->info($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_level_unloading($world->getDisplayName())));
|
||||||
|
if(count($world->getPlayers()) !== 0){
|
||||||
try{
|
try{
|
||||||
$safeSpawn = $this->defaultWorld !== null && $this->defaultWorld !== $world ? $this->defaultWorld->getSafeSpawn() : null;
|
$safeSpawn = $this->defaultWorld !== null && $this->defaultWorld !== $world ? $this->defaultWorld->getSafeSpawn() : null;
|
||||||
}catch(WorldException $e){
|
}catch(WorldException $e){
|
||||||
@ -165,6 +166,7 @@ class WorldManager{
|
|||||||
$player->teleport($safeSpawn);
|
$player->teleport($safeSpawn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($world === $this->defaultWorld){
|
if($world === $this->defaultWorld){
|
||||||
$this->defaultWorld = null;
|
$this->defaultWorld = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user