diff --git a/application/core/ErrorHandler.php b/application/core/ErrorHandler.php index 1a2ce336..e0c16a56 100644 --- a/application/core/ErrorHandler.php +++ b/application/core/ErrorHandler.php @@ -6,7 +6,6 @@ use ManiaControl\Callbacks\Callbacks; use ManiaControl\Files\FileUtil; use ManiaControl\Plugins\PluginManager; use ManiaControl\Update\UpdateManager; -use Maniaplanet\DedicatedServer\Connection; /** * Error and Exception Manager Class @@ -301,10 +300,7 @@ class ErrorHandler { if ($this->maniaControl->client) { try { - // Hide manialinks $this->maniaControl->client->sendHideManialinkPage(); - // Close the client connection - Connection::delete($this->maniaControl->client); } catch (TransportException $e) { $this->handleException($e, false); } diff --git a/application/core/ManiaControl.php b/application/core/ManiaControl.php index bfba5511..2468eada 100644 --- a/application/core/ManiaControl.php +++ b/application/core/ManiaControl.php @@ -177,9 +177,18 @@ class ManiaControl implements CommandListener, TimerListener { } $this->log($message); } + $this->disconnect(); exit(); } + /** + * Close the Client Connection + */ + public function disconnect() { + Connection::delete($this->client); + $this->client = null; + } + /** * Check Connection */ @@ -294,7 +303,7 @@ class ManiaControl implements CommandListener, TimerListener { // Check if the version of the server is high enough $version = $this->client->getVersion(); if ($version->build < self::MIN_DEDIVERSION) { - trigger_error("The Server has Version '{$version->build}', while at least '" . self::MIN_DEDIVERSION . "' is required!", E_USER_ERROR); + $this->quit("The Server has Version '{$version->build}', while at least '" . self::MIN_DEDIVERSION . "' is required!", true); } // OnInit callback @@ -307,12 +316,10 @@ class ManiaControl implements CommandListener, TimerListener { // AfterInit callback $this->callbackManager->triggerCallback(Callbacks::AFTERINIT); - // Announce ManiaControl - $this->chat->sendInformation('ManiaControl v' . self::VERSION . ' successfully started!'); - // Loading finished $this->log('Loading completed!'); $this->log('Link: maniaplanet://#join=' . $this->server->login . '@' . $this->server->titleId); + $this->chat->sendInformation('ManiaControl v' . self::VERSION . ' successfully started!'); // Main loop while (!$this->shutdownRequested) { @@ -330,7 +337,7 @@ class ManiaControl implements CommandListener, TimerListener { // Load remote client $this->server->loadConfig(); - $this->log("Connecting to server at {$this->server->config->host}:{$this->server->config->port}..."); + $this->log("Connecting to Server at {$this->server->config->host}:{$this->server->config->port}..."); try { $this->client = Connection::factory($this->server->config->host, $this->server->config->port, self::SCRIPT_TIMEOUT, $this->server->config->login, $this->server->config->pass);