Merge branch 'stable' of github.com:pmmp/PocketMine-MP into stable

This commit is contained in:
Dylan K. Taylor 2022-06-04 17:35:18 +01:00
commit 237c2866e0
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
2 changed files with 23 additions and 18 deletions

View File

@ -861,7 +861,7 @@ class Server{
$this->logger->emergency($this->language->translate(KnownTranslationFactory::pocketmine_server_devBuild_error3()));
$this->logger->emergency($this->language->translate(KnownTranslationFactory::pocketmine_server_devBuild_error4("settings.enable-dev-builds")));
$this->logger->emergency($this->language->translate(KnownTranslationFactory::pocketmine_server_devBuild_error5("https://github.com/pmmp/PocketMine-MP/releases")));
$this->forceShutdown();
$this->forceShutdownExit();
return;
}
@ -976,7 +976,7 @@ class Server{
$pluginGraylist = PluginGraylist::fromArray(yaml_parse(file_get_contents($graylistFile)));
}catch(\InvalidArgumentException $e){
$this->logger->emergency("Failed to load $graylistFile: " . $e->getMessage());
$this->forceShutdown();
$this->forceShutdownExit();
return;
}
$this->pluginManager = new PluginManager($this, $this->configGroup->getPropertyBool("plugins.legacy-data-dir", true) ? null : Path::join($this->getDataPath(), "plugin_data"), $pluginGraylist);
@ -1007,28 +1007,28 @@ class Server{
$this->pluginManager->loadPlugins($this->pluginPath, $loadErrorCount);
if($loadErrorCount > 0){
$this->logger->emergency($this->language->translate(KnownTranslationFactory::pocketmine_plugin_someLoadErrors()));
$this->forceShutdown();
$this->forceShutdownExit();
return;
}
if(!$this->enablePlugins(PluginEnableOrder::STARTUP())){
$this->logger->emergency($this->language->translate(KnownTranslationFactory::pocketmine_plugin_someEnableErrors()));
$this->forceShutdown();
$this->forceShutdownExit();
return;
}
if(!$this->startupPrepareWorlds()){
$this->forceShutdown();
$this->forceShutdownExit();
return;
}
if(!$this->enablePlugins(PluginEnableOrder::POSTWORLD())){
$this->logger->emergency($this->language->translate(KnownTranslationFactory::pocketmine_plugin_someEnableErrors()));
$this->forceShutdown();
$this->forceShutdownExit();
return;
}
if(!$this->startupPrepareNetworkInterfaces()){
$this->forceShutdown();
$this->forceShutdownExit();
return;
}
@ -1456,6 +1456,11 @@ class Server{
}
}
private function forceShutdownExit() : void{
$this->forceShutdown();
Process::kill(Process::pid(), true);
}
public function forceShutdown() : void{
if($this->hasStopped){
return;

View File

@ -270,6 +270,17 @@ class PluginManager{
$name = $description->getName();
if($this->graylist !== null && !$this->graylist->isAllowed($name)){
$this->server->getLogger()->notice($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_plugin_loadError(
$name,
$this->graylist->isWhitelist() ? KnownTranslationFactory::pocketmine_plugin_disallowedByWhitelist() : KnownTranslationFactory::pocketmine_plugin_disallowedByBlacklist()
)));
//this does NOT increment loadErrorCount, because using the graylist to prevent a plugin from
//loading is not considered accidental; this is the same as if the plugin were manually removed
//this means that the server will continue to boot even if some plugins were blocked by graylist
continue;
}
if(($loadabilityError = $loadabilityChecker->check($description)) !== null){
$this->server->getLogger()->critical($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_plugin_loadError($name, $loadabilityError)));
$loadErrorCount++;
@ -286,17 +297,6 @@ class PluginManager{
$this->server->getLogger()->warning($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_plugin_spacesDiscouraged($name)));
}
if($this->graylist !== null && !$this->graylist->isAllowed($name)){
$this->server->getLogger()->notice($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_plugin_loadError(
$name,
$this->graylist->isWhitelist() ? KnownTranslationFactory::pocketmine_plugin_disallowedByWhitelist() : KnownTranslationFactory::pocketmine_plugin_disallowedByBlacklist()
)));
//this does NOT increment loadErrorCount, because using the graylist to prevent a plugin from
//loading is not considered accidental; this is the same as if the plugin were manually removed
//this means that the server will continue to boot even if some plugins were blocked by graylist
continue;
}
$triage->plugins[$name] = new PluginLoadTriageEntry($file, $loader, $description);
$triage->softDependencies[$name] = array_merge($triage->softDependencies[$name] ?? [], $description->getSoftDepend());