List command aliases in /help <commandName>

This commit is contained in:
Dylan K. Taylor
2022-04-10 21:32:46 +01:00
parent e388cb1643
commit 3353a00641
5 changed files with 21 additions and 9 deletions

View File

@ -105,7 +105,7 @@ class HelpCommand extends VanillaCommand{
$lang = $sender->getLanguage();
$description = $cmd->getDescription();
$descriptionString = $description instanceof Translatable ? $lang->translate($description) : $description;
$sender->sendMessage(KnownTranslationFactory::pocketmine_command_help_specificCommand_header($commandName)
$sender->sendMessage(KnownTranslationFactory::pocketmine_command_help_specificCommand_header($cmd->getName())
->format(TextFormat::YELLOW . "--------- " . TextFormat::WHITE, TextFormat::YELLOW . " ---------"));
$sender->sendMessage(KnownTranslationFactory::pocketmine_command_help_specificCommand_description(TextFormat::WHITE . $descriptionString)
->prefix(TextFormat::GOLD));
@ -115,6 +115,11 @@ class HelpCommand extends VanillaCommand{
$sender->sendMessage(KnownTranslationFactory::pocketmine_command_help_specificCommand_usage(TextFormat::WHITE . implode("\n" . TextFormat::WHITE, explode("\n", $usageString)))
->prefix(TextFormat::GOLD));
$aliases = $cmd->getAliases();
sort($aliases, SORT_NATURAL);
$sender->sendMessage(KnownTranslationFactory::pocketmine_command_help_specificCommand_aliases(TextFormat::WHITE . implode(", ", $aliases))
->prefix(TextFormat::GOLD));
return true;
}
}