Prepare the project for javadocs

This commit is contained in:
Gabriele C
2015-11-21 01:27:06 +01:00
parent adcd70b91d
commit 118c79401a
168 changed files with 4375 additions and 422 deletions
@@ -9,6 +9,8 @@ import org.bukkit.command.CommandSender;
import fr.xephi.authme.util.StringUtils;
/**
*/
public class CommandDescription {
/** Defines the acceptable labels. */
@@ -97,8 +99,8 @@ public class CommandDescription {
/**
* Get the first relative command label.
*
* @return First relative command label.
*/
* @return First relative command label. */
public String getLabel() {
// Ensure there's any item in the command list
if(this.labels.size() == 0)
@@ -113,8 +115,8 @@ public class CommandDescription {
*
* @param reference The command reference.
*
* @return The most similar label, or the first label. An empty label will be returned if no label was set.
*/
* @return The most similar label, or the first label. An empty label will be returned if no label was set. */
public String getLabel(CommandParts reference) {
// Ensure there's any item in the command list
if(this.labels.size() == 0)
@@ -145,8 +147,8 @@ public class CommandDescription {
/**
* Get all relative command labels.
*
* @return All relative labels labels.
*/
* @return All relative labels labels. */
public List<String> getLabels() {
return this.labels;
}
@@ -181,8 +183,8 @@ public class CommandDescription {
* @param overwrite True to replace all old command labels, false to append this command label to the currently
* existing labels.
*
* @return Trie if the command label is added, or if it was added already. False on failure.
*/
* @return Trie if the command label is added, or if it was added already. False on failure. */
public boolean setLabel(String commandLabel, boolean overwrite) {
// Check whether this new command should overwrite the previous ones
if(!overwrite)
@@ -198,8 +200,8 @@ public class CommandDescription {
*
* @param commandLabel Command label to add.
*
* @return True if the label was added, or if it was added already. False on error.
*/
* @return True if the label was added, or if it was added already. False on error. */
public boolean addLabel(String commandLabel) {
// Verify the label
if(!isValidLabel(commandLabel))
@@ -218,8 +220,8 @@ public class CommandDescription {
*
* @param commandLabels List of command labels to add.
*
* @return True if succeed, false on failure.
*/
* @return True if succeed, false on failure. */
public boolean addLabels(List<String> commandLabels) {
// Add each command label separately
for(String cmd : commandLabels)
@@ -233,8 +235,8 @@ public class CommandDescription {
*
* @param commandLabel Command to check for.
*
* @return True if this command label equals to the param command.
*/
* @return True if this command label equals to the param command. */
public boolean hasLabel(String commandLabel) {
// Check whether any command matches with the argument
for(String entry : this.labels)
@@ -248,8 +250,8 @@ public class CommandDescription {
/**
* Check whether this command description has a list of labels
* @param commandLabels List of labels
* @return True if all labels match, false otherwise
*/
* @return True if all labels match, false otherwise */
public boolean hasLabels(List<String> commandLabels) {
// Check if there's a match for every command
for(String cmd : commandLabels)
@@ -266,8 +268,8 @@ public class CommandDescription {
*
* @param commandReference The command reference.
*
* @return True if the command reference is suitable to this command label, false otherwise.
*/
* @return True if the command reference is suitable to this command label, false otherwise. */
public boolean isSuitableLabel(CommandParts commandReference) {
// Make sure the command reference is valid
if(commandReference.getCount() <= 0)
@@ -285,8 +287,8 @@ public class CommandDescription {
*
* @param label The label to test.
*
* @return True if the label is valid to use, false otherwise.
*/
* @return True if the label is valid to use, false otherwise. */
public static boolean isValidLabel(String label) {
// Make sure the label isn't null
if(label == null)
@@ -305,6 +307,7 @@ public class CommandDescription {
/**
* Get the absolute command label, without a slash.
* @return String
*/
public String getAbsoluteLabel() {
return getAbsoluteLabel(false);
@@ -313,8 +316,9 @@ public class CommandDescription {
/**
* Get the absolute command label.
*
* @return Absolute command label.
*/
* @param includeSlash boolean
* @return Absolute command label. */
public String getAbsoluteLabel(boolean includeSlash) {
return getAbsoluteLabel(includeSlash, null);
}
@@ -322,8 +326,10 @@ public class CommandDescription {
/**
* Get the absolute command label.
*
* @return Absolute command label.
*/
* @param includeSlash boolean
* @param reference CommandParts
* @return Absolute command label. */
public String getAbsoluteLabel(boolean includeSlash, CommandParts reference) {
// Get the command reference, and make sure it is valid
CommandParts out = getCommandReference(reference);
@@ -339,8 +345,8 @@ public class CommandDescription {
*
* @param reference The reference to use as template, which is used to choose the most similar reference.
*
* @return Command reference.
*/
* @return Command reference. */
public CommandParts getCommandReference(CommandParts reference) {
// Build the reference
List<String> referenceList = new ArrayList<>();
@@ -361,8 +367,8 @@ public class CommandDescription {
*
* @param other The other command reference.
*
* @return The command difference. Zero if there's no difference. A negative number on error.
*/
* @return The command difference. Zero if there's no difference. A negative number on error. */
public double getCommandDifference(CommandParts other) {
return getCommandDifference(other, false);
}
@@ -373,8 +379,8 @@ public class CommandDescription {
* @param other The other command reference.
* @param fullCompare True to fully compare both command references.
*
* @return The command difference. Zero if there's no difference. A negative number on error.
*/
* @return The command difference. Zero if there's no difference. A negative number on error. */
public double getCommandDifference(CommandParts other, boolean fullCompare) {
// Make sure the reference is valid
if(other == null)
@@ -390,8 +396,8 @@ public class CommandDescription {
/**
* Get the executable command.
*
* @return The executable command.
*/
* @return The executable command. */
public ExecutableCommand getExecutableCommand() {
return this.executableCommand;
}
@@ -408,8 +414,8 @@ public class CommandDescription {
/**
* Check whether this command is executable, based on the assigned executable command.
*
* @return True if this command is executable.
*/
* @return True if this command is executable. */
public boolean isExecutable() {
return this.executableCommand != null;
}
@@ -421,8 +427,8 @@ public class CommandDescription {
* @param commandReference The command reference.
* @param commandArguments The command arguments.
*
* @return True on success, false on failure.
*/
* @return True on success, false on failure. */
public boolean execute(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
// Make sure the command is executable
if(!isExecutable())
@@ -435,8 +441,8 @@ public class CommandDescription {
/**
* Get the parent command if this command description has a parent.
*
* @return Parent command, or null
*/
* @return Parent command, or null */
public CommandDescription getParent() {
return this.parent;
}
@@ -444,8 +450,8 @@ public class CommandDescription {
/**
* Get the number of parent this description has.
*
* @return The number of parents.
*/
* @return The number of parents. */
public int getParentCount() {
// Check whether the this description has a parent
if(!hasParent())
@@ -460,8 +466,8 @@ public class CommandDescription {
*
* @param parent Parent command.
*
* @return True on success, false on failure.
*/
* @return True on success, false on failure. */
public boolean setParent(CommandDescription parent) {
// Make sure the parent is different
if(this.parent == parent)
@@ -481,8 +487,8 @@ public class CommandDescription {
/**
* Check whether the plugin description has a parent command.
*
* @return True if the description has a parent command, false otherwise.
*/
* @return True if the description has a parent command, false otherwise. */
public boolean hasParent() {
return this.parent != null;
}
@@ -490,8 +496,8 @@ public class CommandDescription {
/**
* Get all command children.
*
* @return Command children.
*/
* @return Command children. */
public List<CommandDescription> getChildren() {
return this.children;
}
@@ -501,8 +507,8 @@ public class CommandDescription {
*
* @param commandDescription The child to add.
*
* @return True on success, false on failure.
*/
* @return True on success, false on failure. */
public boolean addChild(CommandDescription commandDescription) {
// Make sure the description is valid
if(commandDescription == null)
@@ -539,8 +545,8 @@ public class CommandDescription {
/**
* Check whether this command has any child labels.
*
* @return True if this command has any child labels.
*/
* @return True if this command has any child labels. */
public boolean hasChilds() {
return (this.children.size() != 0);
}
@@ -550,8 +556,8 @@ public class CommandDescription {
*
* @param commandDescription The command description to check for.
*
* @return True if this command description has the specific child, false otherwise.
*/
* @return True if this command description has the specific child, false otherwise. */
public boolean isChild(CommandDescription commandDescription) {
// Make sure the description is valid
if(commandDescription == null)
@@ -568,8 +574,8 @@ public class CommandDescription {
*
* @param argument The argument to add.
*
* @return True if succeed, false if failed.
*/
* @return True if succeed, false if failed. */
public boolean addArgument(CommandArgumentDescription argument) {
// Make sure the argument is valid
if(argument == null)
@@ -586,8 +592,8 @@ public class CommandDescription {
/**
* Get all command arguments.
*
* @return Command arguments.
*/
* @return Command arguments. */
public List<CommandArgumentDescription> getArguments() {
return this.arguments;
}
@@ -611,8 +617,8 @@ public class CommandDescription {
*
* @param argument The argument to check for.
*
* @return True if this argument already exists, false otherwise.
*/
* @return True if this argument already exists, false otherwise. */
public boolean hasArgument(CommandArgumentDescription argument) {
// Make sure the argument is valid
if(argument == null)
@@ -625,8 +631,8 @@ public class CommandDescription {
/**
* Check whether this command has any arguments.
*
* @return True if this command has any arguments.
*/
* @return True if this command has any arguments. */
public boolean hasArguments() {
return (this.arguments.size() != 0);
}
@@ -634,8 +640,8 @@ public class CommandDescription {
/**
* The minimum number of arguments required for this command.
*
* @return The minimum number of required arguments.
*/
* @return The minimum number of required arguments. */
public int getMinimumArguments() {
// Get the number of required and optional arguments
int requiredArguments = 0;
@@ -659,8 +665,8 @@ public class CommandDescription {
/**
* Get the maximum number of arguments.
*
* @return The maximum number of arguments. A negative number will be returned if there's no maximum.
*/
* @return The maximum number of arguments. A negative number will be returned if there's no maximum. */
public int getMaximumArguments() {
// Check whether there is a maximum set
if(this.noArgumentMaximum)
@@ -682,8 +688,8 @@ public class CommandDescription {
/**
* Get the command description.
*
* @return Command description.
*/
* @return Command description. */
public String getDescription() {
return hasDescription() ? this.description : this.detailedDescription;
}
@@ -704,8 +710,8 @@ public class CommandDescription {
/**
* Check whether this command has any description.
*
* @return True if this command has any description.
*/
* @return True if this command has any description. */
public boolean hasDescription() {
return (this.description.trim().length() != 0);
}
@@ -713,8 +719,8 @@ public class CommandDescription {
/**
* Get the command detailed description.
*
* @return Command detailed description.
*/
* @return Command detailed description. */
public String getDetailedDescription() {
return hasDetailedDescription() ? this.detailedDescription : this.description;
}
@@ -735,8 +741,8 @@ public class CommandDescription {
/**
* Check whether this command has any detailed description.
*
* @return True if this command has any detailed description.
*/
* @return True if this command has any detailed description. */
public boolean hasDetailedDescription() {
return (this.detailedDescription.trim().length() != 0);
}
@@ -746,8 +752,8 @@ public class CommandDescription {
*
* @param queryReference The query reference to find a command for.
*
* @return The command found, or null.
*/
* @return The command found, or null. */
public FoundCommandResult findCommand(final CommandParts queryReference) {
// Make sure the command reference is valid
if(queryReference.getCount() <= 0)
@@ -808,8 +814,8 @@ public class CommandDescription {
*
* @param commandReference The command reference.
*
* @return True if so, false otherwise.
*/
* @return True if so, false otherwise. */
public boolean hasSuitableCommand(CommandParts commandReference) {
return findCommand(commandReference) != null;
}
@@ -819,8 +825,8 @@ public class CommandDescription {
*
* @param commandReference The command reference.
*
* @return True if the arguments are suitable, false otherwise.
*/
* @return True if the arguments are suitable, false otherwise. */
public boolean hasSuitableArguments(CommandParts commandReference) {
return getSuitableArgumentsDifference(commandReference) == 0;
}
@@ -831,8 +837,8 @@ public class CommandDescription {
*
* @param commandReference The command reference.
*
* @return The difference in argument count between the reference and the actual command.
*/
* @return The difference in argument count between the reference and the actual command. */
public int getSuitableArgumentsDifference(CommandParts commandReference) {
// Make sure the command reference is valid
if(commandReference.getCount() <= 0)
@@ -856,8 +862,8 @@ public class CommandDescription {
/**
* Get the command permissions.
*
* @return The command permissions.
*/
* @return The command permissions. */
public CommandPermissions getCommandPermissions() {
return this.permissions;
}
@@ -887,8 +893,8 @@ public class CommandDescription {
* @param commandLabel The first command label.
* @param otherCommandLabel The other command label.
*
* @return True if the labels are equal to each other.
*/
* @return True if the labels are equal to each other. */
private static boolean commandLabelEquals(String commandLabel, String otherCommandLabel) {
// Trim the command labels from unwanted whitespaces
commandLabel = commandLabel.trim();
@@ -901,8 +907,8 @@ public class CommandDescription {
/**
* Check whether the command description has been set up properly.
*
* @return True if the command description is valid, false otherwise.
*/
* @return True if the command description is valid, false otherwise. */
public boolean isValid() {
// Make sure any command label is set
if(getLabels().size() == 0)