Prepare the project for javadocs
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package fr.xephi.authme.command;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class CommandArgumentDescription {
|
||||
|
||||
// TODO: Allow argument to consist of infinite parts. <label ...>
|
||||
@@ -37,8 +39,8 @@ public class CommandArgumentDescription {
|
||||
/**
|
||||
* Get the argument label.
|
||||
*
|
||||
* @return Argument label.
|
||||
*/
|
||||
|
||||
* @return Argument label. */
|
||||
public String getLabel() {
|
||||
return this.label;
|
||||
}
|
||||
@@ -55,8 +57,8 @@ public class CommandArgumentDescription {
|
||||
/**
|
||||
* Get the argument description.
|
||||
*
|
||||
* @return Argument description.
|
||||
*/
|
||||
|
||||
* @return Argument description. */
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
@@ -73,8 +75,8 @@ public class CommandArgumentDescription {
|
||||
/**
|
||||
* Check whether the argument is optional.
|
||||
*
|
||||
* @return True if the argument is optional, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the argument is optional, false otherwise. */
|
||||
public boolean isOptional() {
|
||||
return optional;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -10,6 +10,8 @@ import org.bukkit.command.CommandSender;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.command.help.HelpProvider;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class CommandHandler {
|
||||
|
||||
/** The command manager instance. */
|
||||
@@ -29,9 +31,9 @@ public class CommandHandler {
|
||||
/**
|
||||
* Initialize the command handler.
|
||||
*
|
||||
|
||||
* @return True if succeed, false on failure. True will also be returned if the command handler was already
|
||||
* initialized.
|
||||
*/
|
||||
* initialized. */
|
||||
public boolean init() {
|
||||
// Make sure the handler isn't initialized already
|
||||
if(isInit())
|
||||
@@ -48,8 +50,8 @@ public class CommandHandler {
|
||||
/**
|
||||
* Check whether the command handler is initialized.
|
||||
*
|
||||
* @return True if the command handler is initialized.
|
||||
*/
|
||||
|
||||
* @return True if the command handler is initialized. */
|
||||
public boolean isInit() {
|
||||
return this.commandManager != null;
|
||||
}
|
||||
@@ -57,9 +59,9 @@ public class CommandHandler {
|
||||
/**
|
||||
* Destroy the command handler.
|
||||
*
|
||||
|
||||
* @return True if the command handler was destroyed successfully, false otherwise. True will also be returned if
|
||||
* the command handler wasn't initialized.
|
||||
*/
|
||||
* the command handler wasn't initialized. */
|
||||
public boolean destroy() {
|
||||
// Make sure the command handler is initialized
|
||||
if(!isInit())
|
||||
@@ -73,8 +75,8 @@ public class CommandHandler {
|
||||
/**
|
||||
* Get the command manager.
|
||||
*
|
||||
* @return Command manager instance.
|
||||
*/
|
||||
|
||||
* @return Command manager instance. */
|
||||
public CommandManager getCommandManager() {
|
||||
return this.commandManager;
|
||||
}
|
||||
@@ -87,8 +89,8 @@ public class CommandHandler {
|
||||
* @param bukkitCommandLabel The command label (Bukkit).
|
||||
* @param bukkitArgs The command arguments (Bukkit).
|
||||
*
|
||||
* @return True if the command was executed, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed, false otherwise. */
|
||||
public boolean onCommand(CommandSender sender, org.bukkit.command.Command bukkitCommand, String bukkitCommandLabel, String[] bukkitArgs) {
|
||||
// Process the arguments
|
||||
List<String> args = processArguments(bukkitArgs);
|
||||
@@ -180,8 +182,8 @@ public class CommandHandler {
|
||||
*
|
||||
* @param args The command arguments to process.
|
||||
*
|
||||
* @return The processed command arguments.
|
||||
*/
|
||||
|
||||
* @return The processed command arguments. */
|
||||
private List<String> processArguments(String[] args) {
|
||||
// Convert the array into a list of arguments
|
||||
List<String> arguments = new ArrayList<>(Arrays.asList(args));
|
||||
|
||||
@@ -32,6 +32,8 @@ import fr.xephi.authme.command.executable.email.RecoverEmailCommand;
|
||||
import fr.xephi.authme.command.executable.login.LoginCommand;
|
||||
import fr.xephi.authme.command.executable.logout.LogoutCommand;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class CommandManager {
|
||||
|
||||
/** The list of commandDescriptions. */
|
||||
@@ -571,8 +573,8 @@ public class CommandManager {
|
||||
/**
|
||||
* Get the list of command descriptions
|
||||
*
|
||||
* @return List of command descriptions.
|
||||
*/
|
||||
|
||||
* @return List of command descriptions. */
|
||||
public List<CommandDescription> getCommandDescriptions() {
|
||||
return this.commandDescriptions;
|
||||
}
|
||||
@@ -580,8 +582,8 @@ public class CommandManager {
|
||||
/**
|
||||
* Get the number of command description count.
|
||||
*
|
||||
* @return Command description count.
|
||||
*/
|
||||
|
||||
* @return Command description count. */
|
||||
public int getCommandDescriptionCount() {
|
||||
return this.getCommandDescriptions().size();
|
||||
}
|
||||
@@ -592,8 +594,8 @@ public class CommandManager {
|
||||
* @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(CommandParts queryReference) {
|
||||
// Make sure the command reference is valid
|
||||
if (queryReference.getCount() <= 0)
|
||||
|
||||
@@ -6,6 +6,8 @@ import java.util.List;
|
||||
import fr.xephi.authme.util.ListUtils;
|
||||
import fr.xephi.authme.util.StringUtils;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class CommandParts {
|
||||
|
||||
/** The list of parts for this command. */
|
||||
@@ -57,8 +59,8 @@ public class CommandParts {
|
||||
/**
|
||||
* Get the command parts.
|
||||
*
|
||||
* @return Command parts.
|
||||
*/
|
||||
|
||||
* @return Command parts. */
|
||||
public List<String> getList() {
|
||||
return this.parts;
|
||||
}
|
||||
@@ -68,8 +70,8 @@ public class CommandParts {
|
||||
*
|
||||
* @param part The part to add.
|
||||
*
|
||||
* @return The result.
|
||||
*/
|
||||
|
||||
* @return The result. */
|
||||
public boolean add(String part) {
|
||||
return this.parts.add(part);
|
||||
}
|
||||
@@ -79,8 +81,8 @@ public class CommandParts {
|
||||
*
|
||||
* @param parts The parts to add.
|
||||
*
|
||||
* @return The result.
|
||||
*/
|
||||
|
||||
* @return The result. */
|
||||
public boolean add(List<String> parts) {
|
||||
return this.parts.addAll(parts);
|
||||
}
|
||||
@@ -90,8 +92,8 @@ public class CommandParts {
|
||||
*
|
||||
* @param parts The parts to add.
|
||||
*
|
||||
* @return The result.
|
||||
*/
|
||||
|
||||
* @return The result. */
|
||||
public boolean add(String[] parts) {
|
||||
for(String entry : parts)
|
||||
add(entry);
|
||||
@@ -101,8 +103,8 @@ public class CommandParts {
|
||||
/**
|
||||
* Get the number of parts.
|
||||
*
|
||||
* @return Part count.
|
||||
*/
|
||||
|
||||
* @return Part count. */
|
||||
public int getCount() {
|
||||
return this.parts.size();
|
||||
}
|
||||
@@ -112,8 +114,8 @@ public class CommandParts {
|
||||
*
|
||||
* @param i Part index.
|
||||
*
|
||||
* @return The part.
|
||||
*/
|
||||
|
||||
* @return The part. */
|
||||
public String get(int i) {
|
||||
// Make sure the index is in-bound
|
||||
if(i < 0 || i >= getCount())
|
||||
@@ -128,8 +130,8 @@ public class CommandParts {
|
||||
*
|
||||
* @param start The starting index.
|
||||
*
|
||||
* @return The parts range. Arguments that were out of bound are not included.
|
||||
*/
|
||||
|
||||
* @return The parts range. Arguments that were out of bound are not included. */
|
||||
public List<String> getRange(int start) {
|
||||
return getRange(start, getCount() - start);
|
||||
}
|
||||
@@ -140,8 +142,8 @@ public class CommandParts {
|
||||
* @param start The starting index.
|
||||
* @param count The number of parts to get.
|
||||
*
|
||||
* @return The parts range. Parts that were out of bound are not included.
|
||||
*/
|
||||
|
||||
* @return The parts range. Parts that were out of bound are not included. */
|
||||
public List<String> getRange(int start, int count) {
|
||||
// Create a new list to put the range into
|
||||
List<String> elements = new ArrayList<>();
|
||||
@@ -163,8 +165,8 @@ public class CommandParts {
|
||||
*
|
||||
* @param other The other reference.
|
||||
*
|
||||
* @return The result from zero to above. A negative number will be returned on error.
|
||||
*/
|
||||
|
||||
* @return The result from zero to above. A negative number will be returned on error. */
|
||||
public double getDifference(CommandParts other) {
|
||||
return getDifference(other, false);
|
||||
}
|
||||
@@ -175,8 +177,8 @@ public class CommandParts {
|
||||
* @param other The other reference.
|
||||
* @param fullCompare True to compare the full references as far as the range reaches.
|
||||
*
|
||||
* @return The result from zero to above. A negative number will be returned on error.
|
||||
*/
|
||||
|
||||
* @return The result from zero to above. A negative number will be returned on error. */
|
||||
public double getDifference(CommandParts other, boolean fullCompare) {
|
||||
// Make sure the other reference is correct
|
||||
if(other == null)
|
||||
@@ -194,8 +196,8 @@ public class CommandParts {
|
||||
/**
|
||||
* Convert the parts to a string.
|
||||
*
|
||||
* @return The part as a string.
|
||||
*/
|
||||
|
||||
* @return The part as a string. */
|
||||
@Override
|
||||
public String toString() {
|
||||
return ListUtils.implode(this.parts, " ");
|
||||
|
||||
@@ -11,6 +11,8 @@ import org.bukkit.entity.Player;
|
||||
//import com.timvisee.dungeonmaze.permission.PermissionsManager;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class CommandPermissions {
|
||||
|
||||
/** Defines the permission nodes required to have permission to execute this command. */
|
||||
@@ -49,8 +51,8 @@ public class CommandPermissions {
|
||||
*
|
||||
* @param permissionNode The permission node to add.
|
||||
*
|
||||
* @return True on success, false on failure.
|
||||
*/
|
||||
|
||||
* @return True on success, false on failure. */
|
||||
public boolean addPermissionNode(String permissionNode) {
|
||||
// Trim the permission node
|
||||
permissionNode = permissionNode.trim();
|
||||
@@ -72,8 +74,8 @@ public class CommandPermissions {
|
||||
*
|
||||
* @param permissionNode The permission node to check for.
|
||||
*
|
||||
* @return True if this permission node is required, false if not.
|
||||
*/
|
||||
|
||||
* @return True if this permission node is required, false if not. */
|
||||
public boolean hasPermissionNode(String permissionNode) {
|
||||
return this.permissionNodes.contains(permissionNode);
|
||||
}
|
||||
@@ -81,8 +83,8 @@ public class CommandPermissions {
|
||||
/**
|
||||
* Get the permission nodes required to execute this command.
|
||||
*
|
||||
* @return The permission nodes required to execute this command.
|
||||
*/
|
||||
|
||||
* @return The permission nodes required to execute this command. */
|
||||
public List<String> getPermissionNodes() {
|
||||
return this.permissionNodes;
|
||||
}
|
||||
@@ -90,8 +92,8 @@ public class CommandPermissions {
|
||||
/**
|
||||
* Get the number of permission nodes set.
|
||||
*
|
||||
* @return Permission node count.
|
||||
*/
|
||||
|
||||
* @return Permission node count. */
|
||||
public int getPermissionNodeCount() {
|
||||
return this.permissionNodes.size();
|
||||
}
|
||||
@@ -108,8 +110,9 @@ public class CommandPermissions {
|
||||
/**
|
||||
* Check whether this command requires any permission to be executed. This is based on the getPermission() method.
|
||||
*
|
||||
* @return True if this command requires any permission to be executed by a player.
|
||||
*/
|
||||
|
||||
* @param sender CommandSender
|
||||
* @return True if this command requires any permission to be executed by a player. */
|
||||
public boolean hasPermission(CommandSender sender) {
|
||||
// Make sure any permission node is set
|
||||
if(getPermissionNodeCount() == 0)
|
||||
@@ -140,8 +143,8 @@ public class CommandPermissions {
|
||||
/**
|
||||
* Get the default permission if the permission nodes couldn't be used.
|
||||
*
|
||||
* @return The default permission.
|
||||
*/
|
||||
|
||||
* @return The default permission. */
|
||||
public DefaultPermission getDefaultPermission() {
|
||||
return this.defaultPermission;
|
||||
}
|
||||
@@ -160,8 +163,8 @@ public class CommandPermissions {
|
||||
*
|
||||
* @param sender The command sender to get the default permission for.
|
||||
*
|
||||
* @return True if the command sender has permission by default, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command sender has permission by default, false otherwise. */
|
||||
public boolean getDefaultPermissionCommandSender(CommandSender sender) {
|
||||
switch(getDefaultPermission()) {
|
||||
case ALLOWED:
|
||||
@@ -176,6 +179,8 @@ public class CommandPermissions {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public enum DefaultPermission {
|
||||
NOT_ALLOWED,
|
||||
OP_ONLY,
|
||||
|
||||
@@ -2,6 +2,8 @@ package fr.xephi.authme.command;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
/**
|
||||
*/
|
||||
public abstract class ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -11,7 +13,7 @@ public abstract class ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
public abstract boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package fr.xephi.authme.command;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class FoundCommandResult {
|
||||
|
||||
/** The command description instance. */
|
||||
@@ -31,8 +33,8 @@ public class FoundCommandResult {
|
||||
/**
|
||||
* Check whether the command was suitable.
|
||||
*
|
||||
* @return True if the command was suitable, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was suitable, false otherwise. */
|
||||
public boolean hasProperArguments() {
|
||||
// Make sure the command description is set
|
||||
if(this.commandDescription == null)
|
||||
@@ -45,8 +47,8 @@ public class FoundCommandResult {
|
||||
/**
|
||||
* Get the command description.
|
||||
*
|
||||
* @return Command description.
|
||||
*/
|
||||
|
||||
* @return Command description. */
|
||||
public CommandDescription getCommandDescription() {
|
||||
return this.commandDescription;
|
||||
}
|
||||
@@ -64,8 +66,8 @@ public class FoundCommandResult {
|
||||
/**
|
||||
* Check whether the command is executable.
|
||||
*
|
||||
* @return True if the command is executable, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command is executable, false otherwise. */
|
||||
public boolean isExecutable() {
|
||||
// Make sure the command description is valid
|
||||
if(this.commandDescription == null)
|
||||
@@ -80,8 +82,8 @@ public class FoundCommandResult {
|
||||
*
|
||||
* @param sender The command sender that executed the command.
|
||||
*
|
||||
* @return True on success, false on failure.
|
||||
*/
|
||||
|
||||
* @return True on success, false on failure. */
|
||||
public boolean executeCommand(CommandSender sender) {
|
||||
// Make sure the command description is valid
|
||||
if(this.commandDescription == null)
|
||||
@@ -96,8 +98,8 @@ public class FoundCommandResult {
|
||||
*
|
||||
* @param sender The command sender.
|
||||
*
|
||||
* @return True if the command sender has permission, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command sender has permission, false otherwise. */
|
||||
public boolean hasPermission(CommandSender sender) {
|
||||
// Make sure the command description is valid
|
||||
if(this.commandDescription == null)
|
||||
@@ -110,8 +112,8 @@ public class FoundCommandResult {
|
||||
/**
|
||||
* Get the command reference.
|
||||
*
|
||||
* @return The command reference.
|
||||
*/
|
||||
|
||||
* @return The command reference. */
|
||||
public CommandParts getCommandReference() {
|
||||
return this.commandReference;
|
||||
}
|
||||
@@ -119,8 +121,8 @@ public class FoundCommandResult {
|
||||
/**
|
||||
* Get the command arguments.
|
||||
*
|
||||
* @return The command arguments.
|
||||
*/
|
||||
|
||||
* @return The command arguments. */
|
||||
public CommandParts getCommandArguments() {
|
||||
return this.commandArguments;
|
||||
}
|
||||
@@ -128,8 +130,8 @@ public class FoundCommandResult {
|
||||
/**
|
||||
* Get the original query reference.
|
||||
*
|
||||
* @return Original query reference.
|
||||
*/
|
||||
|
||||
* @return Original query reference. */
|
||||
public CommandParts getQueryReference() {
|
||||
return this.queryReference;
|
||||
}
|
||||
@@ -137,8 +139,8 @@ public class FoundCommandResult {
|
||||
/**
|
||||
* Get the difference value between the original query and the result reference.
|
||||
*
|
||||
* @return The difference value.
|
||||
*/
|
||||
|
||||
* @return The difference value. */
|
||||
public double getDifference() {
|
||||
// Get the difference through the command found
|
||||
if(this.commandDescription != null)
|
||||
|
||||
@@ -6,6 +6,8 @@ import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.command.help.HelpProvider;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class HelpCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -15,8 +17,8 @@ public class HelpCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// Check whether quick help should be shown
|
||||
|
||||
@@ -12,6 +12,8 @@ import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class AccountsCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -21,8 +23,8 @@ public class AccountsCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(final CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
|
||||
@@ -7,6 +7,8 @@ import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class AuthMeCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -16,8 +18,8 @@ public class AuthMeCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// Show some version info
|
||||
|
||||
@@ -15,6 +15,8 @@ import fr.xephi.authme.security.PasswordSecurity;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ChangePasswordCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -24,8 +26,8 @@ public class ChangePasswordCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(final CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
|
||||
@@ -8,6 +8,8 @@ import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.settings.Spawn;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class FirstSpawnCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -17,8 +19,8 @@ public class FirstSpawnCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// Make sure the command executor is a player
|
||||
|
||||
@@ -8,6 +8,8 @@ import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ForceLoginCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -17,8 +19,8 @@ public class ForceLoginCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
|
||||
@@ -8,6 +8,8 @@ import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class GetEmailCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -17,8 +19,8 @@ public class GetEmailCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
|
||||
@@ -8,6 +8,8 @@ import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class GetIpCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -17,8 +19,8 @@ public class GetIpCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
|
||||
@@ -10,6 +10,8 @@ import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class LastLoginCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -19,8 +21,8 @@ public class LastLoginCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
|
||||
+4
-2
@@ -11,6 +11,8 @@ import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class PurgeBannedPlayersCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -20,8 +22,8 @@ public class PurgeBannedPlayersCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
|
||||
@@ -11,6 +11,8 @@ import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class PurgeCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -20,8 +22,8 @@ public class PurgeCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
|
||||
+4
-2
@@ -10,6 +10,8 @@ import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class PurgeLastPositionCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -19,8 +21,8 @@ public class PurgeLastPositionCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(final CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
|
||||
@@ -14,6 +14,8 @@ import fr.xephi.authme.security.PasswordSecurity;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class RegisterCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -23,8 +25,8 @@ public class RegisterCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(final CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
|
||||
@@ -11,6 +11,8 @@ import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.util.Profiler;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ReloadCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -20,8 +22,8 @@ public class ReloadCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// Profile the reload process
|
||||
|
||||
@@ -10,6 +10,8 @@ import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ResetNameCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -19,8 +21,8 @@ public class ResetNameCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
|
||||
@@ -10,6 +10,8 @@ import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class SetEmailCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -19,8 +21,8 @@ public class SetEmailCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
|
||||
@@ -8,6 +8,8 @@ import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.settings.Spawn;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class SetFirstSpawnCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -17,8 +19,8 @@ public class SetFirstSpawnCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
try {
|
||||
|
||||
@@ -8,6 +8,8 @@ import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.settings.Spawn;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class SetSpawnCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -17,8 +19,8 @@ public class SetSpawnCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// Make sure the command executor is a player
|
||||
|
||||
@@ -8,6 +8,8 @@ import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.settings.Spawn;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class SpawnCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -17,8 +19,8 @@ public class SpawnCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// Make sure the command executor is a player
|
||||
|
||||
@@ -8,6 +8,8 @@ import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.command.help.HelpProvider;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class SwitchAntiBotCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -17,8 +19,8 @@ public class SwitchAntiBotCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(final CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
|
||||
@@ -20,6 +20,8 @@ import fr.xephi.authme.task.MessageTask;
|
||||
import fr.xephi.authme.task.TimeoutTask;
|
||||
import fr.xephi.authme.util.Utils;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class UnregisterCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -28,8 +30,8 @@ public class UnregisterCommand extends ExecutableCommand {
|
||||
* @param sender The command sender.
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(final CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
|
||||
@@ -9,6 +9,8 @@ import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class VersionCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -18,8 +20,8 @@ public class VersionCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// Show some version info
|
||||
@@ -71,8 +73,8 @@ public class VersionCommand extends ExecutableCommand {
|
||||
*
|
||||
* @param minecraftName The Minecraft player name.
|
||||
*
|
||||
* @return True if the player is online, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the player is online, false otherwise. */
|
||||
private boolean isPlayerOnline(String minecraftName) {
|
||||
for(Player player : Bukkit.getOnlinePlayers())
|
||||
if(player.getName().equalsIgnoreCase(minecraftName))
|
||||
|
||||
@@ -11,6 +11,8 @@ import fr.xephi.authme.security.RandomString;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class CaptchaCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -20,8 +22,8 @@ public class CaptchaCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
|
||||
+4
-2
@@ -11,6 +11,8 @@ import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.task.ChangePasswordTask;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ChangePasswordCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -20,8 +22,8 @@ public class ChangePasswordCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
|
||||
@@ -17,6 +17,8 @@ import fr.xephi.authme.converter.vAuthConverter;
|
||||
import fr.xephi.authme.converter.xAuthConverter;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ConverterCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -26,8 +28,8 @@ public class ConverterCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
@@ -85,6 +87,8 @@ public class ConverterCommand extends ExecutableCommand {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public enum ConvertType {
|
||||
ftsql("flattosql"),
|
||||
ftsqlite("flattosqlite"),
|
||||
@@ -97,14 +101,27 @@ public class ConverterCommand extends ExecutableCommand {
|
||||
|
||||
String name;
|
||||
|
||||
/**
|
||||
* Constructor for ConvertType.
|
||||
* @param name String
|
||||
*/
|
||||
ConvertType(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getName.
|
||||
* @return String
|
||||
*/
|
||||
String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method fromName.
|
||||
* @param name String
|
||||
* @return ConvertType
|
||||
*/
|
||||
public static ConvertType fromName(String name) {
|
||||
for (ConvertType type : ConvertType.values()) {
|
||||
if (type.getName().equalsIgnoreCase(name))
|
||||
|
||||
@@ -8,6 +8,8 @@ import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class AddEmailCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -16,8 +18,8 @@ public class AddEmailCommand extends ExecutableCommand {
|
||||
* @param sender The command sender.
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
|
||||
@@ -8,6 +8,8 @@ import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ChangeEmailCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -16,8 +18,8 @@ public class ChangeEmailCommand extends ExecutableCommand {
|
||||
* @param sender The command sender.
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
|
||||
@@ -16,6 +16,8 @@ import fr.xephi.authme.security.RandomString;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class RecoverEmailCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -25,8 +27,8 @@ public class RecoverEmailCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
|
||||
@@ -7,6 +7,8 @@ import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class LoginCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -16,8 +18,8 @@ public class LoginCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
|
||||
@@ -7,6 +7,8 @@ import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class LogoutCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -16,8 +18,8 @@ public class LogoutCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
|
||||
@@ -10,6 +10,8 @@ import fr.xephi.authme.security.RandomString;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class RegisterCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -19,8 +21,8 @@ public class RegisterCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
|
||||
@@ -9,6 +9,8 @@ import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class UnregisterCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
@@ -18,8 +20,8 @@ public class UnregisterCommand extends ExecutableCommand {
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
|
||||
* @return True if the command was executed successfully, false otherwise. */
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
|
||||
@@ -16,6 +16,8 @@ import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.CommandPermissions;
|
||||
import fr.xephi.authme.util.StringUtils;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class HelpPrinter {
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,8 @@ import fr.xephi.authme.command.CommandDescription;
|
||||
import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.FoundCommandResult;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class HelpProvider {
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,6 +7,8 @@ import fr.xephi.authme.command.CommandDescription;
|
||||
import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.util.ListUtils;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class HelpSyntaxHelper {
|
||||
|
||||
/**
|
||||
@@ -17,8 +19,8 @@ public class HelpSyntaxHelper {
|
||||
* @param alternativeLabel The alternative label to use for this command syntax.
|
||||
* @param highlight True to highlight the important parts of this command.
|
||||
*
|
||||
* @return The command with proper syntax.
|
||||
*/
|
||||
|
||||
* @return The command with proper syntax. */
|
||||
@SuppressWarnings("StringConcatenationInsideStringBufferAppend")
|
||||
public static String getCommandSyntax(CommandDescription commandDescription, CommandParts commandReference, String alternativeLabel, boolean highlight) {
|
||||
// Create a string builder to build the command
|
||||
|
||||
Reference in New Issue
Block a user