Start console reader in a more sensible place

This commit is contained in:
Dylan K. Taylor 2018-06-12 11:26:34 +01:00
parent 0b9ce8a0d4
commit f51743765d

View File

@ -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");