fixed exceptions

This commit is contained in:
kremsy 2014-03-13 18:25:29 +01:00 committed by Steffen Schröder
parent 689e572c62
commit d3cc9db29c
5 changed files with 44 additions and 11 deletions

View File

@ -98,8 +98,10 @@ class ManiaExchangeManager {
* @param $mxId
*/
public function unsetMap($mxId) {
if (isset($this->mxIdUidVector[$mxId])) {
unset($this->mxIdUidVector[$mxId]);
}
}
/**
* Fetch Map Information from Mania Exchange
@ -274,7 +276,7 @@ class ManiaExchangeManager {
$game = explode('@', $titleId);
$envNumber = $this->getEnvironment($game[0]);
if($env != '' || $envNumber != -1){
if ($env != '' || $envNumber != -1) {
$url .= '&environments=' . $envNumber;
}
if ($name != '') {

View File

@ -11,6 +11,7 @@ use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\IconManager;
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
use ManiaControl\Players\Player;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
/**
* Class offering commands to manage maps
@ -205,7 +206,13 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
$this->maniaControl->chat->sendSuccess($message);
$this->maniaControl->log($message, true);
try {
$this->maniaControl->client->restartMap();
} catch(Exception $e) {
if ($e->getMessage() != 'Change in progress.') {
throw $e;
}
}
}
/**

View File

@ -368,8 +368,16 @@ class MapManager implements CallbackListener {
$this->maniaControl->callbackManager->triggerCallback(self::CB_MAPS_UPDATED);
//Write MapList
if($this->maniaControl->settingManager->getSetting($this, self::SETTING_AUTOSAVE_MAPLIST)){
if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_AUTOSAVE_MAPLIST)) {
try {
$this->maniaControl->client->saveMatchSettings($this->maniaControl->settingManager->getSetting($this, self::SETTING_MAPLIST_FILE));
} catch(Exception $e) {
if ($e->getMessage() == 'Unable to write the playlist file.') {
$this->maniaControl->log("Unable to write the playlist file, please checkout your MX-Folders File permissions!");
} else {
throw $e;
}
}
}
}

View File

@ -132,7 +132,16 @@ class PlayerActions {
$this->forcePlayerToPlay($adminLogin, $targetLogin, true, false);
}
try {
$this->maniaControl->client->forcePlayerTeam($target->login, $teamId);
} catch(Exception $e) {
if ($e->getMessage() == "Not in Team mode.") {
$this->forcePlayerToPlay($adminLogin, $targetLogin);
return;
} else {
throw $e;
}
}
$chatMessage = false;
$title = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel);

View File

@ -9,6 +9,7 @@ use ManiaControl\Callbacks\TimerListener;
use ManiaControl\Formatter;
use ManiaControl\ManiaControl;
use ManiaControl\Statistics\StatisticManager;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
/**
* Class managing Players
@ -144,10 +145,16 @@ class PlayerManager implements CallbackListener, TimerListener {
*/
public function playerConnect(array $callback) {
$login = $callback[1][0];
try {
$playerInfo = $this->maniaControl->client->getDetailedPlayerInfo($login);
$player = new Player($playerInfo);
$this->addPlayer($player);
} catch(Exception $e) {
if ($e->getMessage() != 'Login unknown.') {
throw $e;
}
}
}
/**