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
This commit is contained in:
Beu
2022-05-08 23:11:20 +02:00
parent b0fea31a13
commit 81d9a63a4b
3 changed files with 27 additions and 54 deletions

View File

@ -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;
}