Inject WorldProviderManager to WorldManager's constructor, no longer singleton

This commit is contained in:
Dylan K. Taylor
2020-05-24 19:22:04 +01:00
parent 437e4d75ab
commit c93038f574
4 changed files with 14 additions and 12 deletions

View File

@ -932,7 +932,7 @@ class Server{
$this->pluginManager->registerInterface(new PharPluginLoader($this->autoloader));
$this->pluginManager->registerInterface(new ScriptPluginLoader());
$providerManager = WorldProviderManager::getInstance();
$providerManager = new WorldProviderManager();
if(
($format = $providerManager->getProviderByName($formatName = (string) $this->configGroup->getProperty("level-settings.default-format"))) !== null and
is_a($format, WritableWorldProvider::class, true)
@ -942,7 +942,7 @@ class Server{
$this->logger->warning($this->language->translateString("pocketmine.level.badDefaultFormat", [$formatName]));
}
$this->worldManager = new WorldManager($this, $this->dataPath . "/worlds");
$this->worldManager = new WorldManager($this, $this->dataPath . "/worlds", $providerManager);
$this->worldManager->setAutoSave($this->configGroup->getConfigBool("auto-save", $this->worldManager->getAutoSave()));
$this->worldManager->setAutoSaveInterval((int) $this->configGroup->getProperty("ticks-per.autosave", 6000));