found new exception
This commit is contained in:
parent
fc7b1bdade
commit
cf0555f422
@ -4,6 +4,7 @@ namespace ManiaControl\Server;
|
||||
|
||||
use ManiaControl\Logger;
|
||||
use ManiaControl\ManiaControl;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
|
||||
|
||||
/**
|
||||
* Manager for Game Mode Script related Stuff
|
||||
@ -39,13 +40,18 @@ class ScriptManager {
|
||||
if (!$this->isScriptMode()) {
|
||||
return false;
|
||||
}
|
||||
$scriptSettings = $this->maniaControl->getClient()->getModeScriptSettings();
|
||||
|
||||
try {
|
||||
$scriptSettings = $this->maniaControl->getClient()->getModeScriptSettings();
|
||||
} catch (GameModeException $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!array_key_exists('S_UseScriptCallbacks', $scriptSettings)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$scriptSettings['S_UseScriptCallbacks'] = (bool)$enable;
|
||||
$scriptSettings['S_UseScriptCallbacks'] = (bool) $enable;
|
||||
$actionName = ($enable ? 'en' : 'dis');
|
||||
|
||||
$this->maniaControl->getClient()->setModeScriptSettings($scriptSettings);
|
||||
|
@ -7,12 +7,9 @@
|
||||
|
||||
namespace Maniaplanet\DedicatedServer\Xmlrpc;
|
||||
|
||||
class FaultException extends Exception
|
||||
{
|
||||
static function create($faultString, $faultCode)
|
||||
{
|
||||
switch($faultString)
|
||||
{
|
||||
class FaultException extends Exception {
|
||||
static function create($faultString, $faultCode) {
|
||||
switch ($faultString) {
|
||||
case 'Password incorrect.':
|
||||
case 'Permission denied.':
|
||||
return new AuthenticationException($faultString, $faultCode);
|
||||
@ -81,6 +78,7 @@ class FaultException extends Exception
|
||||
case 'Not in Team mode.':
|
||||
case 'Not in Rounds or Laps mode.':
|
||||
case 'The scores must be decreasing.':
|
||||
case 'No current script.':
|
||||
return new GameModeException($faultString, $faultCode);
|
||||
case 'Unable to write the black list file.':
|
||||
case 'Unable to write the guest list file.':
|
||||
@ -92,26 +90,55 @@ class FaultException extends Exception
|
||||
case 'Invalid url.':
|
||||
return new FileException($faultString, $faultCode);
|
||||
}
|
||||
if(preg_match('~^Unknown setting \'.*\'\.$~iu', $faultString))
|
||||
if (preg_match('~^Unknown setting \'.*\'\.$~iu', $faultString)) {
|
||||
return new GameModeException($faultString, $faultCode);
|
||||
if(preg_match('~^Couldn\'t load \'.*\'\.$~iu', $faultString))
|
||||
}
|
||||
if (preg_match('~^Couldn\'t load \'.*\'\.$~iu', $faultString)) {
|
||||
return new FileException($faultString, $faultCode);
|
||||
}
|
||||
|
||||
return new self($faultString, $faultCode);
|
||||
}
|
||||
}
|
||||
|
||||
class AuthenticationException extends FaultException {}
|
||||
class UnavailableFeatureException extends FaultException {}
|
||||
class LockedFeatureException extends FaultException {}
|
||||
class UnknownPlayerException extends FaultException {}
|
||||
class PlayerStateException extends FaultException {}
|
||||
class AlreadyInListException extends FaultException {}
|
||||
class NotInListException extends FaultException {}
|
||||
class IndexOutOfBoundException extends FaultException {}
|
||||
class NextMapException extends FaultException{}
|
||||
class ChangeInProgressException extends FaultException {}
|
||||
class InvalidMapException extends FaultException{}
|
||||
class GameModeException extends FaultException {}
|
||||
class ServerOptionsException extends FaultException {}
|
||||
class FileException extends FaultException {}
|
||||
class AuthenticationException extends FaultException {
|
||||
}
|
||||
|
||||
class UnavailableFeatureException extends FaultException {
|
||||
}
|
||||
|
||||
class LockedFeatureException extends FaultException {
|
||||
}
|
||||
|
||||
class UnknownPlayerException extends FaultException {
|
||||
}
|
||||
|
||||
class PlayerStateException extends FaultException {
|
||||
}
|
||||
|
||||
class AlreadyInListException extends FaultException {
|
||||
}
|
||||
|
||||
class NotInListException extends FaultException {
|
||||
}
|
||||
|
||||
class IndexOutOfBoundException extends FaultException {
|
||||
}
|
||||
|
||||
class NextMapException extends FaultException {
|
||||
}
|
||||
|
||||
class ChangeInProgressException extends FaultException {
|
||||
}
|
||||
|
||||
class InvalidMapException extends FaultException {
|
||||
}
|
||||
|
||||
class GameModeException extends FaultException {
|
||||
}
|
||||
|
||||
class ServerOptionsException extends FaultException {
|
||||
}
|
||||
|
||||
class FileException extends FaultException {
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user