fixed forcespec exception

This commit is contained in:
kremsy 2014-04-13 12:25:39 +02:00 committed by Steffen Schröder
parent 9898009a82
commit 7ba4aa0b7b

View File

@ -184,7 +184,17 @@ class PlayerActions {
return; return;
} }
try {
$this->maniaControl->client->forceSpectator($target->login, $spectatorState); $this->maniaControl->client->forceSpectator($target->login, $spectatorState);
} catch(Exception $e) {
if ($e->getMessage() == "There are too many spectators") {
$this->maniaControl->chat->sendError($e->getMessage(), $adminLogin);
return;
}
throw $e;
}
$title = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel); $title = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel);
$chatMessage = $title . ' $<' . $admin->nickname . '$> forced $<' . $target->nickname . '$> to Spectator!'; $chatMessage = $title . ' $<' . $admin->nickname . '$> forced $<' . $target->nickname . '$> to Spectator!';
@ -371,7 +381,7 @@ class PlayerActions {
$this->maniaControl->client->kick($target->login, $message); $this->maniaControl->client->kick($target->login, $message);
} }
} catch(Exception $e) { } catch(Exception $e) {
if($e == "Login unknown."){ if ($e == "Login unknown.") {
return; return;
} }
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error) // TODO: only possible valid exception should be "wrong login" - throw others (like connection error)