From 7de7858f03921997b63aaa9fe2e7f5e98d2bdb76 Mon Sep 17 00:00:00 2001 From: Apfelwurm Date: Tue, 16 Nov 2021 22:15:48 +0100 Subject: [PATCH] Add Check for Trackmania Nations/United Forever API Version --- src/Maniaplanet/DedicatedServer/Connection.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Maniaplanet/DedicatedServer/Connection.php b/src/Maniaplanet/DedicatedServer/Connection.php index 55dc88e..114b21c 100644 --- a/src/Maniaplanet/DedicatedServer/Connection.php +++ b/src/Maniaplanet/DedicatedServer/Connection.php @@ -17,6 +17,7 @@ */ class Connection { + const API_2011_02_21 = '2011-02-21'; const API_2011_08_01 = '2011-08-01'; const API_2011_10_06 = '2011-10-06'; const API_2012_06_19 = '2012-06-19'; @@ -46,7 +47,9 @@ public function __construct( ) { $this->xmlrpcClient = new Xmlrpc\GbxRemote($host, $port, $timeout); $this->authenticate($user, $password); - $this->setApiVersion($apiVersion); + if ($apiVersion > self::API_2011_02_21) { + $this->setApiVersion($apiVersion); + } } /** @@ -1644,7 +1647,7 @@ public function getLobbyInfo($multicall = false) * @param bool $multicall * @return bool */ - public function customizeQuitDialog(string $manialink, string$sendToServer = '', bool $askFavorite = true, int $quitButtonDelay = 0, $multicall = false) + public function customizeQuitDialog(string $manialink, string $sendToServer = '', bool $askFavorite = true, int $quitButtonDelay = 0, $multicall = false) { return $this->execute(ucfirst(__FUNCTION__), [$manialink, $sendToServer, $askFavorite, $quitButtonDelay], $multicall); }