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 PARAMS_PLACEHOLDER = "[parameters]";
|
||||||
private static final String DESC_PLACEHOLDER = "[description]";
|
private static final String DESC_PLACEHOLDER = "[description]";
|
||||||
private static final String HELP_SYNTAX_REF = "commands.help.syntax";
|
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";
|
private static final String HELP = "help";
|
||||||
|
|
||||||
public DefaultHelpCommand(CompositeCommand parent) {
|
public DefaultHelpCommand(CompositeCommand parent) {
|
||||||
@ -93,14 +94,22 @@ public class DefaultHelpCommand extends CompositeCommand {
|
|||||||
if (user.isPlayer()) {
|
if (user.isPlayer()) {
|
||||||
// Player. Check perms
|
// Player. Check perms
|
||||||
if (user.isOp() || user.hasPermission(parent.getPermission())) {
|
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 {
|
} else {
|
||||||
// No permission, nothing to see here. If you don't have permission, you cannot see any sub commands
|
// No permission, nothing to see here. If you don't have permission, you cannot see any sub commands
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (!parent.isOnlyPlayer()) {
|
} else if (!parent.isOnlyPlayer()) {
|
||||||
// Console. Only show if it is a console command
|
// 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;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ commands:
|
|||||||
help:
|
help:
|
||||||
header: "&7=========== &c[label] help &7==========="
|
header: "&7=========== &c[label] help &7==========="
|
||||||
syntax: "&b[usage] &a[parameters]&7: &e[description]"
|
syntax: "&b[usage] &a[parameters]&7: &e[description]"
|
||||||
|
syntax-no-parameters: "&b[usage]&7: &e[description]"
|
||||||
end: "&7================================="
|
end: "&7================================="
|
||||||
parameters: "[command]"
|
parameters: "[command]"
|
||||||
description: "help command"
|
description: "help command"
|
||||||
|
Loading…
Reference in New Issue
Block a user