mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-26 02:57:59 +01:00
Added 'commands.help.syntax-no-parameters' to avoid command help layout inconsistencies
Fixes #379
This commit is contained in:
parent
fa5c7905da
commit
8a16940e14
@ -22,6 +22,7 @@ public class DefaultHelpCommand extends CompositeCommand {
|
||||
private static final String PARAMS_PLACEHOLDER = "[parameters]";
|
||||
private static final String DESC_PLACEHOLDER = "[description]";
|
||||
private static final String HELP_SYNTAX_REF = "commands.help.syntax";
|
||||
private static final String HELP_SYNTAX_NO_PARAMETERS_REF = "commands.help.syntax-no-parameters";
|
||||
private static final String HELP = "help";
|
||||
|
||||
public DefaultHelpCommand(CompositeCommand parent) {
|
||||
@ -93,14 +94,22 @@ public class DefaultHelpCommand extends CompositeCommand {
|
||||
if (user.isPlayer()) {
|
||||
// Player. Check perms
|
||||
if (user.isOp() || user.hasPermission(parent.getPermission())) {
|
||||
user.sendMessage(HELP_SYNTAX_REF, USAGE_PLACEHOLDER, usage, PARAMS_PLACEHOLDER, params, DESC_PLACEHOLDER, desc);
|
||||
if (params.isEmpty()) {
|
||||
user.sendMessage(HELP_SYNTAX_NO_PARAMETERS_REF, USAGE_PLACEHOLDER, usage, DESC_PLACEHOLDER, desc);
|
||||
} else {
|
||||
user.sendMessage(HELP_SYNTAX_REF, USAGE_PLACEHOLDER, usage, PARAMS_PLACEHOLDER, params, DESC_PLACEHOLDER, desc);
|
||||
}
|
||||
} else {
|
||||
// No permission, nothing to see here. If you don't have permission, you cannot see any sub commands
|
||||
return true;
|
||||
}
|
||||
} else if (!parent.isOnlyPlayer()) {
|
||||
// Console. Only show if it is a console command
|
||||
user.sendMessage(HELP_SYNTAX_REF, USAGE_PLACEHOLDER, usage, PARAMS_PLACEHOLDER, params, DESC_PLACEHOLDER, desc);
|
||||
if (params.isEmpty()) {
|
||||
user.sendMessage(HELP_SYNTAX_NO_PARAMETERS_REF, USAGE_PLACEHOLDER, usage, DESC_PLACEHOLDER, desc);
|
||||
} else {
|
||||
user.sendMessage(HELP_SYNTAX_REF, USAGE_PLACEHOLDER, usage, PARAMS_PLACEHOLDER, params, DESC_PLACEHOLDER, desc);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ commands:
|
||||
help:
|
||||
header: "&7=========== &c[label] help &7==========="
|
||||
syntax: "&b[usage] &a[parameters]&7: &e[description]"
|
||||
syntax-no-parameters: "&b[usage]&7: &e[description]"
|
||||
end: "&7================================="
|
||||
parameters: "[command]"
|
||||
description: "help command"
|
||||
|
Loading…
Reference in New Issue
Block a user