diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 6db090768..6e572d33a 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -1438,13 +1438,6 @@ class Server{ $this->dataPath = realpath($dataPath) . DIRECTORY_SEPARATOR; $this->pluginPath = realpath($pluginPath) . DIRECTORY_SEPARATOR; - $consoleNotifier = new SleeperNotifier(); - $this->console = new CommandReader($consoleNotifier); - $this->tickSleeper->addNotifier($consoleNotifier, function() : void{ - $this->checkConsole(); - }); - $this->console->start(PTHREADS_INHERIT_NONE); - $version = new VersionString($this->getPocketMineVersion()); $this->logger->info("Loading pocketmine.yml..."); @@ -1538,6 +1531,12 @@ class Server{ $this->doTitleTick = ((bool) $this->getProperty("console.title-tick", true)) && Terminal::hasFormattingCodes(); + $consoleNotifier = new SleeperNotifier(); + $this->console = new CommandReader($consoleNotifier); + $this->tickSleeper->addNotifier($consoleNotifier, function() : void{ + $this->checkConsole(); + }); + $this->console->start(PTHREADS_INHERIT_NONE); if($this->getConfigBool("enable-rcon", false)){ try{ @@ -2050,9 +2049,11 @@ class Server{ $this->properties->save(); } - $this->getLogger()->debug("Closing console"); - $this->console->shutdown(); - $this->console->notify(); + if($this->console instanceof CommandReader){ + $this->getLogger()->debug("Closing console"); + $this->console->shutdown(); + $this->console->notify(); + } if($this->network instanceof Network){ $this->getLogger()->debug("Stopping network interfaces");