From 28cfee646ada25fd199ca537992255a7ef86ac0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Sun, 3 Aug 2014 13:06:43 +0200 Subject: [PATCH] fixed exceptions --- application/core/Maps/MapList.php | 7 ++++++- application/core/Maps/MapQueue.php | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/application/core/Maps/MapList.php b/application/core/Maps/MapList.php index 6b336af1..71b26828 100644 --- a/application/core/Maps/MapList.php +++ b/application/core/Maps/MapList.php @@ -24,6 +24,7 @@ use ManiaControl\Players\Player; use ManiaControl\Utils\ColorUtil; use ManiaControl\Utils\Formatter; use Maniaplanet\DedicatedServer\Xmlrpc\ChangeInProgressException; +use Maniaplanet\DedicatedServer\Xmlrpc\FileException; use Maniaplanet\DedicatedServer\Xmlrpc\NextMapException; use Maniaplanet\DedicatedServer\Xmlrpc\NotInListException; use MCTeam\CustomVotesPlugin; @@ -629,7 +630,11 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $this->showMapList($player); break; case self::ACTION_REMOVE_MAP: - $this->maniaControl->getMapManager()->removeMap($player, $mapUid); + try { + $this->maniaControl->getMapManager()->removeMap($player, $mapUid); + } catch (FileException $e) { + $this->maniaControl->getChat()->sendException($e, $player); + } break; case self::ACTION_SWITCH_MAP: // Don't queue on Map-Change diff --git a/application/core/Maps/MapQueue.php b/application/core/Maps/MapQueue.php index 2dfb0ef0..a9f2d690 100644 --- a/application/core/Maps/MapQueue.php +++ b/application/core/Maps/MapQueue.php @@ -10,6 +10,7 @@ use ManiaControl\ManiaControl; use ManiaControl\Players\Player; use ManiaControl\Utils\Formatter; use Maniaplanet\DedicatedServer\Xmlrpc\NextMapException; +use Maniaplanet\DedicatedServer\Xmlrpc\NotInListException; /** * ManiaControl Map Queue Class @@ -334,7 +335,7 @@ class MapQueue implements CallbackListener, CommandListener { break; } - //found player, so play this map + // Player found, so play this map if ($this->maniaControl->getPlayerManager()->getPlayer($player->login)) { break; } @@ -349,7 +350,7 @@ class MapQueue implements CallbackListener, CommandListener { // Trigger callback $this->maniaControl->getCallbackManager()->triggerCallback(self::CB_MAPQUEUE_CHANGED, array('skip', $queuedMap[0])); - //Player not found, so remove the map from the mapqueue + // Player not found, so remove the map from the mapqueue array_shift($this->queuedMaps); $this->maniaControl->getChat()->sendInformation('$fa0$<$fff' . $queuedMap[0]->name . '$> is skipped because $<' . $player->nickname . '$> left the game!'); @@ -369,6 +370,7 @@ class MapQueue implements CallbackListener, CommandListener { try { $this->maniaControl->getClient()->setNextMapIdent($map->uid); } catch (NextMapException $e) { + } catch (NotInListException $e) { } }