diff --git a/core/Commands/CommandManager.php b/core/Commands/CommandManager.php index 2fc1219e..311cb5a7 100644 --- a/core/Commands/CommandManager.php +++ b/core/Commands/CommandManager.php @@ -352,7 +352,12 @@ class CommandManager implements CallbackListener, UsageInformationAble { if (!$this->isCommandEnabled($command, $isAdminCommand)) { $prefix = $isAdminCommand ? '//' : '/'; - $this->maniaControl->getChat()->sendError('The command $<$fff'.$prefix.$command.'$> is currently disabled!', $player); + $message = $this->maniaControl->getChat()->formatMessage( + 'The command %s%s is currently disabled!', + $prefix, + $command + ); + $this->maniaControl->getChat()->sendError($message, $player); return; } diff --git a/core/Commands/HelpManager.php b/core/Commands/HelpManager.php index 4706f542..08fb768f 100644 --- a/core/Commands/HelpManager.php +++ b/core/Commands/HelpManager.php @@ -53,7 +53,7 @@ class HelpManager implements CommandListener, CallbackListener, ManialinkPageAns $this->maniaControl->getActionsMenu()->addMenuItem($itemQuad, true, 0, 'Available commands'); $itemQuad = clone $itemQuad; $itemQuad->setAction(self::ACTION_OPEN_ADMIN_HELP_ALL); - $this->maniaControl->getActionsMenu()->addAdminMenuItem($itemQuad,0,'Available admin commands'); + $this->maniaControl->getActionsMenu()->addAdminMenuItem($itemQuad, 0, 'Available admin commands'); // Callbacks $this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit'); @@ -79,9 +79,13 @@ class HelpManager implements CommandListener, CallbackListener, ManialinkPageAns // Parse list from array $message = $this->parseHelpList($this->adminCommands); - // Show message when it's not empty - if ($message != null) { - $message = 'Supported Admin Commands: ' . $message; + if ($message === null) { + $this->maniaControl->getChat()->sendError('No Admin Commands supported!', $player); + } else { + $message = $this->maniaControl->getChat()->formatMessage( + 'Supported Admin Commands: %s', + $message + ); $this->maniaControl->getChat()->sendChat($message, $player); } } @@ -96,13 +100,27 @@ class HelpManager implements CommandListener, CallbackListener, ManialinkPageAns // Parse list from array $message = $this->parseHelpList($this->playerCommands); - // Show message when it's not empty - if ($message != null) { - $message = 'Supported Player Commands: ' . $message; + if ($message === null) { + $this->maniaControl->getChat()->sendError('No Player Commands supported!', $player); + } else { + $message = $this->maniaControl->getChat()->formatMessage( + 'Supported Player Commands: %s', + $message + ); $this->maniaControl->getChat()->sendChat($message, $player); } } + /** + * Show a ManiaLink list of Admin Commands + * + * @param array $chatCallback + * @param Player $player + */ + public function command_adminHelpAll(array $chatCallback, Player $player) { + $this->parseHelpList($this->adminCommands, true, $player); + } + /** * Show a ManiaLink list of Player Commands * @@ -120,8 +138,8 @@ class HelpManager implements CommandListener, CallbackListener, ManialinkPageAns * @param \ManiaControl\Players\Player $player * @internal */ - public function maniaLink_helpAll(array $callback, Player $player) { - $this->parseHelpList($this->playerCommands, true, $player); + public function maniaLink_adminHelpAll(array $callback, Player $player){ + $this->parseHelpList($this->adminCommands,true, $player); } /** @@ -131,8 +149,8 @@ class HelpManager implements CommandListener, CallbackListener, ManialinkPageAns * @param \ManiaControl\Players\Player $player * @internal */ - public function maniaLink_adminHelpAll(array $callback, Player $player){ - $this->parseHelpList($this->adminCommands,true, $player); + public function maniaLink_helpAll(array $callback, Player $player) { + $this->parseHelpList($this->playerCommands, true, $player); } /** @@ -185,7 +203,7 @@ class HelpManager implements CommandListener, CallbackListener, ManialinkPageAns * @param array $commands * @param mixed $player */ - public function showHelpAllList(array $commands, $player) { + public function showHelpAllList(array $commands, $player) { $width = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsWidth(); $height = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight(); @@ -254,16 +272,6 @@ class HelpManager implements CommandListener, CallbackListener, ManialinkPageAns $this->maniaControl->getManialinkManager()->displayWidget($maniaLink, $player, 'HelpAllList'); } - /** - * Show a ManiaLink list of Admin Commands - * - * @param array $chatCallback - * @param Player $player - */ - public function command_adminHelpAll(array $chatCallback, Player $player) { - $this->parseHelpList($this->adminCommands, true, $player); - } - /** * Register a new Command *