use Chat::formatMessage in Commands-namespace
This commit is contained in:
parent
a311dcdbd9
commit
1d0215df52
@ -352,7 +352,12 @@ class CommandManager implements CallbackListener, UsageInformationAble {
|
|||||||
|
|
||||||
if (!$this->isCommandEnabled($command, $isAdminCommand)) {
|
if (!$this->isCommandEnabled($command, $isAdminCommand)) {
|
||||||
$prefix = $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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class HelpManager implements CommandListener, CallbackListener, ManialinkPageAns
|
|||||||
$this->maniaControl->getActionsMenu()->addMenuItem($itemQuad, true, 0, 'Available commands');
|
$this->maniaControl->getActionsMenu()->addMenuItem($itemQuad, true, 0, 'Available commands');
|
||||||
$itemQuad = clone $itemQuad;
|
$itemQuad = clone $itemQuad;
|
||||||
$itemQuad->setAction(self::ACTION_OPEN_ADMIN_HELP_ALL);
|
$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
|
// Callbacks
|
||||||
$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit');
|
$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit');
|
||||||
@ -79,9 +79,13 @@ class HelpManager implements CommandListener, CallbackListener, ManialinkPageAns
|
|||||||
// Parse list from array
|
// Parse list from array
|
||||||
$message = $this->parseHelpList($this->adminCommands);
|
$message = $this->parseHelpList($this->adminCommands);
|
||||||
|
|
||||||
// Show message when it's not empty
|
if ($message === null) {
|
||||||
if ($message != null) {
|
$this->maniaControl->getChat()->sendError('No Admin Commands supported!', $player);
|
||||||
$message = 'Supported Admin Commands: ' . $message;
|
} else {
|
||||||
|
$message = $this->maniaControl->getChat()->formatMessage(
|
||||||
|
'Supported Admin Commands: %s',
|
||||||
|
$message
|
||||||
|
);
|
||||||
$this->maniaControl->getChat()->sendChat($message, $player);
|
$this->maniaControl->getChat()->sendChat($message, $player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,13 +100,27 @@ class HelpManager implements CommandListener, CallbackListener, ManialinkPageAns
|
|||||||
// Parse list from array
|
// Parse list from array
|
||||||
$message = $this->parseHelpList($this->playerCommands);
|
$message = $this->parseHelpList($this->playerCommands);
|
||||||
|
|
||||||
// Show message when it's not empty
|
if ($message === null) {
|
||||||
if ($message != null) {
|
$this->maniaControl->getChat()->sendError('No Player Commands supported!', $player);
|
||||||
$message = 'Supported Player Commands: ' . $message;
|
} else {
|
||||||
|
$message = $this->maniaControl->getChat()->formatMessage(
|
||||||
|
'Supported Player Commands: %s',
|
||||||
|
$message
|
||||||
|
);
|
||||||
$this->maniaControl->getChat()->sendChat($message, $player);
|
$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
|
* Show a ManiaLink list of Player Commands
|
||||||
*
|
*
|
||||||
@ -120,8 +138,8 @@ class HelpManager implements CommandListener, CallbackListener, ManialinkPageAns
|
|||||||
* @param \ManiaControl\Players\Player $player
|
* @param \ManiaControl\Players\Player $player
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
public function maniaLink_helpAll(array $callback, Player $player) {
|
public function maniaLink_adminHelpAll(array $callback, Player $player){
|
||||||
$this->parseHelpList($this->playerCommands, true, $player);
|
$this->parseHelpList($this->adminCommands,true, $player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -131,8 +149,8 @@ class HelpManager implements CommandListener, CallbackListener, ManialinkPageAns
|
|||||||
* @param \ManiaControl\Players\Player $player
|
* @param \ManiaControl\Players\Player $player
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
public function maniaLink_adminHelpAll(array $callback, Player $player){
|
public function maniaLink_helpAll(array $callback, Player $player) {
|
||||||
$this->parseHelpList($this->adminCommands,true, $player);
|
$this->parseHelpList($this->playerCommands, true, $player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -254,16 +272,6 @@ class HelpManager implements CommandListener, CallbackListener, ManialinkPageAns
|
|||||||
$this->maniaControl->getManialinkManager()->displayWidget($maniaLink, $player, 'HelpAllList');
|
$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
|
* Register a new Command
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user