From 81d9a63a4bb926a05adf71fa4263be0ab28be89b Mon Sep 17 00:00:00 2001 From: beu Date: Sun, 8 May 2022 23:11:20 +0200 Subject: [PATCH] Update for dedicated server 2022-05-08: * Remove useless settings of ServerOptions * Set method deprecated for API version 2022-03-21 * Fix error when trying to get remove GetGameMode Method at start --- core/Script/ScriptManager.php | 10 +++- .../DedicatedServer/Connection.php | 19 +++++++ .../Structures/ServerOptions.php | 52 ------------------- 3 files changed, 27 insertions(+), 54 deletions(-) diff --git a/core/Script/ScriptManager.php b/core/Script/ScriptManager.php index 7a246f17..f35d8137 100644 --- a/core/Script/ScriptManager.php +++ b/core/Script/ScriptManager.php @@ -124,8 +124,14 @@ class ScriptManager implements UsageInformationAble { */ public function isScriptMode() { if (is_null($this->isScriptMode)) { - $gameMode = $this->maniaControl->getClient()->getGameMode(); - $this->isScriptMode = ($gameMode === 0); + // GetGameMode method has been removed in the API version "2022-03-21". So if the function return a "FaultException", consider it in script mode + try { + $gameMode = $this->maniaControl->getClient()->getGameMode(); + $this->isScriptMode = ($gameMode === 0 || !is_int($gameMode)); + } catch (\Throwable $th) { + $this->isScriptMode = true; + } + } return $this->isScriptMode; } diff --git a/libs/Maniaplanet/DedicatedServer/Connection.php b/libs/Maniaplanet/DedicatedServer/Connection.php index 4e067a04..161a6019 100755 --- a/libs/Maniaplanet/DedicatedServer/Connection.php +++ b/libs/Maniaplanet/DedicatedServer/Connection.php @@ -1725,6 +1725,7 @@ class Connection } /** + * @deprecated since version 2022-03-21 * Enable or disable peer-to-peer upload from server. * Only available to Admin. * @param bool $enable @@ -1741,6 +1742,7 @@ class Connection } /** + * @deprecated since version 2022-03-21 * Returns if the peer-to-peer upload from server is enabled. * @param bool $multicall * @return bool @@ -1751,6 +1753,7 @@ class Connection } /** + * @deprecated since version 2022-03-21 * Enable or disable peer-to-peer download for server. * Only available to Admin. * @param bool $enable @@ -1767,6 +1770,7 @@ class Connection } /** + * @deprecated since version 2022-03-21 * Returns if the peer-to-peer download for server is enabled. * @param bool $multicall * @return bool @@ -2034,6 +2038,7 @@ class Connection } /** + * @deprecated since version 2022-03-21 * Enable the autosaving on the server of validation replays, every time a player makes a new time. * Only available to SuperAdmin. * @param bool $enable @@ -2060,6 +2065,7 @@ class Connection } /** + * @deprecated since version 2022-03-21 * Returns if autosaving of validation replays is enabled on the server. * @param bool $multicall * @return bool @@ -2126,6 +2132,7 @@ class Connection } /** + * @deprecated since version 2022-03-21 * Set a new ladder mode. * Only available to Admin. * Requires a map restart to be taken into account. @@ -2143,6 +2150,7 @@ class Connection } /** + * @deprecated since version 2022-03-21 * Get the current and next ladder mode on server. * @param bool $multicall * @return int[] {int CurrentValue, int NextValue} @@ -2153,6 +2161,7 @@ class Connection } /** + * @deprecated since version 2022-03-21 * Get the ladder points limit for the players allowed on this server. * @param bool $multicall * @return Structures\LadderLimits @@ -2165,6 +2174,7 @@ class Connection } /** + * @deprecated since version 2022-03-21 * Set the network vehicle quality. * Only available to Admin. * Requires a map restart to be taken into account. @@ -2182,6 +2192,7 @@ class Connection } /** + * @deprecated since version 2022-03-21 * Get the current and next network vehicle quality on server. * @param bool $multicall * @return int[] {int CurrentValue, int NextValue} @@ -2418,6 +2429,7 @@ class Connection } /** + * @deprecated since version 2022-03-21 * Set a new password for the referee mode. * Only available to Admin. * @param string $password @@ -2434,6 +2446,7 @@ class Connection } /** + * @deprecated since version 2022-03-21 * Get the password for referee mode if called as Admin or Super Admin, else returns if a password is needed or not. * @param bool $multicall * @return string|bool @@ -2444,6 +2457,7 @@ class Connection } /** + * @deprecated since version 2022-03-21 * Set the referee validation mode. * Only available to Admin. * @param int $mode 0: validate the top3 players, 1: validate all players @@ -2460,6 +2474,7 @@ class Connection } /** + * @deprecated since version 2022-03-21 * Get the referee validation mode. * @param bool $multicall * @return int @@ -2470,6 +2485,7 @@ class Connection } /** + * @deprecated since version 2022-03-21 * Set whether the game should use a variable validation seed or not. * Only available to Admin. * Requires a map restart to be taken into account. @@ -2487,6 +2503,7 @@ class Connection } /** + * @deprecated since version 2022-03-21 * Get the current and next value of UseChangingValidationSeed. * @param bool $multicall * @return bool[] {bool CurrentValue, bool NextValue} @@ -2872,6 +2889,7 @@ class Connection } /** + * @deprecated since version 2022-03-21 * Set a new game mode. * Only available to Admin. * Requires a map restart to be taken into account. @@ -2889,6 +2907,7 @@ class Connection } /** + * @deprecated since version 2022-03-21 * Get the current game mode. * @param bool $multicall * @return int diff --git a/libs/Maniaplanet/DedicatedServer/Structures/ServerOptions.php b/libs/Maniaplanet/DedicatedServer/Structures/ServerOptions.php index f770ee62..fe78f770 100755 --- a/libs/Maniaplanet/DedicatedServer/Structures/ServerOptions.php +++ b/libs/Maniaplanet/DedicatedServer/Structures/ServerOptions.php @@ -17,60 +17,8 @@ class ServerOptions extends AbstractStructure public $password; /** @var string */ public $passwordForSpectator; - /** @var int */ - public $hideServer; - /** @var int */ - public $currentMaxPlayers; - /** @var int */ - public $nextMaxPlayers; - /** @var int */ - public $currentMaxSpectators; - /** @var int */ - public $nextMaxSpectators; - /** @var bool */ - public $isP2PUpload; - /** @var bool */ - public $isP2PDownload; - /** @var bool */ - public $currentLadderMode; - /** @var int */ - public $nextLadderMode; - /** @var float */ - public $ladderServerLimitMax; - /** @var float */ - public $ladderServerLimitMin; - /** @var int */ - public $currentVehicleNetQuality; - /** @var int */ - public $nextVehicleNetQuality; - /** @var int */ - public $currentCallVoteTimeOut; - /** @var int */ - public $nextCallVoteTimeOut; /** @var float */ public $callVoteRatio; - /** @var bool */ - public $allowMapDownload; - /** @var bool */ - public $autoSaveReplays; - /** @var bool */ - public $autoSaveValidationReplays; - /** @var string */ - public $refereePassword; - /** @var int */ - public $refereeMode; - /** @var bool */ - public $currentUseChangingValidationSeed; - /** @var bool */ - public $nextUseChangingValidationSeed; - /** @var int */ - public $clientInputsMaxLatency; - /** @var bool */ - public $keepPlayerSlots; - /** @var bool */ - public $disableHorns; - /** @var bool */ - public $disableServiceAnnounces; /** * @internal