From c28cb01f9e8065d2db02962172cbde8ce52f03ba Mon Sep 17 00:00:00 2001 From: kremsy Date: Fri, 10 Jan 2014 12:32:11 +0100 Subject: [PATCH] cleanup / improvements --- application/core/Maps/MapCommands.php | 7 +++---- application/core/Maps/MapManager.php | 7 ++++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/application/core/Maps/MapCommands.php b/application/core/Maps/MapCommands.php index 903f303a..f40e4d23 100644 --- a/application/core/Maps/MapCommands.php +++ b/application/core/Maps/MapCommands.php @@ -45,7 +45,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb $this->maniaControl->commandManager->registerCommandListener('nextmap', $this, 'command_NextMap', true); $this->maniaControl->commandManager->registerCommandListener('restartmap', $this, 'command_RestartMap', true); $this->maniaControl->commandManager->registerCommandListener('addmap', $this, 'command_AddMap', true); - $this->maniaControl->commandManager->registerCommandListener('removemap', $this, 'command_RemoveMap', true); + $this->maniaControl->commandManager->registerCommandListener(array('removemap', 'removethis', 'erasemap', 'erasethis'), $this, 'command_RemoveMap', true); // Register for player chat commands $this->maniaControl->commandManager->registerCommandListener(array('maps', 'list'), $this, 'command_List'); @@ -105,8 +105,8 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb $this->maniaControl->chat->sendError("Couldn't remove map.", $player->login); return; } - - $this->maniaControl->mapManager->removeMap($player, $map); + //RemoveMap + $this->maniaControl->mapManager->removeMap($player, $map->uid); } /** @@ -120,7 +120,6 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb $this->maniaControl->authenticationManager->sendNotAllowed($player); return; } - // TODO: Use MX fetcher $params = explode(' ', $chatCallback[1][2], 2); if(count($params) < 2) { $this->maniaControl->chat->sendUsageInfo('Usage example: //addmap 1234', $player->login); diff --git a/application/core/Maps/MapManager.php b/application/core/Maps/MapManager.php index 67b66940..55015092 100644 --- a/application/core/Maps/MapManager.php +++ b/application/core/Maps/MapManager.php @@ -150,8 +150,9 @@ class MapManager implements CallbackListener { return; } - $this->maniaControl->chat->sendSuccess('$<' . $admin->nickname . '$> removed $<' . $map->name . '$>'); - $this->maniaControl->log('$<' . $admin->nickname . '$> removed $<' . $map->name . '$>', true); + $message = '$<' . $admin->nickname . '$> removed $<' . $map->name . '$>!'; + $this->maniaControl->chat->sendSuccess($message); + $this->maniaControl->log($message, true); unset($this->maps[$uid]); } @@ -272,7 +273,7 @@ class MapManager implements CallbackListener { * @return array */ public function getMaps() { - return $this->maps; + return array_values($this->maps); } /**