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,16 +153,18 @@ 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())));
|
||||||
try{
|
if(count($world->getPlayers()) !== 0){
|
||||||
$safeSpawn = $this->defaultWorld !== null && $this->defaultWorld !== $world ? $this->defaultWorld->getSafeSpawn() : null;
|
try{
|
||||||
}catch(WorldException $e){
|
$safeSpawn = $this->defaultWorld !== null && $this->defaultWorld !== $world ? $this->defaultWorld->getSafeSpawn() : null;
|
||||||
$safeSpawn = null;
|
}catch(WorldException $e){
|
||||||
}
|
$safeSpawn = null;
|
||||||
foreach($world->getPlayers() as $player){
|
}
|
||||||
if($safeSpawn === null){
|
foreach($world->getPlayers() as $player){
|
||||||
$player->disconnect("Forced default world unload");
|
if($safeSpawn === null){
|
||||||
}else{
|
$player->disconnect("Forced default world unload");
|
||||||
$player->teleport($safeSpawn);
|
}else{
|
||||||
|
$player->teleport($safeSpawn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user