diff --git a/application/core/Admin/AuthCommands.php b/application/core/Admin/AuthCommands.php index 6dac2baa..2dccd93c 100644 --- a/application/core/Admin/AuthCommands.php +++ b/application/core/Admin/AuthCommands.php @@ -28,9 +28,9 @@ class AuthCommands implements CommandListener { $this->maniaControl = $maniaControl; // Register for commands - $this->maniaControl->commandManager->registerCommandListener('addsuperadmin', $this, 'command_AddSuperAdmin',true); - $this->maniaControl->commandManager->registerCommandListener('addadmin', $this, 'command_AddAdmin',true); - $this->maniaControl->commandManager->registerCommandListener('addmod', $this, 'command_AddModerator',true); + $this->maniaControl->commandManager->registerCommandListener('addsuperadmin', $this, 'command_AddSuperAdmin',true, 'Adds player to adminlist as SuperAdmin.'); + $this->maniaControl->commandManager->registerCommandListener('addadmin', $this, 'command_AddAdmin',true, 'Adds player to adminlist as Admin.'); + $this->maniaControl->commandManager->registerCommandListener('addmod', $this, 'command_AddModerator',true, 'Add player to adminlist as Moderator.'); } /** diff --git a/application/core/Commands/CommandManager.php b/application/core/Commands/CommandManager.php index b8f9a026..2632c624 100644 --- a/application/core/Commands/CommandManager.php +++ b/application/core/Commands/CommandManager.php @@ -44,13 +44,14 @@ class CommandManager implements CallbackListener { * @param CommandListener $listener * @param string $method * @param bool $adminCommand + * @param string $description * @return bool */ - public function registerCommandListener($commandName, CommandListener $listener, $method, $adminCommand = false) { + public function registerCommandListener($commandName, CommandListener $listener, $method, $adminCommand = false, $description = '') { if (is_array($commandName)) { $success = true; foreach($commandName as $command) { - if (!$this->registerCommandListener($command, $listener, $method, $adminCommand)) { + if (!$this->registerCommandListener($command, $listener, $method, $adminCommand, $description)) { $success = false; } } @@ -78,7 +79,7 @@ class CommandManager implements CallbackListener { } //TODO description - $this->helpManager->registerCommand($command, $adminCommand, ''); + $this->helpManager->registerCommand($command, $adminCommand, $description, get_class($listener) . '\\' . $method); return true; } diff --git a/application/core/Commands/HelpManager.php b/application/core/Commands/HelpManager.php index d53d7c32..dd4af35d 100644 --- a/application/core/Commands/HelpManager.php +++ b/application/core/Commands/HelpManager.php @@ -2,8 +2,14 @@ namespace ManiaControl\Commands; +use FML\Controls\Frame; +use FML\Controls\Quads\Quad_BgsPlayerCard; +use FML\ManiaLink; +use FML\Script\Features\Paging; + use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackManager; +use ManiaControl\Manialinks\ManialinkManager; use ManiaControl\ManiaControl; use ManiaControl\Players\Player; @@ -39,8 +45,10 @@ class HelpManager implements CommandListener, CallbackListener { */ public function handleOnInit() { //Register the help command - $this->maniaControl->commandManager->registerCommandListener('help', $this, 'command_playerHelp', false); - $this->maniaControl->commandManager->registerCommandListener('help', $this, 'command_adminHelp', true); + $this->maniaControl->commandManager->registerCommandListener('help', $this, 'command_playerHelp', false, 'Shows all commands in chat.'); + $this->maniaControl->commandManager->registerCommandListener('helpall', $this, 'command_playerHelpAll', false, 'Shows all commands in ManiaLink with description.'); + $this->maniaControl->commandManager->registerCommandListener('help', $this, 'command_adminHelp', true, 'Shows all admin commands in chat.'); + $this->maniaControl->commandManager->registerCommandListener('helpall', $this, 'command_adminHelpAll', true, 'Shows all admin commands in ManiaLink with description.'); } /** @@ -50,9 +58,24 @@ class HelpManager implements CommandListener, CallbackListener { * @param Player $player */ public function command_adminHelp(array $chat, Player $player) { - //TODO only show first command in command arrays - $message = 'Supported Admin Commands: '; + $showCommands = array(); + $registeredMethods = array(); foreach(array_reverse($this->adminCommands) as $command) { + if(array_key_exists($command['Method'], $registeredMethods) && $showCommands[$command['Method']]['Description'] == $command['Description']) { + $name = $registeredMethods[$command['Method']]; + $showCommands[$name]['Name'] .= '|'.$command['Name']; + } else { + $showCommands[$command['Name']] = $command; + $registeredMethods[$command['Method']] = $command['Name']; + } + } + + usort($showCommands, function($a, $b) { + return strcmp($a["Name"], $b["Name"]); + }); + + $message = 'Supported Admin Commands: '; + foreach($showCommands as $command) { $message .= $command['Name'] . ','; } $message = substr($message, 0, -1); @@ -66,27 +89,159 @@ class HelpManager implements CommandListener, CallbackListener { * @param Player $player */ public function command_playerHelp(array $chat, Player $player) { - //TODO only show first command in command arrays - $message = 'Supported Player Commands: '; + $showCommands = array(); + $registeredMethods = array(); foreach(array_reverse($this->playerCommands) as $command) { + if(array_key_exists($command['Method'], $registeredMethods) && $showCommands[$command['Method']]['Description'] == $command['Description']) { + $name = $registeredMethods[$command['Method']]; + $showCommands[$name]['Name'] .= '|'.$command['Name']; + } else { + $showCommands[$command['Name']] = $command; + $registeredMethods[$command['Method']] = $command['Name']; + } + } + + usort($showCommands, function($a, $b) { + return strcmp($a["Name"], $b["Name"]); + }); + + $message = 'Supported Player Commands: '; + foreach($showCommands as $command) { $message .= $command['Name'] . ','; } $message = substr($message, 0, -1); $this->maniaControl->chat->sendChat($message, $player->login); } + /** + * Shows a ManiaLink list of Player Commands + * + * @param array $chat + * @param Player $player + */ + public function command_playerHelpAll(array $chat, Player $player) { + $this->prepareHelpAll($this->playerCommands, $player); + } + + /** + * Shows a ManiaLink list of Admin Commands + * + * @param array $chat + * @param Player $player + */ + public function command_adminHelpAll(array $chat, Player $player) { + $this->prepareHelpAll($this->adminCommands, $player); + } + + private function prepareHelpAll($commands, $player) { + $showCommands = array(); + $registeredMethods = array(); + foreach(array_reverse($commands) as $command) { + if(array_key_exists($command['Method'], $registeredMethods)) { + if($showCommands[$registeredMethods[$command['Method']]]['Description'] == $command['Description']) { + $name = $registeredMethods[$command['Method']]; + $showCommands[$name]['Name'] .= '|'.$command['Name']; + } else { + $showCommands[$command['Name']] = $command; + $registeredMethods[$command['Method']] = $command['Name']; + } + } else { + $showCommands[$command['Name']] = $command; + $registeredMethods[$command['Method']] = $command['Name']; + } + } + + usort($showCommands, function($a, $b) { + return strcmp($a["Name"], $b["Name"]); + }); + + $this->showHelpAllList($showCommands, $player); + } + + private function showHelpAllList($commands, $player) { + $width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth(); + $height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight(); + + // create manialink + $maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); + $script = $maniaLink->getScript(); + $paging = new Paging(); + $script->addFeature($paging); + + // Main frame + $frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $paging); + $maniaLink->add($frame); + + // Start offsets + $x = -$width / 2; + $y = $height / 2; + + //Predefine description Label + $descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel(); + $frame->add($descriptionLabel); + + // Headline + $headFrame = new Frame(); + $frame->add($headFrame); + $headFrame->setY($y - 5); + $array = array("Command" => $x + 5, "Description" => $x + 50); + $this->maniaControl->manialinkManager->labelLine($headFrame, $array); + + $i = 1; + $y = $y - 10; + $pageFrames = array(); + foreach($commands as $command) { + if (!isset($pageFrame)) { + $pageFrame = new Frame(); + $frame->add($pageFrame); + if (!empty($pageFrames)) { + $pageFrame->setVisible(false); + } + array_push($pageFrames, $pageFrame); + $y = $height / 2 - 10; + $paging->addPage($pageFrame); + } + + $playerFrame = new Frame(); + $pageFrame->add($playerFrame); + $playerFrame->setY($y); + + if ($i % 2 != 0) { + $lineQuad = new Quad_BgsPlayerCard(); + $playerFrame->add($lineQuad); + $lineQuad->setSize($width, 4); + $lineQuad->setSubStyle($lineQuad::SUBSTYLE_BgPlayerCardBig); + $lineQuad->setZ(0.001); + } + + $array = array($command['Name'] => $x + 5, $command['Description'] => $x + 50); + $labels = $this->maniaControl->manialinkManager->labelLine($playerFrame, $array); + $labels[0]->setWidth(40); + + $y -= 4; + $i++; + if (($i - 1) % 15 == 0) { + unset($pageFrame); + } + } + + // Render and display xml + $this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, 'HelpAllList'); + } + /** * Registers a new Command * - * @param $name - * @param $adminCommand - * @param $description + * @param $name + * @param bool $adminCommand + * @param string $description + * @param $method */ - public function registerCommand($name, $adminCommand = false, $description = '') { + public function registerCommand($name, $adminCommand = false, $description = '', $method) { if($adminCommand) { - array_push($this->adminCommands, array("Name" => $name, "Description" => $description)); + array_push($this->adminCommands, array("Name" => $name, "Description" => $description, "Method" => $method)); } else { - array_push($this->playerCommands, array("Name" => $name, "Description" => $description)); + array_push($this->playerCommands, array("Name" => $name, "Description" => $description, "Method" => $method)); } } } diff --git a/application/core/Configurators/Configurator.php b/application/core/Configurators/Configurator.php index bba3322b..0c687225 100644 --- a/application/core/Configurators/Configurator.php +++ b/application/core/Configurators/Configurator.php @@ -96,7 +96,7 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn $this->addMenu($this->maniaControlSettings); // Register for commands - $this->maniaControl->commandManager->registerCommandListener('config', $this, 'handleConfigCommand', true); + $this->maniaControl->commandManager->registerCommandListener('config', $this, 'handleConfigCommand', true, 'Loads Config panel.'); } /** diff --git a/application/core/ManiaControl.php b/application/core/ManiaControl.php index 49c4c1ee..96036c80 100644 --- a/application/core/ManiaControl.php +++ b/application/core/ManiaControl.php @@ -124,9 +124,9 @@ class ManiaControl implements CommandListener, TimerListener { $this->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_RESTART, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); // Register for commands - $this->commandManager->registerCommandListener('version', $this, 'command_Version'); - $this->commandManager->registerCommandListener('restart', $this, 'command_Restart', true); - $this->commandManager->registerCommandListener('shutdown', $this, 'command_Shutdown', true); + $this->commandManager->registerCommandListener('version', $this, 'command_Version', false, 'Shows ManiaControl version.'); + $this->commandManager->registerCommandListener('restart', $this, 'command_Restart', true, 'Restarts ManiaControl.'); + $this->commandManager->registerCommandListener('shutdown', $this, 'command_Shutdown', true, 'Shuts ManiaControl down.'); //Check connection every 30 seconds $this->timerManager->registerTimerListening($this, 'checkConnection', 1000 * 30); diff --git a/application/core/Maps/MapCommands.php b/application/core/Maps/MapCommands.php index 8bf1589d..03a23b2c 100644 --- a/application/core/Maps/MapCommands.php +++ b/application/core/Maps/MapCommands.php @@ -47,19 +47,19 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb $this->initActionsMenuButtons(); // Register for admin chat commands - $this->maniaControl->commandManager->registerCommandListener(array('nextmap', 'next', 'skip'), $this, 'command_NextMap', true); - $this->maniaControl->commandManager->registerCommandListener(array('restartmap', 'resmap', 'res'), $this, 'command_RestartMap', true); - $this->maniaControl->commandManager->registerCommandListener(array('replaymap', 'replay'), $this, 'command_ReplayMap', true); - $this->maniaControl->commandManager->registerCommandListener(array('addmap', 'add'), $this, 'command_AddMap', true); - $this->maniaControl->commandManager->registerCommandListener(array('removemap', 'removethis', 'erasemap', 'erasethis'), $this, 'command_RemoveMap', true); - $this->maniaControl->commandManager->registerCommandListener(array('shufflemaps', 'shuffle'), $this, 'command_ShuffleMaps', true); - $this->maniaControl->commandManager->registerCommandListener(array('writemaplist', 'wml'), $this, 'command_WriteMapList', true); - $this->maniaControl->commandManager->registerCommandListener(array('readmaplist', 'rml'), $this, 'command_ReadMapList', true); + $this->maniaControl->commandManager->registerCommandListener(array('nextmap', 'next', 'skip'), $this, 'command_NextMap', true, 'Skips to the next map.'); + $this->maniaControl->commandManager->registerCommandListener(array('restartmap', 'resmap', 'res'), $this, 'command_RestartMap', true, 'Restarts the current map.'); + $this->maniaControl->commandManager->registerCommandListener(array('replaymap', 'replay'), $this, 'command_ReplayMap', true, 'Replays the current map (after the end of the map).'); + $this->maniaControl->commandManager->registerCommandListener(array('addmap', 'add'), $this, 'command_AddMap', true, 'Adds map from ManiaExchange.'); + $this->maniaControl->commandManager->registerCommandListener(array('removemap', 'removethis', 'erasemap', 'erasethis'), $this, 'command_RemoveMap', true, 'Removes the current map.'); + $this->maniaControl->commandManager->registerCommandListener(array('shufflemaps', 'shuffle'), $this, 'command_ShuffleMaps', true, 'Shuffles the maplist.'); + $this->maniaControl->commandManager->registerCommandListener(array('writemaplist', 'wml'), $this, 'command_WriteMapList', true, 'Writes the current maplist to a file.'); + $this->maniaControl->commandManager->registerCommandListener(array('readmaplist', 'rml'), $this, 'command_ReadMapList', true, 'Loads a maplist into the server.'); // Register for player chat commands - $this->maniaControl->commandManager->registerCommandListener('nextmap', $this, 'command_showNextMap'); - $this->maniaControl->commandManager->registerCommandListener(array('maps', 'list'), $this, 'command_List'); - $this->maniaControl->commandManager->registerCommandListener(array('xmaps', 'xlist'), $this, 'command_xList'); + $this->maniaControl->commandManager->registerCommandListener('nextmap', $this, 'command_showNextMap', false, 'Shows which map is next.'); + $this->maniaControl->commandManager->registerCommandListener(array('maps', 'list'), $this, 'command_List', false, 'Shows the current maplist (or variations).'); + $this->maniaControl->commandManager->registerCommandListener(array('xmaps', 'xlist'), $this, 'command_xList', false, 'Shows maps from ManiaExchange.'); // Menu Buttons $this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_XLIST, $this, 'command_xList'); diff --git a/application/core/Maps/MapQueue.php b/application/core/Maps/MapQueue.php index 6bb79195..81e93b75 100644 --- a/application/core/Maps/MapQueue.php +++ b/application/core/Maps/MapQueue.php @@ -66,9 +66,9 @@ class MapQueue implements CallbackListener, CommandListener { $this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_QUEUE_BUFFER, AuthenticationManager::AUTH_LEVEL_ADMIN); //Register Admin Commands - $this->maniaControl->commandManager->registerCommandListener(self::ADMIN_COMMAND_CLEAR_JUKEBOX, $this, 'command_ClearMapQueue', true); - $this->maniaControl->commandManager->registerCommandListener(self::ADMIN_COMMAND_CLEAR_MAPQUEUE, $this, 'command_ClearMapQueue', true); - $this->maniaControl->commandManager->registerCommandListener(array('jb', 'jukebox', 'mapqueue'), $this, 'command_MapQueue'); + $this->maniaControl->commandManager->registerCommandListener(self::ADMIN_COMMAND_CLEAR_JUKEBOX, $this, 'command_ClearMapQueue', true, 'Clears the Map-Queue.'); + $this->maniaControl->commandManager->registerCommandListener(self::ADMIN_COMMAND_CLEAR_MAPQUEUE, $this, 'command_ClearMapQueue', true, 'Clears the Map-Queue.'); + $this->maniaControl->commandManager->registerCommandListener(array('jb', 'jukebox', 'mapqueue'), $this, 'command_MapQueue', false, 'Shows current maps in Map-Queue.'); } /** diff --git a/application/core/Players/PlayerCommands.php b/application/core/Players/PlayerCommands.php index 8b57997d..93fcc185 100644 --- a/application/core/Players/PlayerCommands.php +++ b/application/core/Players/PlayerCommands.php @@ -42,26 +42,20 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca $this->maniaControl = $maniaControl; // Register for admin commands - $this->maniaControl->commandManager->registerCommandListener('balance', $this, 'command_TeamBalance', true); - $this->maniaControl->commandManager->registerCommandListener('teambalance', $this, 'command_TeamBalance', true); - $this->maniaControl->commandManager->registerCommandListener('autoteambalance', $this, 'command_TeamBalance', true); - $this->maniaControl->commandManager->registerCommandListener('kick', $this, 'command_Kick', true); - $this->maniaControl->commandManager->registerCommandListener('ban', $this, 'command_Ban', true); - $this->maniaControl->commandManager->registerCommandListener('forcespec', $this, 'command_ForceSpectator', true); - $this->maniaControl->commandManager->registerCommandListener('forcespectator', $this, 'command_ForceSpectator', true); - $this->maniaControl->commandManager->registerCommandListener('forceplay', $this, 'command_ForcePlay', true); - $this->maniaControl->commandManager->registerCommandListener('forceblue', $this, 'command_ForceBlue', true); - $this->maniaControl->commandManager->registerCommandListener('forcered', $this, 'command_ForceRed', true); - $this->maniaControl->commandManager->registerCommandListener('addbot', $this, 'command_AddFakePlayers', true); - $this->maniaControl->commandManager->registerCommandListener('removebot', $this, 'command_RemoveFakePlayers', true); - $this->maniaControl->commandManager->registerCommandListener('addbots', $this, 'command_AddFakePlayers', true); - $this->maniaControl->commandManager->registerCommandListener('removebots', $this, 'command_RemoveFakePlayers', true); - $this->maniaControl->commandManager->registerCommandListener('mute', $this, 'command_MutePlayer', true); - $this->maniaControl->commandManager->registerCommandListener('unmute', $this, 'command_UnmutePlayer', true); + $this->maniaControl->commandManager->registerCommandListener(array('balance', 'teambalance', 'autoteambalance'), $this, 'command_TeamBalance', true, 'Balances the teams.'); + $this->maniaControl->commandManager->registerCommandListener('kick', $this, 'command_Kick', true, 'Kicks player from the server.'); + $this->maniaControl->commandManager->registerCommandListener('ban', $this, 'command_Ban', true, 'Bans player from the server.'); + $this->maniaControl->commandManager->registerCommandListener(array('forcespec', 'forcespectator'), $this, 'command_ForceSpectator', true, 'Forces player into spectator.'); + $this->maniaControl->commandManager->registerCommandListener('forceplay', $this, 'command_ForcePlay', true, 'Forces player into playmode.'); + $this->maniaControl->commandManager->registerCommandListener('forceblue', $this, 'command_ForceBlue', true, 'Forces player into blue team.'); + $this->maniaControl->commandManager->registerCommandListener('forcered', $this, 'command_ForceRed', true, 'Forces player into red team.'); + $this->maniaControl->commandManager->registerCommandListener(array('addbots', 'addbot'), $this, 'command_AddFakePlayers', true, 'Adds bots to the game.'); + $this->maniaControl->commandManager->registerCommandListener(array('removebot', 'removebots'), $this, 'command_RemoveFakePlayers', true, 'Removes bots from the game.'); + $this->maniaControl->commandManager->registerCommandListener('mute', $this, 'command_MutePlayer', true, 'Mutes a player (prevents player from chatting).'); + $this->maniaControl->commandManager->registerCommandListener('unmute', $this, 'command_UnmutePlayer', true, 'Unmutes a player (enables player to chat again).'); // Register for player chat commands - $this->maniaControl->commandManager->registerCommandListener('player', $this, 'command_playerList'); - $this->maniaControl->commandManager->registerCommandListener('players', $this, 'command_playerList'); + $this->maniaControl->commandManager->registerCommandListener(array('player', 'players'), $this, 'command_playerList', false, 'Shows players currently on the server.'); //Define Rights $this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_ADD_BOT, AuthenticationManager::AUTH_LEVEL_MODERATOR); diff --git a/application/core/Server/ServerCommands.php b/application/core/Server/ServerCommands.php index 38ce8f9f..4eba6a2b 100644 --- a/application/core/Server/ServerCommands.php +++ b/application/core/Server/ServerCommands.php @@ -58,15 +58,15 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'handleOnInit'); // Register for commands - $this->maniaControl->commandManager->registerCommandListener('setpwd', $this, 'command_SetPwd', true); - $this->maniaControl->commandManager->registerCommandListener('setservername', $this, 'command_SetServerName', true); - $this->maniaControl->commandManager->registerCommandListener('setmaxplayers', $this, 'command_SetMaxPlayers', true); - $this->maniaControl->commandManager->registerCommandListener('setmaxspectators', $this, 'command_SetMaxSpectators', true); - $this->maniaControl->commandManager->registerCommandListener('setspecpwd', $this, 'command_SetSpecPwd', true); - $this->maniaControl->commandManager->registerCommandListener('shutdownserver', $this, 'command_ShutdownServer', true); - $this->maniaControl->commandManager->registerCommandListener('systeminfo', $this, 'command_SystemInfo', true); + $this->maniaControl->commandManager->registerCommandListener('setpwd', $this, 'command_SetPwd', true, 'Sets play password.'); + $this->maniaControl->commandManager->registerCommandListener('setservername', $this, 'command_SetServerName', true, 'Sets the servername.'); + $this->maniaControl->commandManager->registerCommandListener('setmaxplayers', $this, 'command_SetMaxPlayers', true, 'Sets the maximum number of players.'); + $this->maniaControl->commandManager->registerCommandListener('setmaxspectators', $this, 'command_SetMaxSpectators', true, 'Sets the maximum number of spectators.'); + $this->maniaControl->commandManager->registerCommandListener('setspecpwd', $this, 'command_SetSpecPwd', true, 'Sets spectator password.'); + $this->maniaControl->commandManager->registerCommandListener('shutdownserver', $this, 'command_ShutdownServer', true, 'Shuts down the ManiaPlanet server.'); + $this->maniaControl->commandManager->registerCommandListener('systeminfo', $this, 'command_SystemInfo', true, 'Shows system information.'); - $this->maniaControl->commandManager->registerCommandListener('cancel', $this, 'command_CancelVote', true); + $this->maniaControl->commandManager->registerCommandListener('cancel', $this, 'command_CancelVote', true, 'Cancels the current vote.'); $this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_SET_PAUSE, $this, 'setPause'); } diff --git a/application/core/Statistics/SimpleStatsList.php b/application/core/Statistics/SimpleStatsList.php index ff1506b6..44c7c961 100644 --- a/application/core/Statistics/SimpleStatsList.php +++ b/application/core/Statistics/SimpleStatsList.php @@ -58,7 +58,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, * Add the menu entry */ public function handleOnInit() { - $this->maniaControl->commandManager->registerCommandListener('stats', $this, 'command_ShowStatsList'); + $this->maniaControl->commandManager->registerCommandListener('stats', $this, 'command_ShowStatsList', false, 'Shows statistics.'); // Action Open StatsList $this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_STATSLIST, $this, 'command_ShowStatsList'); diff --git a/application/core/Update/UpdateManager.php b/application/core/Update/UpdateManager.php index a3d638ad..6a013644 100644 --- a/application/core/Update/UpdateManager.php +++ b/application/core/Update/UpdateManager.php @@ -76,9 +76,9 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener $this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_UPDATECHECK, AuthenticationManager::AUTH_LEVEL_MODERATOR); // Register for chat commands - $this->maniaControl->commandManager->registerCommandListener('checkupdate', $this, 'handle_CheckUpdate', true); - $this->maniaControl->commandManager->registerCommandListener('coreupdate', $this, 'handle_CoreUpdate', true); - $this->maniaControl->commandManager->registerCommandListener('pluginupdate', $this, 'handle_PluginUpdate', true); + $this->maniaControl->commandManager->registerCommandListener('checkupdate', $this, 'handle_CheckUpdate', true, 'Checks if there is a core update.'); + $this->maniaControl->commandManager->registerCommandListener('coreupdate', $this, 'handle_CoreUpdate', true, 'Performs the core update.'); + $this->maniaControl->commandManager->registerCommandListener('pluginupdate', $this, 'handle_PluginUpdate', true, 'Performs the plugin updates.'); $this->currentBuildDate = $this->getNightlyBuildDate(); } diff --git a/application/plugins/CustomVotes.php b/application/plugins/CustomVotes.php index 60b1031e..2a4b8f1e 100644 --- a/application/plugins/CustomVotes.php +++ b/application/plugins/CustomVotes.php @@ -141,7 +141,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP $this->defineVote("replay", "Vote to replay current map"); foreach($this->voteCommands as $name => $voteCommand) { - $this->maniaControl->commandManager->registerCommandListener($name, $this, 'handleChatVote'); + $this->maniaControl->commandManager->registerCommandListener($name, $this, 'handleChatVote', false, $voteCommand->name); } /* Disable Standard Votes */