Fix #376 Check not to show alternatives for base command

- Fix wrong assumption in HelpCommand that the incoming arguments size always corresponds to the label count of the mapped command
This commit is contained in:
ljacqu 2015-12-24 15:46:48 +01:00
parent 3b33781b0b
commit 418fbabcc8
2 changed files with 3 additions and 2 deletions

View File

@ -43,8 +43,9 @@ public class HelpCommand extends ExecutableCommand {
}
}
int mappedCommandLevel = foundCommandResult.getCommandDescription().getLabelCount();
PermissionsManager permissionsManager = Wrapper.getInstance().getAuthMe().getPermissionsManager();
List<String> lines = arguments.size() == 1
List<String> lines = (mappedCommandLevel == 1)
? HelpProvider.printHelp(foundCommandResult, HelpProvider.SHOW_CHILDREN)
: HelpProvider.printHelp(foundCommandResult, sender, permissionsManager, HelpProvider.ALL_OPTIONS);
for (String line : lines) {

View File

@ -112,7 +112,7 @@ public final class HelpProvider {
private static void printAlternatives(CommandDescription command, List<String> correctLabels, List<String> lines) {
// TODO ljacqu 20151219: Need to show alternatives for base labels too? E.g. /r for /register
if (command.getLabels().size() <= 1) {
if (command.getLabels().size() <= 1 || correctLabels.size() <= 1) {
return;
}