mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-22 09:08:03 +01:00
CompositeCommand : added defaults for setDescription and setParameters
This commit is contained in:
parent
b600dacbdd
commit
1a63b2431e
@ -119,6 +119,9 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
|||||||
if (plugin.getCommand(label) == null) {
|
if (plugin.getCommand(label) == null) {
|
||||||
plugin.getCommandsManager().registerCommand(this);
|
plugin.getCommandsManager().registerCommand(this);
|
||||||
}
|
}
|
||||||
|
// Default references to description and parameters
|
||||||
|
setDescription("commands." + label + ".description");
|
||||||
|
setParameters("commands." + label + ".parameters");
|
||||||
setup();
|
setup();
|
||||||
if (!getSubCommand("help").isPresent() && !label.equals("help")) {
|
if (!getSubCommand("help").isPresent() && !label.equals("help")) {
|
||||||
new DefaultHelpCommand(this);
|
new DefaultHelpCommand(this);
|
||||||
@ -160,6 +163,14 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
|||||||
this.permissionPrefix = parent.getPermissionPrefix();
|
this.permissionPrefix = parent.getPermissionPrefix();
|
||||||
// Inherit world
|
// Inherit world
|
||||||
this.world = parent.getWorld();
|
this.world = parent.getWorld();
|
||||||
|
// Default references to description and parameters
|
||||||
|
String reference = "";
|
||||||
|
for (CompositeCommand p = this ; p != null ; p = getParent()) {
|
||||||
|
reference = "." + p.getLabel() + reference;
|
||||||
|
}
|
||||||
|
reference = "commands" + reference;
|
||||||
|
setDescription(reference + ".description");
|
||||||
|
setParameters(reference + ".parameters");
|
||||||
setup();
|
setup();
|
||||||
// If this command does not define its own help class, then use the default help command
|
// If this command does not define its own help class, then use the default help command
|
||||||
if (!getSubCommand("help").isPresent() && !label.equals("help")) {
|
if (!getSubCommand("help").isPresent() && !label.equals("help")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user