added ignore exception

This commit is contained in:
kremsy 2014-04-24 10:33:47 +02:00 committed by Steffen Schröder
parent 49cc059e66
commit 594694368b
2 changed files with 11 additions and 1 deletions

View File

@ -26,6 +26,10 @@ class FaultException extends Exception
case 'The player is not a spectator': case 'The player is not a spectator':
case 'The player is not a spectator.': case 'The player is not a spectator.':
return new PlayerIsNotSpectatorException($faultString, $faultCode); return new PlayerIsNotSpectatorException($faultString, $faultCode);
case 'Player already ignored.':
return new PlayerAlreadyIgnoredException($faultString, $faultCode);
case 'Player not ignored.':
return new PlayerNotIgnoredException($faultString, $faultCode);
case 'Not in Team mode.': case 'Not in Team mode.':
return new NotInTeamModeException($faultString, $faultCode); return new NotInTeamModeException($faultString, $faultCode);
case 'The map isn\'t in the current selection.': case 'The map isn\'t in the current selection.':
@ -51,5 +55,7 @@ class NotInTeamModeException extends FaultException {}
class MapNotInCurrentSelectionException extends FaultException{} class MapNotInCurrentSelectionException extends FaultException{}
class MapNotCompatibleOrCompleteException extends FaultException{} class MapNotCompatibleOrCompleteException extends FaultException{}
class LadderModeUnknownException extends FaultException{} class LadderModeUnknownException extends FaultException{}
class PlayerAlreadyIgnoredException extends FaultException{}
class PlayerNotIgnoredException extends FaultException{}
?> ?>

View File

@ -13,6 +13,7 @@ use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\ManialinkManager; use ManiaControl\Manialinks\ManialinkManager;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception; use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
use Maniaplanet\DedicatedServer\Xmlrpc\NotInTeamModeException; use Maniaplanet\DedicatedServer\Xmlrpc\NotInTeamModeException;
use Maniaplanet\DedicatedServer\Xmlrpc\PlayerAlreadyIgnoredException;
use Maniaplanet\DedicatedServer\Xmlrpc\PlayerIsNotSpectatorException; use Maniaplanet\DedicatedServer\Xmlrpc\PlayerIsNotSpectatorException;
/** /**
@ -242,7 +243,10 @@ class PlayerActions {
return; return;
} }
try{
$this->maniaControl->client->ignore($targetLogin); $this->maniaControl->client->ignore($targetLogin);
}catch(PlayerAlreadyIgnoredException $e){
}
$title = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel); $title = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel);
$chatMessage = $title . ' $<' . $admin->nickname . '$> muted $<' . $target->nickname . '$>!'; $chatMessage = $title . ' $<' . $admin->nickname . '$> muted $<' . $target->nickname . '$>!';