mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
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:
@ -25,6 +25,7 @@ namespace pocketmine\world\format\io;
|
||||
|
||||
use pocketmine\utils\Filesystem;
|
||||
use pocketmine\world\generator\GeneratorManager;
|
||||
use pocketmine\world\generator\normal\Normal;
|
||||
use pocketmine\world\WorldCreationOptions;
|
||||
use Webmozart\PathUtil\Path;
|
||||
use function basename;
|
||||
@ -112,7 +113,9 @@ class FormatConverter{
|
||||
Filesystem::recursiveUnlink($convertedOutput);
|
||||
}
|
||||
$this->newProvider->generate($convertedOutput, $data->getName(), WorldCreationOptions::create()
|
||||
->setGeneratorClass(GeneratorManager::getInstance()->getGenerator($data->getGenerator()))
|
||||
//TODO: defaulting to NORMAL here really isn't very good behaviour, but it's consistent with what we already
|
||||
//did previously; besides, WorldManager checks for unknown generators before this is reached anyway.
|
||||
->setGeneratorClass(GeneratorManager::getInstance()->getGenerator($data->getGenerator()) ?? Normal::class)
|
||||
->setGeneratorOptions($data->getGeneratorOptions())
|
||||
->setSeed($data->getSeed())
|
||||
->setSpawnPosition($data->getSpawn())
|
||||
|
Reference in New Issue
Block a user