exceptions spectator actions

This commit is contained in:
kremsy
2014-01-16 21:51:25 +01:00
committed by Steffen Schröder
parent 671c934f2b
commit e71b763075
2 changed files with 28 additions and 8 deletions

View File

@ -22,6 +22,8 @@ use ManiaControl\Formatter;
use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\ManialinkManager;
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
use Maniaplanet\DedicatedServer\InvalidArgumentException;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
/**
* PlayerList Widget Class
@ -593,7 +595,11 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
switch($action) {
case self::ACTION_SPECTATE_PLAYER:
$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
try {
$this->maniaControl->client->forceSpectatorTarget($adminLogin, $targetLogin, 1); //TODO mc crash player is not a spectator
} catch(Exception $e) {
//TODO error message from $e
}
break;
case self::ACTION_OPEN_PLAYER_DETAILED:
$player = $this->maniaControl->playerManager->getPlayer($adminLogin);