mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Exit with error code if the server failed to start
this ensures that external tools such as start.cmd actually see an error if there is one
This commit is contained in:
parent
4b662d65b3
commit
7355798e77
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user