some fixes due new structure

This commit is contained in:
kremsy 2014-01-16 19:40:54 +01:00 committed by Steffen Schröder
parent 0c6d8c010c
commit fd2f9faa6c
5 changed files with 16 additions and 15 deletions

View File

@ -268,7 +268,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
} }
// Note on ServerOptions the whole Options have to be saved, otherwise a error will appear // 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); $prefixLength = strlen(self::ACTION_PREFIX_SETTING);
@ -292,7 +292,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
settype($newSettings[$settingName], gettype($serverSettings[$settingName])); settype($newSettings[$settingName], gettype($serverSettings[$settingName]));
} }
$this->applyNewScriptSettings($newSettings, $player); $this->applyNewServerSettings($newSettings, $player);
//Reopen the Menu //Reopen the Menu
$menuId = $this->maniaControl->configurator->getMenuId($this->getTitle()); $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 array $newSettings
* @param Player $player * @param Player $player
* @return bool * @return bool
*/ */
private function applyNewScriptSettings(array $newSettings, Player $player) { private function applyNewServerSettings(array $newSettings, Player $player) {
if(!$newSettings) { if(!$newSettings) {
return true; return true;
} }
$success = $this->maniaControl->client->setServerOptions($newSettings); //TODO not working yet
/*$success = $this->maniaControl->client->setServerOptions($newSettings);
if(!$success) { if(!$success) {
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login); $this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
return false; return false;
} }*/
// Save Settings into Database // Save Settings into Database
$mysqli = $this->maniaControl->database->mysqli; $mysqli = $this->maniaControl->database->mysqli;

View File

@ -203,7 +203,7 @@ class MapManager implements CallbackListener {
$this->mxManager->unsetMap($map->mx->id); $this->mxManager->unsetMap($map->mx->id);
// Remove map // 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()); trigger_error("Couldn't remove current map. " . $this->maniaControl->getClientErrorText());
$this->maniaControl->chat->sendError("Couldn't remove map.", $admin); $this->maniaControl->chat->sendError("Couldn't remove map.", $admin);
return; return;
@ -247,7 +247,7 @@ class MapManager implements CallbackListener {
$mapArray = array_merge($higherMapArray, $lowerMapArray); $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()); trigger_error("Error while restructuring the Maplist. " . $this->maniaControl->getClientErrorText());
return false; return false;
} }
@ -272,7 +272,7 @@ class MapManager implements CallbackListener {
$mapArray[] = $map->fileName; $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()); trigger_error("Couldn't shuffle mapList. " . $this->maniaControl->getClientErrorText());
return false; return false;
} }

View File

@ -174,7 +174,7 @@ class PlayerActions {
if($releaseSlot) { if($releaseSlot) {
// Free player slot // Free player slot
$this->maniaControl->client->spectatorReleasePlayerSlot($target->login); //$this->maniaControl->client->spectatorReleasePlayerSlot($target->login); //TODO not in spec exception mp crash
} }
} }

View File

@ -82,7 +82,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
$this->maniaControl->authenticationManager->sendNotAllowed($player); $this->maniaControl->authenticationManager->sendNotAllowed($player);
return; return;
} }
$success = $this->maniaControl->client->query('AutoTeamBalance'); $success = $this->maniaControl->client->autoTeamBalance();
if(!$success) { if(!$success) {
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login); $this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
return; return;
@ -246,7 +246,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
} }
$success = true; $success = true;
for($i = 0; $i < $amount; $i++) { for($i = 0; $i < $amount; $i++) {
if(!$this->maniaControl->client->query('ConnectFakePlayer')) { if(!$this->maniaControl->client->connectFakePlayer()) {
$success = false; $success = false;
} }
} }
@ -268,7 +268,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
$this->maniaControl->authenticationManager->sendNotAllowed($player); $this->maniaControl->authenticationManager->sendNotAllowed($player);
return; return;
} }
$success = $this->maniaControl->client->query('DisconnectFakePlayer', '*'); $success = $this->maniaControl->client->disconnectFakePlayer('*');
if(!$success) { if(!$success) {
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login); $this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
return; return;

View File

@ -592,8 +592,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
switch($action) { switch($action) {
case self::ACTION_SPECTATE_PLAYER: case self::ACTION_SPECTATE_PLAYER:
$this->maniaControl->client->query('ForceSpectator', $adminLogin, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE); $this->maniaControl->client->forceSpectator($adminLogin, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE);
$this->maniaControl->client->query('ForceSpectatorTarget', $adminLogin, $targetLogin, 1); //$this->maniaControl->client->forceSpectatorTarget($adminLogin, $targetLogin, 1); //TODO mc crash player is not a spectator
break; break;
case self::ACTION_OPEN_PLAYER_DETAILED: case self::ACTION_OPEN_PLAYER_DETAILED:
$player = $this->maniaControl->playerManager->getPlayer($adminLogin); $player = $this->maniaControl->playerManager->getPlayer($adminLogin);