From fd2f9faa6caea5dfeb425fd02d882739b14f5d03 Mon Sep 17 00:00:00 2001 From: kremsy Date: Thu, 16 Jan 2014 19:40:54 +0100 Subject: [PATCH] some fixes due new structure --- application/core/Configurators/ServerSettings.php | 13 +++++++------ application/core/Maps/MapManager.php | 6 +++--- application/core/Players/PlayerActions.php | 2 +- application/core/Players/PlayerCommands.php | 6 +++--- application/core/Players/PlayerList.php | 4 ++-- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/application/core/Configurators/ServerSettings.php b/application/core/Configurators/ServerSettings.php index 987cbc1a..b0f4ffb2 100644 --- a/application/core/Configurators/ServerSettings.php +++ b/application/core/Configurators/ServerSettings.php @@ -268,7 +268,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener { } // Note on ServerOptions the whole Options have to be saved, otherwise a error will appear - $serverSettings = $this->maniaControl->client->getServerOptions(); + $serverSettings = (array)$this->maniaControl->client->getServerOptions(); $prefixLength = strlen(self::ACTION_PREFIX_SETTING); @@ -292,7 +292,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener { settype($newSettings[$settingName], gettype($serverSettings[$settingName])); } - $this->applyNewScriptSettings($newSettings, $player); + $this->applyNewServerSettings($newSettings, $player); //Reopen the Menu $menuId = $this->maniaControl->configurator->getMenuId($this->getTitle()); @@ -319,21 +319,22 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener { } /** - * Apply the Array of new Script Settings + * Apply the Array of new Server Settings * * @param array $newSettings * @param Player $player * @return bool */ - private function applyNewScriptSettings(array $newSettings, Player $player) { + private function applyNewServerSettings(array $newSettings, Player $player) { if(!$newSettings) { return true; } - $success = $this->maniaControl->client->setServerOptions($newSettings); + //TODO not working yet + /*$success = $this->maniaControl->client->setServerOptions($newSettings); if(!$success) { $this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login); return false; - } + }*/ // Save Settings into Database $mysqli = $this->maniaControl->database->mysqli; diff --git a/application/core/Maps/MapManager.php b/application/core/Maps/MapManager.php index 5cc654b1..9ba8d954 100644 --- a/application/core/Maps/MapManager.php +++ b/application/core/Maps/MapManager.php @@ -203,7 +203,7 @@ class MapManager implements CallbackListener { $this->mxManager->unsetMap($map->mx->id); // Remove map - if(!$this->maniaControl->client->query('RemoveMap', $map->fileName)) { + if(!$this->maniaControl->client->removeMap($map->fileName)) { trigger_error("Couldn't remove current map. " . $this->maniaControl->getClientErrorText()); $this->maniaControl->chat->sendError("Couldn't remove map.", $admin); return; @@ -247,7 +247,7 @@ class MapManager implements CallbackListener { $mapArray = array_merge($higherMapArray, $lowerMapArray); - if(!$this->maniaControl->client->query('ChooseNextMapList', $mapArray)) { + if(!$this->maniaControl->client->chooseNextMapList($mapArray)) { trigger_error("Error while restructuring the Maplist. " . $this->maniaControl->getClientErrorText()); return false; } @@ -272,7 +272,7 @@ class MapManager implements CallbackListener { $mapArray[] = $map->fileName; } - if(!$this->maniaControl->client->query('ChooseNextMapList', $mapArray)) { + if(!$this->maniaControl->client->chooseNextMapList($mapArray)) { trigger_error("Couldn't shuffle mapList. " . $this->maniaControl->getClientErrorText()); return false; } diff --git a/application/core/Players/PlayerActions.php b/application/core/Players/PlayerActions.php index 416b3ef9..7d8e6773 100644 --- a/application/core/Players/PlayerActions.php +++ b/application/core/Players/PlayerActions.php @@ -174,7 +174,7 @@ class PlayerActions { if($releaseSlot) { // Free player slot - $this->maniaControl->client->spectatorReleasePlayerSlot($target->login); + //$this->maniaControl->client->spectatorReleasePlayerSlot($target->login); //TODO not in spec exception mp crash } } diff --git a/application/core/Players/PlayerCommands.php b/application/core/Players/PlayerCommands.php index 16db75a9..53ee8642 100644 --- a/application/core/Players/PlayerCommands.php +++ b/application/core/Players/PlayerCommands.php @@ -82,7 +82,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener { $this->maniaControl->authenticationManager->sendNotAllowed($player); return; } - $success = $this->maniaControl->client->query('AutoTeamBalance'); + $success = $this->maniaControl->client->autoTeamBalance(); if(!$success) { $this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login); return; @@ -246,7 +246,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener { } $success = true; for($i = 0; $i < $amount; $i++) { - if(!$this->maniaControl->client->query('ConnectFakePlayer')) { + if(!$this->maniaControl->client->connectFakePlayer()) { $success = false; } } @@ -268,7 +268,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener { $this->maniaControl->authenticationManager->sendNotAllowed($player); return; } - $success = $this->maniaControl->client->query('DisconnectFakePlayer', '*'); + $success = $this->maniaControl->client->disconnectFakePlayer('*'); if(!$success) { $this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login); return; diff --git a/application/core/Players/PlayerList.php b/application/core/Players/PlayerList.php index fb9a5db8..4c3fc9af 100644 --- a/application/core/Players/PlayerList.php +++ b/application/core/Players/PlayerList.php @@ -592,8 +592,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener { switch($action) { case self::ACTION_SPECTATE_PLAYER: - $this->maniaControl->client->query('ForceSpectator', $adminLogin, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE); - $this->maniaControl->client->query('ForceSpectatorTarget', $adminLogin, $targetLogin, 1); + $this->maniaControl->client->forceSpectator($adminLogin, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE); + //$this->maniaControl->client->forceSpectatorTarget($adminLogin, $targetLogin, 1); //TODO mc crash player is not a spectator break; case self::ACTION_OPEN_PLAYER_DETAILED: $player = $this->maniaControl->playerManager->getPlayer($adminLogin);