GeneratorManager::getGenerator() now returns null for unknown generator aliases

instead of returning Normal::class (indistinguishable from successful match) or throwing an exception (pain in the ass to handle).
This commit is contained in:
Dylan K. Taylor
2021-10-11 16:04:36 +01:00
parent e62794e4cf
commit 7b6632941d
5 changed files with 15 additions and 20 deletions

View File

@ -411,7 +411,8 @@ class World implements ChunkManager{
$this->maxY = $this->provider->getWorldMaxY();
$this->server->getLogger()->info($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_level_preparing($this->displayName)));
$this->generator = GeneratorManager::getInstance()->getGenerator($this->provider->getWorldData()->getGenerator(), true);
$this->generator = GeneratorManager::getInstance()->getGenerator($this->provider->getWorldData()->getGenerator()) ??
throw new AssumptionFailedError("WorldManager should already have checked that the generator exists");
//TODO: validate generator options
$this->chunkPopulationRequestQueue = new \SplQueue();
$this->addOnUnloadCallback(function() : void{