diff --git a/application/core/Maps/MapCommands.php b/application/core/Maps/MapCommands.php index 529c7092..511db66e 100644 --- a/application/core/Maps/MapCommands.php +++ b/application/core/Maps/MapCommands.php @@ -329,12 +329,36 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb $this->showMapListDate(true, $player); } elseif($chatCommands[1] == 'oldest') { $this->showMapListDate(false, $player); + } elseif($chatCommands[1] == 'author') { + if(isset($chatCommands[2])) { + $this->showMaplistAuthor($chatCommands[2], $player); + } else { + $this->maniaControl->chat->sendError('There are no maps to show!', $player->login); + } } } else { $this->maniaControl->mapManager->mapList->showMapList($player); } } + private function showMapListAuthor($author, $player) { + $maps = $this->maniaControl->mapManager->getMaps(); + $mapList = array(); + /** @var Map $map */ + foreach($maps as $map) { + if($map->authorLogin == $author) { + $mapList[] = $map; + } + } + + if(count($mapList) == 0) { + $this->maniaControl->chat->sendError('There are no maps to show!', $player->login); + return; + } + + $this->maniaControl->mapManager->mapList->showMapList($player, $mapList); + } + private function showMapListKarma($best, $player) { /** @var \MCTeam\KarmaPlugin $karmaPlugin */ $karmaPlugin = $this->maniaControl->pluginManager->getPlugin(MapList::DEFAULT_KARMA_PLUGIN);