Added descriptions to commands.

This commit is contained in:
Max Klaversma 2014-05-01 01:41:19 +02:00 committed by Steffen Schröder
parent 490c9b81af
commit d2021d689e
12 changed files with 217 additions and 67 deletions

View File

@ -28,9 +28,9 @@ class AuthCommands implements CommandListener {
$this->maniaControl = $maniaControl; $this->maniaControl = $maniaControl;
// Register for commands // Register for commands
$this->maniaControl->commandManager->registerCommandListener('addsuperadmin', $this, 'command_AddSuperAdmin',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); $this->maniaControl->commandManager->registerCommandListener('addadmin', $this, 'command_AddAdmin',true, 'Adds player to adminlist as Admin.');
$this->maniaControl->commandManager->registerCommandListener('addmod', $this, 'command_AddModerator',true); $this->maniaControl->commandManager->registerCommandListener('addmod', $this, 'command_AddModerator',true, 'Add player to adminlist as Moderator.');
} }
/** /**

View File

@ -44,13 +44,14 @@ class CommandManager implements CallbackListener {
* @param CommandListener $listener * @param CommandListener $listener
* @param string $method * @param string $method
* @param bool $adminCommand * @param bool $adminCommand
* @param string $description
* @return bool * @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)) { if (is_array($commandName)) {
$success = true; $success = true;
foreach($commandName as $command) { foreach($commandName as $command) {
if (!$this->registerCommandListener($command, $listener, $method, $adminCommand)) { if (!$this->registerCommandListener($command, $listener, $method, $adminCommand, $description)) {
$success = false; $success = false;
} }
} }
@ -78,7 +79,7 @@ class CommandManager implements CallbackListener {
} }
//TODO description //TODO description
$this->helpManager->registerCommand($command, $adminCommand, ''); $this->helpManager->registerCommand($command, $adminCommand, $description, get_class($listener) . '\\' . $method);
return true; return true;
} }

View File

@ -2,8 +2,14 @@
namespace ManiaControl\Commands; 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\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Manialinks\ManialinkManager;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
@ -39,8 +45,10 @@ class HelpManager implements CommandListener, CallbackListener {
*/ */
public function handleOnInit() { public function handleOnInit() {
//Register the help command //Register the help command
$this->maniaControl->commandManager->registerCommandListener('help', $this, 'command_playerHelp', false); $this->maniaControl->commandManager->registerCommandListener('help', $this, 'command_playerHelp', false, 'Shows all commands in chat.');
$this->maniaControl->commandManager->registerCommandListener('help', $this, 'command_adminHelp', true); $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 * @param Player $player
*/ */
public function command_adminHelp(array $chat, Player $player) { public function command_adminHelp(array $chat, Player $player) {
//TODO only show first command in command arrays $showCommands = array();
$message = 'Supported Admin Commands: '; $registeredMethods = array();
foreach(array_reverse($this->adminCommands) as $command) { 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 .= $command['Name'] . ',';
} }
$message = substr($message, 0, -1); $message = substr($message, 0, -1);
@ -66,27 +89,159 @@ class HelpManager implements CommandListener, CallbackListener {
* @param Player $player * @param Player $player
*/ */
public function command_playerHelp(array $chat, Player $player) { public function command_playerHelp(array $chat, Player $player) {
//TODO only show first command in command arrays $showCommands = array();
$message = 'Supported Player Commands: '; $registeredMethods = array();
foreach(array_reverse($this->playerCommands) as $command) { 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 .= $command['Name'] . ',';
} }
$message = substr($message, 0, -1); $message = substr($message, 0, -1);
$this->maniaControl->chat->sendChat($message, $player->login); $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 * Registers a new Command
* *
* @param $name * @param $name
* @param $adminCommand * @param bool $adminCommand
* @param $description * @param string $description
* @param $method
*/ */
public function registerCommand($name, $adminCommand = false, $description = '') { public function registerCommand($name, $adminCommand = false, $description = '', $method) {
if($adminCommand) { if($adminCommand) {
array_push($this->adminCommands, array("Name" => $name, "Description" => $description)); array_push($this->adminCommands, array("Name" => $name, "Description" => $description, "Method" => $method));
} else { } else {
array_push($this->playerCommands, array("Name" => $name, "Description" => $description)); array_push($this->playerCommands, array("Name" => $name, "Description" => $description, "Method" => $method));
} }
} }
} }

View File

@ -96,7 +96,7 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
$this->addMenu($this->maniaControlSettings); $this->addMenu($this->maniaControlSettings);
// Register for commands // Register for commands
$this->maniaControl->commandManager->registerCommandListener('config', $this, 'handleConfigCommand', true); $this->maniaControl->commandManager->registerCommandListener('config', $this, 'handleConfigCommand', true, 'Loads Config panel.');
} }
/** /**

View File

@ -124,9 +124,9 @@ class ManiaControl implements CommandListener, TimerListener {
$this->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_RESTART, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); $this->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_RESTART, AuthenticationManager::AUTH_LEVEL_SUPERADMIN);
// Register for commands // Register for commands
$this->commandManager->registerCommandListener('version', $this, 'command_Version'); $this->commandManager->registerCommandListener('version', $this, 'command_Version', false, 'Shows ManiaControl version.');
$this->commandManager->registerCommandListener('restart', $this, 'command_Restart', true); $this->commandManager->registerCommandListener('restart', $this, 'command_Restart', true, 'Restarts ManiaControl.');
$this->commandManager->registerCommandListener('shutdown', $this, 'command_Shutdown', true); $this->commandManager->registerCommandListener('shutdown', $this, 'command_Shutdown', true, 'Shuts ManiaControl down.');
//Check connection every 30 seconds //Check connection every 30 seconds
$this->timerManager->registerTimerListening($this, 'checkConnection', 1000 * 30); $this->timerManager->registerTimerListening($this, 'checkConnection', 1000 * 30);

View File

@ -47,19 +47,19 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
$this->initActionsMenuButtons(); $this->initActionsMenuButtons();
// Register for admin chat commands // Register for admin chat commands
$this->maniaControl->commandManager->registerCommandListener(array('nextmap', 'next', 'skip'), $this, 'command_NextMap', 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); $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); $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); $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); $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); $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); $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); $this->maniaControl->commandManager->registerCommandListener(array('readmaplist', 'rml'), $this, 'command_ReadMapList', true, 'Loads a maplist into the server.');
// Register for player chat commands // Register for player chat commands
$this->maniaControl->commandManager->registerCommandListener('nextmap', $this, 'command_showNextMap'); $this->maniaControl->commandManager->registerCommandListener('nextmap', $this, 'command_showNextMap', false, 'Shows which map is next.');
$this->maniaControl->commandManager->registerCommandListener(array('maps', 'list'), $this, 'command_List'); $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'); $this->maniaControl->commandManager->registerCommandListener(array('xmaps', 'xlist'), $this, 'command_xList', false, 'Shows maps from ManiaExchange.');
// Menu Buttons // Menu Buttons
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_XLIST, $this, 'command_xList'); $this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_XLIST, $this, 'command_xList');

View File

@ -66,9 +66,9 @@ class MapQueue implements CallbackListener, CommandListener {
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_QUEUE_BUFFER, AuthenticationManager::AUTH_LEVEL_ADMIN); $this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_QUEUE_BUFFER, AuthenticationManager::AUTH_LEVEL_ADMIN);
//Register Admin Commands //Register Admin Commands
$this->maniaControl->commandManager->registerCommandListener(self::ADMIN_COMMAND_CLEAR_JUKEBOX, $this, 'command_ClearMapQueue', true); $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); $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'); $this->maniaControl->commandManager->registerCommandListener(array('jb', 'jukebox', 'mapqueue'), $this, 'command_MapQueue', false, 'Shows current maps in Map-Queue.');
} }
/** /**

View File

@ -42,26 +42,20 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
$this->maniaControl = $maniaControl; $this->maniaControl = $maniaControl;
// Register for admin commands // Register for admin commands
$this->maniaControl->commandManager->registerCommandListener('balance', $this, 'command_TeamBalance', true); $this->maniaControl->commandManager->registerCommandListener(array('balance', 'teambalance', 'autoteambalance'), $this, 'command_TeamBalance', true, 'Balances the teams.');
$this->maniaControl->commandManager->registerCommandListener('teambalance', $this, 'command_TeamBalance', true); $this->maniaControl->commandManager->registerCommandListener('kick', $this, 'command_Kick', true, 'Kicks player from the server.');
$this->maniaControl->commandManager->registerCommandListener('autoteambalance', $this, 'command_TeamBalance', true); $this->maniaControl->commandManager->registerCommandListener('ban', $this, 'command_Ban', true, 'Bans player from the server.');
$this->maniaControl->commandManager->registerCommandListener('kick', $this, 'command_Kick', true); $this->maniaControl->commandManager->registerCommandListener(array('forcespec', 'forcespectator'), $this, 'command_ForceSpectator', true, 'Forces player into spectator.');
$this->maniaControl->commandManager->registerCommandListener('ban', $this, 'command_Ban', true); $this->maniaControl->commandManager->registerCommandListener('forceplay', $this, 'command_ForcePlay', true, 'Forces player into playmode.');
$this->maniaControl->commandManager->registerCommandListener('forcespec', $this, 'command_ForceSpectator', true); $this->maniaControl->commandManager->registerCommandListener('forceblue', $this, 'command_ForceBlue', true, 'Forces player into blue team.');
$this->maniaControl->commandManager->registerCommandListener('forcespectator', $this, 'command_ForceSpectator', true); $this->maniaControl->commandManager->registerCommandListener('forcered', $this, 'command_ForceRed', true, 'Forces player into red team.');
$this->maniaControl->commandManager->registerCommandListener('forceplay', $this, 'command_ForcePlay', true); $this->maniaControl->commandManager->registerCommandListener(array('addbots', 'addbot'), $this, 'command_AddFakePlayers', true, 'Adds bots to the game.');
$this->maniaControl->commandManager->registerCommandListener('forceblue', $this, 'command_ForceBlue', true); $this->maniaControl->commandManager->registerCommandListener(array('removebot', 'removebots'), $this, 'command_RemoveFakePlayers', true, 'Removes bots from the game.');
$this->maniaControl->commandManager->registerCommandListener('forcered', $this, 'command_ForceRed', true); $this->maniaControl->commandManager->registerCommandListener('mute', $this, 'command_MutePlayer', true, 'Mutes a player (prevents player from chatting).');
$this->maniaControl->commandManager->registerCommandListener('addbot', $this, 'command_AddFakePlayers', true); $this->maniaControl->commandManager->registerCommandListener('unmute', $this, 'command_UnmutePlayer', true, 'Unmutes a player (enables player to chat again).');
$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);
// Register for player chat commands // Register for player chat commands
$this->maniaControl->commandManager->registerCommandListener('player', $this, 'command_playerList'); $this->maniaControl->commandManager->registerCommandListener(array('player', 'players'), $this, 'command_playerList', false, 'Shows players currently on the server.');
$this->maniaControl->commandManager->registerCommandListener('players', $this, 'command_playerList');
//Define Rights //Define Rights
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_ADD_BOT, AuthenticationManager::AUTH_LEVEL_MODERATOR); $this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_ADD_BOT, AuthenticationManager::AUTH_LEVEL_MODERATOR);

View File

@ -58,15 +58,15 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'handleOnInit'); $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'handleOnInit');
// Register for commands // Register for commands
$this->maniaControl->commandManager->registerCommandListener('setpwd', $this, 'command_SetPwd', true); $this->maniaControl->commandManager->registerCommandListener('setpwd', $this, 'command_SetPwd', true, 'Sets play password.');
$this->maniaControl->commandManager->registerCommandListener('setservername', $this, 'command_SetServerName', true); $this->maniaControl->commandManager->registerCommandListener('setservername', $this, 'command_SetServerName', true, 'Sets the servername.');
$this->maniaControl->commandManager->registerCommandListener('setmaxplayers', $this, 'command_SetMaxPlayers', true); $this->maniaControl->commandManager->registerCommandListener('setmaxplayers', $this, 'command_SetMaxPlayers', true, 'Sets the maximum number of players.');
$this->maniaControl->commandManager->registerCommandListener('setmaxspectators', $this, 'command_SetMaxSpectators', true); $this->maniaControl->commandManager->registerCommandListener('setmaxspectators', $this, 'command_SetMaxSpectators', true, 'Sets the maximum number of spectators.');
$this->maniaControl->commandManager->registerCommandListener('setspecpwd', $this, 'command_SetSpecPwd', true); $this->maniaControl->commandManager->registerCommandListener('setspecpwd', $this, 'command_SetSpecPwd', true, 'Sets spectator password.');
$this->maniaControl->commandManager->registerCommandListener('shutdownserver', $this, 'command_ShutdownServer', true); $this->maniaControl->commandManager->registerCommandListener('shutdownserver', $this, 'command_ShutdownServer', true, 'Shuts down the ManiaPlanet server.');
$this->maniaControl->commandManager->registerCommandListener('systeminfo', $this, 'command_SystemInfo', true); $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'); $this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_SET_PAUSE, $this, 'setPause');
} }

View File

@ -58,7 +58,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
* Add the menu entry * Add the menu entry
*/ */
public function handleOnInit() { 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 // Action Open StatsList
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_STATSLIST, $this, 'command_ShowStatsList'); $this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_STATSLIST, $this, 'command_ShowStatsList');

View File

@ -76,9 +76,9 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_UPDATECHECK, AuthenticationManager::AUTH_LEVEL_MODERATOR); $this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_UPDATECHECK, AuthenticationManager::AUTH_LEVEL_MODERATOR);
// Register for chat commands // Register for chat commands
$this->maniaControl->commandManager->registerCommandListener('checkupdate', $this, 'handle_CheckUpdate', 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); $this->maniaControl->commandManager->registerCommandListener('coreupdate', $this, 'handle_CoreUpdate', true, 'Performs the core update.');
$this->maniaControl->commandManager->registerCommandListener('pluginupdate', $this, 'handle_PluginUpdate', true); $this->maniaControl->commandManager->registerCommandListener('pluginupdate', $this, 'handle_PluginUpdate', true, 'Performs the plugin updates.');
$this->currentBuildDate = $this->getNightlyBuildDate(); $this->currentBuildDate = $this->getNightlyBuildDate();
} }

View File

@ -141,7 +141,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
$this->defineVote("replay", "Vote to replay current map"); $this->defineVote("replay", "Vote to replay current map");
foreach($this->voteCommands as $name => $voteCommand) { 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 */ /* Disable Standard Votes */