From a9a932fdc36157ea8828556cd67e2ee088204dad Mon Sep 17 00:00:00 2001 From: Florian CUNY Date: Thu, 9 Aug 2018 11:54:48 +0200 Subject: [PATCH] Deprecated #setParameters(String) in favor of #setParametersHelp(String) Also did Javadoc for #setParameters(String), #setParametersHelp(String), #setDescription(String) (I had to override this one). --- .../api/commands/CompositeCommand.java | 96 ++++++++++++++++++- 1 file changed, 92 insertions(+), 4 deletions(-) diff --git a/src/main/java/world/bentobox/bentobox/api/commands/CompositeCommand.java b/src/main/java/world/bentobox/bentobox/api/commands/CompositeCommand.java index f43bb10db..c4ab0a876 100644 --- a/src/main/java/world/bentobox/bentobox/api/commands/CompositeCommand.java +++ b/src/main/java/world/bentobox/bentobox/api/commands/CompositeCommand.java @@ -129,7 +129,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi } // Default references to description and parameters setDescription("commands." + label + ".description"); - setParameters("commands." + label + ".parameters"); + setParametersHelp("commands." + label + ".parameters"); setup(); if (!getSubCommand("help").isPresent() && !label.equals("help")) { new DefaultHelpCommand(this); @@ -183,7 +183,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi index++; } setDescription(reference.toString() + ".description"); - setParameters(reference.toString() + ".parameters"); + setParametersHelp(reference.toString() + ".parameters"); setup(); // If this command does not define its own help class, then use the default help command @@ -449,13 +449,101 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi } /** - * Sets the command parameters to be shown in help - * @param parameters - string of parameters + * Sets locale reference to this command's description. + * It is used to display the help of this command. + * + *

+ * + * A default value is provided when instantiating this CompositeCommand: + * + * + * + * This method should therefore only be used in case you want to provide a different value than the default one. + * + * @param description The locale command's description reference to set. + * @return The instance of this {@link Command}. */ + @Override + public Command setDescription(String description) { + super.setDescription(description); + return this; + } + + /** + * Sets locale reference to this command's parameters. + * It is used to display the help of this command. + * + *

+ * + * A default value is provided when instantiating this CompositeCommand: + * + * + * + * This method should therefore only be used in case you want to provide a different value than the default one. + * + * @param parameters The locale command's paramaters reference to set. + * @deprecated This method has been deprecated to avoid upcoming ambiguity as we will be using Mojang's Brigadier library. + * Use {@link #setParametersHelp(String)} instead. + */ + @Deprecated public void setParameters(String parameters) { this.parameters = parameters; } + /** + * Sets locale reference to this command's parameters. + * It is used to display the help of this command. + * + *

+ * + * A default value is provided when instantiating this CompositeCommand: + * + * + * + * This method should therefore only be used in case you want to provide a different value than the default one. + * + * @param parametersHelp The locale command's paramaters reference to set. + */ + public void setParametersHelp(String parametersHelp) { + this.parameters = parametersHelp; + } + /* (non-Javadoc) * @see org.bukkit.command.Command#setPermission(java.lang.String) */