diff --git a/src/Server.php b/src/Server.php index 2b78580a8..3128a7c39 100644 --- a/src/Server.php +++ b/src/Server.php @@ -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; diff --git a/src/plugin/PluginManager.php b/src/plugin/PluginManager.php index cf5959010..acffae53e 100644 --- a/src/plugin/PluginManager.php +++ b/src/plugin/PluginManager.php @@ -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());