exception fix
This commit is contained in:
parent
9dc1d6c91e
commit
fc60444a02
@ -25,6 +25,8 @@ class FaultException extends Exception
|
|||||||
return new ChangeInProgressException($faultString, $faultCode);
|
return new ChangeInProgressException($faultString, $faultCode);
|
||||||
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 'Not in Team mode.':
|
||||||
|
return new NotInTeamModeException($faultString, $faultCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new self($faultString, $faultCode);
|
return new self($faultString, $faultCode);
|
||||||
@ -37,4 +39,5 @@ class StartIndexOutOfBoundException extends FaultException {}
|
|||||||
class NotInScriptModeException extends FaultException {}
|
class NotInScriptModeException extends FaultException {}
|
||||||
class ChangeInProgressException extends FaultException {}
|
class ChangeInProgressException extends FaultException {}
|
||||||
class PlayerIsNotSpectatorException extends FaultException {}
|
class PlayerIsNotSpectatorException extends FaultException {}
|
||||||
|
class NotInTeamModeException extends FaultException {}
|
||||||
?>
|
?>
|
||||||
|
@ -12,6 +12,8 @@ use ManiaControl\Formatter;
|
|||||||
use ManiaControl\ManiaControl;
|
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\PlayerIsNotSpectatorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Player Actions Class
|
* Player Actions Class
|
||||||
@ -132,13 +134,9 @@ class PlayerActions {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->forcePlayerTeam($target->login, $teamId);
|
$this->maniaControl->client->forcePlayerTeam($target->login, $teamId);
|
||||||
} catch(Exception $e) {
|
} catch(NotInTeamModeException $e) {
|
||||||
if ($e->getMessage() == "Not in Team mode.") {
|
|
||||||
$this->forcePlayerToPlay($adminLogin, $targetLogin);
|
$this->forcePlayerToPlay($adminLogin, $targetLogin);
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$chatMessage = false;
|
$chatMessage = false;
|
||||||
@ -191,10 +189,7 @@ class PlayerActions {
|
|||||||
// Free player slot
|
// Free player slot
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->spectatorReleasePlayerSlot($target->login);
|
$this->maniaControl->client->spectatorReleasePlayerSlot($target->login);
|
||||||
} catch(Exception $e) {
|
} catch(PlayerIsNotSpectatorException $e) {
|
||||||
if($e->getMessage() != "The player is not a spectator"){
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user