From 843467072d20a9ac9004593fc12dce9539302785 Mon Sep 17 00:00:00 2001 From: kremsy Date: Mon, 21 Apr 2014 23:14:06 +0200 Subject: [PATCH] exception fix --- .../Maniaplanet/DedicatedServer/Xmlrpc/FaultException.php | 5 +++++ application/core/ManiaControl.php | 1 - application/core/Maps/MapManager.php | 7 ++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/application/core/Libs/Maniaplanet/DedicatedServer/Xmlrpc/FaultException.php b/application/core/Libs/Maniaplanet/DedicatedServer/Xmlrpc/FaultException.php index 936fd5df..88d19263 100644 --- a/application/core/Libs/Maniaplanet/DedicatedServer/Xmlrpc/FaultException.php +++ b/application/core/Libs/Maniaplanet/DedicatedServer/Xmlrpc/FaultException.php @@ -24,9 +24,12 @@ class FaultException extends Exception case 'Change in progress.': return new ChangeInProgressException($faultString, $faultCode); case 'The player is not a spectator': + case 'The player is not a spectator.': return new PlayerIsNotSpectatorException($faultString, $faultCode); case 'Not in Team mode.': return new NotInTeamModeException($faultString, $faultCode); + case 'The map isn\'t in the current selection.': + return new MapNotInCurrentSelectionException($faultString, $faultCode); } return new self($faultString, $faultCode); @@ -40,4 +43,6 @@ class NotInScriptModeException extends FaultException {} class ChangeInProgressException extends FaultException {} class PlayerIsNotSpectatorException extends FaultException {} class NotInTeamModeException extends FaultException {} +class MapNotInCurrentSelectionException extends FaultException{} + ?> diff --git a/application/core/ManiaControl.php b/application/core/ManiaControl.php index 12629766..a78fb60d 100644 --- a/application/core/ManiaControl.php +++ b/application/core/ManiaControl.php @@ -23,7 +23,6 @@ use ManiaControl\Settings\SettingManager; use ManiaControl\Statistics\StatisticManager; use ManiaControl\Update\UpdateManager; use Maniaplanet\DedicatedServer\Connection; -use Maniaplanet\DedicatedServer\Transport\TransportException; use Maniaplanet\DedicatedServer\Xmlrpc\Exception; use Maniaplanet\DedicatedServer\Xmlrpc\NotInScriptModeException; diff --git a/application/core/Maps/MapManager.php b/application/core/Maps/MapManager.php index 8d21d8e5..58896cc3 100644 --- a/application/core/Maps/MapManager.php +++ b/application/core/Maps/MapManager.php @@ -14,6 +14,7 @@ use ManiaControl\Players\Player; use Maniaplanet\DedicatedServer\InvalidArgumentException; use Maniaplanet\DedicatedServer\Xmlrpc\CouldNotWritePlaylistFileException; use Maniaplanet\DedicatedServer\Xmlrpc\Exception; +use Maniaplanet\DedicatedServer\Xmlrpc\MapNotInCurrentSelectionException; use Maniaplanet\DedicatedServer\Xmlrpc\StartIndexOutOfBoundException; /** @@ -238,7 +239,11 @@ class MapManager implements CallbackListener { } // Remove map - $this->maniaControl->client->removeMap($map->fileName); + try{ + $this->maniaControl->client->removeMap($map->fileName); + }catch(MapNotInCurrentSelectionException $e){ + } + if ($eraseFile) { // Check if ManiaControl can even write to the maps dir