Server: apply server.properties difficulty to newly generated worlds

see #5057

jury is out on whether or not this should override difficulty on preexisting worlds, but it's non-controversial that it should apply at least to newly generated worlds.
This commit is contained in:
Dylan K. Taylor 2022-05-21 18:46:38 +01:00
parent 33e6b63fe5
commit 688be0a404
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -1093,6 +1093,7 @@ class Server{
$creationOptions->setGeneratorClass($generatorClass);
$creationOptions->setGeneratorOptions($generatorOptions);
$creationOptions->setDifficulty($this->getDifficulty());
if(isset($options["difficulty"]) && is_string($options["difficulty"])){
$creationOptions->setDifficulty(World::getDifficultyFromString($options["difficulty"]));
}
@ -1127,6 +1128,7 @@ class Server{
if($convertedSeed !== null){
$creationOptions->setSeed($convertedSeed);
}
$creationOptions->setDifficulty($this->getDifficulty());
$this->worldManager->generateWorld($default, $creationOptions);
}
}