diff --git a/application/core/Configurators/ServerSettings.php b/application/core/Configurators/ServerSettings.php index b6248fd6..ee86e5b6 100644 --- a/application/core/Configurators/ServerSettings.php +++ b/application/core/Configurators/ServerSettings.php @@ -98,8 +98,8 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener { trigger_error($mysqli->error); return false; } + $serverSettings = $this->maniaControl->client->getServerOptions()->toArray(); - $serverSettings = (array)$this->maniaControl->client->getServerOptions(); $loadedSettings = array(); while($row = $result->fetch_object()) { if(!isset($serverSettings[$row->settingName])) { @@ -137,8 +137,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener { $pagesId = 'ServerSettingsPages'; $frame = new Frame(); - //TODO temporary - $serverSettings = $this->maniaControl->client->execute('GetServerOptions'); + $serverSettings = $this->maniaControl->client->getServerOptions()->toArray(); // Config $pagerSize = 9.; @@ -268,8 +267,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener { return; } - // Note on ServerOptions the whole Options have to be saved, otherwise a error will appear - $serverSettings = $this->maniaControl->client->execute('GetServerOptions'); //TODO just temporary + $serverSettings = $this->maniaControl->client->getServerOptions()->toArray(); $prefixLength = strlen(self::ACTION_PREFIX_SETTING); @@ -361,6 +359,9 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener { // $chatMessage = '$ff0' . $title . ' $<' . $player->nickname . '$> set ScriptSetting' . ($settingsCount > 1 ? 's' : '') . ' '; foreach($newSettings as $setting => $value) { + if($value == null) { + continue; + } $statement->bind_param('iss', $this->maniaControl->server->index, $setting, $value); $statement->execute(); if($statement->error) { @@ -393,16 +394,4 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener { return true; } - /** - * Parse the Setting Value to a String Representation - * - * @param mixed $value - * @return string - */ - private function parseSettingValue($value) { - if(is_bool($value)) { - return ($value ? 'True' : 'False'); - } - return (string)$value; - } } diff --git a/application/core/Maniaplanet/DedicatedServer/Connection.php b/application/core/Maniaplanet/DedicatedServer/Connection.php index eb22a955..e55ff14c 100644 --- a/application/core/Maniaplanet/DedicatedServer/Connection.php +++ b/application/core/Maniaplanet/DedicatedServer/Connection.php @@ -106,8 +106,8 @@ class Connection * @param string $authLevel * @param array $params */ - public function execute($methodName, $params = array(), $multicall = false) - {//TODO just temporary + protected function execute($methodName, $params = array(), $multicall = false) + { if($multicall) { $this->xmlrpcClient->addCall($methodName, $params); diff --git a/application/core/Maniaplanet/DedicatedServer/Structures/ScriptInfo.php b/application/core/Maniaplanet/DedicatedServer/Structures/ScriptInfo.php index 2d0125e6..6371002b 100644 --- a/application/core/Maniaplanet/DedicatedServer/Structures/ScriptInfo.php +++ b/application/core/Maniaplanet/DedicatedServer/Structures/ScriptInfo.php @@ -15,6 +15,7 @@ class ScriptInfo extends AbstractStructure public $description; public $version; public $paramDescs = array(); + public $commandDescs = array(); static public function fromArray($array) { @@ -24,6 +25,10 @@ class ScriptInfo extends AbstractStructure { $object->paramDescs = ScriptSettings::fromArrayOfArray($object->paramDescs); } + if($object->commandDescs) + { + $object->commandDescs = Command::fromArrayOfArray($object->commandDescs); + } return $object; } diff --git a/application/core/Maniaplanet/DedicatedServer/Structures/ServerOptions.php b/application/core/Maniaplanet/DedicatedServer/Structures/ServerOptions.php index 301ce853..4535816a 100644 --- a/application/core/Maniaplanet/DedicatedServer/Structures/ServerOptions.php +++ b/application/core/Maniaplanet/DedicatedServer/Structures/ServerOptions.php @@ -4,7 +4,7 @@ * * @license http://www.gnu.org/licenses/lgpl.html LGPL License 3 */ - + namespace Maniaplanet\DedicatedServer\Structures; class ServerOptions extends AbstractStructure @@ -39,4 +39,6 @@ class ServerOptions extends AbstractStructure public $nextUseChangingValidationSeed; public $clientInputsMaxLatency; public $keepPlayerSlots; + public $disableHorns; + public $disableServiceAnnounces; } \ No newline at end of file diff --git a/application/core/Server/ServerCommands.php b/application/core/Server/ServerCommands.php index a116153e..5a21820a 100644 --- a/application/core/Server/ServerCommands.php +++ b/application/core/Server/ServerCommands.php @@ -67,13 +67,12 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage $scriptInfos = $this->maniaControl->client->getModeScriptInfo(); $pauseExists = false; - /*foreach($scriptInfos['commandDescs'] as $param) { - if($param['Name'] == "Command_ForceWarmUp") { + foreach($scriptInfos->commandDescs as $param) { + if($param->name == "Command_ForceWarmUp") { $pauseExists = true; break; } - }*/ //TODO temp - $pauseExists = true; + } // Set Pause if($pauseExists) { diff --git a/application/plugins/CustomVotes.php b/application/plugins/CustomVotes.php index d8c17c56..27949e48 100644 --- a/application/plugins/CustomVotes.php +++ b/application/plugins/CustomVotes.php @@ -197,11 +197,11 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP $this->addVoteMenuItem($itemQuad, 5, 'Vote for Restart-Map'); //Check if Pause exists in current gamemode - $scriptInfos = (array)$this->maniaControl->client->getModeScriptInfo(); + $scriptInfos = $this->maniaControl->client->getModeScriptInfo(); $pauseExists = false; - foreach($scriptInfos["commandDescs"] as $param) { - if($param['Name'] == "Command_ForceWarmUp") { + foreach($scriptInfos->commandDescs as $param) { + if($param->name == "Command_ForceWarmUp") { $pauseExists = true; break; }