This commit is contained in:
kremsy 2014-02-27 13:24:55 +01:00 committed by Steffen Schröder
parent 074d1dfd8c
commit 4704b8a179

View File

@ -122,7 +122,7 @@ class PlayerActions {
return; return;
} }
$target = $this->maniaControl->playerManager->getPlayer($targetLogin); $target = $this->maniaControl->playerManager->getPlayer($targetLogin);
if(!$target) { if(!$target || !$admin) {
return; return;
} }
@ -130,13 +130,7 @@ class PlayerActions {
$this->forcePlayerToPlay($adminLogin, $targetLogin, true, false); $this->forcePlayerToPlay($adminLogin, $targetLogin, true, false);
} }
try {
$this->maniaControl->client->forcePlayerTeam($target->login, $teamId); $this->maniaControl->client->forcePlayerTeam($target->login, $teamId);
} catch(Exception $e) {
// TODO: only possible valid exceptions should be "wrong login" or "not in team mode" - throw others (like connection error)
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
return;
}
$chatMessage = false; $chatMessage = false;
$title = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel); $title = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel);
@ -168,14 +162,12 @@ class PlayerActions {
} }
$target = $this->maniaControl->playerManager->getPlayer($targetLogin); $target = $this->maniaControl->playerManager->getPlayer($targetLogin);
try { if(!$admin || !$target){
$this->maniaControl->client->forceSpectator($target->login, $spectatorState);
} catch(Exception $e) {
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error)
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
return; return;
} }
$this->maniaControl->client->forceSpectator($target->login, $spectatorState);
$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!';
$this->maniaControl->chat->sendInformation($chatMessage); $this->maniaControl->chat->sendInformation($chatMessage);
@ -208,14 +200,12 @@ class PlayerActions {
$target = $this->maniaControl->playerManager->getPlayer($targetLogin); $target = $this->maniaControl->playerManager->getPlayer($targetLogin);
try { if(!$target){
$this->maniaControl->client->unIgnore($targetLogin);
} catch(Exception $e) {
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error)
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $adminLogin);
return; return;
} }
$this->maniaControl->client->unIgnore($targetLogin);
$title = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel); $title = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel);
$chatMessage = $title . ' $<' . $admin->nickname . '$> un-muted $<' . $target->nickname . '$>!'; $chatMessage = $title . ' $<' . $admin->nickname . '$> un-muted $<' . $target->nickname . '$>!';
$this->maniaControl->chat->sendInformation($chatMessage); $this->maniaControl->chat->sendInformation($chatMessage);
@ -238,6 +228,10 @@ class PlayerActions {
$target = $this->maniaControl->playerManager->getPlayer($targetLogin); $target = $this->maniaControl->playerManager->getPlayer($targetLogin);
if(!$target){
return;
}
$this->maniaControl->client->ignore($targetLogin); $this->maniaControl->client->ignore($targetLogin);
$title = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel); $title = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel);
@ -258,7 +252,9 @@ class PlayerActions {
$this->maniaControl->authenticationManager->sendNotAllowed($admin); $this->maniaControl->authenticationManager->sendNotAllowed($admin);
return; return;
} }
$target = $this->maniaControl->playerManager->getPlayer($targetLogin); $target = $this->maniaControl->playerManager->getPlayer($targetLogin);
if(!$target) { if(!$target) {
return; return;
} }