Reformatted code with new code style

This commit is contained in:
Tim Visée
2015-11-23 21:46:34 +01:00
parent b2db25d16c
commit 36c50c4507
92 changed files with 2458 additions and 2080 deletions
@@ -117,6 +117,7 @@ public class CommandDescription {
* Check whether a label is valid to use.
*
* @param label The label to test.
*
* @return True if the label is valid to use, false otherwise.
*/
public static boolean isValidLabel(String label) {
@@ -140,6 +141,7 @@ 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.
*/
private static boolean commandLabelEquals(String commandLabel, String otherCommandLabel) {
@@ -178,6 +180,7 @@ public class CommandDescription {
* Get the label most similar to the reference. The first label will be returned if no reference was supplied.
*
* @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.
*/
public String getLabel(CommandParts reference) {
@@ -236,6 +239,7 @@ public class CommandDescription {
* @param commandLabel Command label to set.
* @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.
*/
public boolean setLabel(String commandLabel, boolean overwrite) {
@@ -252,6 +256,7 @@ public class CommandDescription {
* Add a command label to the list.
*
* @param commandLabel Command label to add.
*
* @return True if the label was added, or if it was added already. False on error.
*/
public boolean addLabel(String commandLabel) {
@@ -271,6 +276,7 @@ public class CommandDescription {
* Add a list of command labels.
*
* @param commandLabels List of command labels to add.
*
* @return True if succeed, false on failure.
*/
public boolean addLabels(List<String> commandLabels) {
@@ -285,6 +291,7 @@ public class CommandDescription {
* Check whether this command description has a specific command.
*
* @param commandLabel Command to check for.
*
* @return True if this command label equals to the param command.
*/
public boolean hasLabel(String commandLabel) {
@@ -301,6 +308,7 @@ 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
*/
public boolean hasLabels(List<String> commandLabels) {
@@ -318,6 +326,7 @@ public class CommandDescription {
* are suitable too.
*
* @param commandReference The command reference.
*
* @return True if the command reference is suitable to this command label, false otherwise.
*/
public boolean isSuitableLabel(CommandParts commandReference) {
@@ -345,6 +354,7 @@ public class CommandDescription {
* Get the absolute command label.
*
* @param includeSlash boolean
*
* @return Absolute command label.
*/
public String getAbsoluteLabel(boolean includeSlash) {
@@ -356,6 +366,7 @@ public class CommandDescription {
*
* @param includeSlash boolean
* @param reference CommandParts
*
* @return Absolute command label.
*/
public String getAbsoluteLabel(boolean includeSlash, CommandParts reference) {
@@ -372,6 +383,7 @@ public class CommandDescription {
* Get the command reference.
*
* @param reference The reference to use as template, which is used to choose the most similar reference.
*
* @return Command reference.
*/
public CommandParts getCommandReference(CommandParts reference) {
@@ -393,6 +405,7 @@ public class CommandDescription {
* Get the difference between this command and another command reference.
*
* @param other The other command reference.
*
* @return The command difference. Zero if there's no difference. A negative number on error.
*/
public double getCommandDifference(CommandParts other) {
@@ -404,6 +417,7 @@ 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.
*/
public double getCommandDifference(CommandParts other, boolean fullCompare) {
@@ -451,6 +465,7 @@ public class CommandDescription {
* @param sender The command sender that triggered the execution of this command.
* @param commandReference The command reference.
* @param commandArguments The command arguments.
*
* @return True on success, false on failure.
*/
public boolean execute(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
@@ -489,6 +504,7 @@ public class CommandDescription {
* Set the parent command.
*
* @param parent Parent command.
*
* @return True on success, false on failure.
*/
public boolean setParent(CommandDescription parent) {
@@ -543,6 +559,7 @@ public class CommandDescription {
* Add a child to the command description.
*
* @param commandDescription The child to add.
*
* @return True on success, false on failure.
*/
public boolean addChild(CommandDescription commandDescription) {
@@ -577,6 +594,7 @@ public class CommandDescription {
* Check if this command description has a specific child.
*
* @param commandDescription The command description to check for.
*
* @return True if this command description has the specific child, false otherwise.
*/
public boolean isChild(CommandDescription commandDescription) {
@@ -594,6 +612,7 @@ public class CommandDescription {
* Add an argument.
*
* @param argument The argument to add.
*
* @return True if succeed, false if failed.
*/
public boolean addArgument(CommandArgumentDescription argument) {
@@ -636,6 +655,7 @@ public class CommandDescription {
* Check whether an argument exists.
*
* @param argument The argument to check for.
*
* @return True if this argument already exists, false otherwise.
*/
public boolean hasArgument(CommandArgumentDescription argument) {
@@ -771,6 +791,7 @@ public class CommandDescription {
* Find the best suitable command for a query reference.
*
* @param queryReference The query reference to find a command for.
*
* @return The command found, or null.
*/
public FoundCommandResult findCommand(final CommandParts queryReference) {
@@ -832,6 +853,7 @@ public class CommandDescription {
* Check whether there's any command description that matches the specified command reference.
*
* @param commandReference The command reference.
*
* @return True if so, false otherwise.
*/
public boolean hasSuitableCommand(CommandParts commandReference) {
@@ -842,6 +864,7 @@ public class CommandDescription {
* Check if the remaining command reference elements are suitable with arguments of the current command description.
*
* @param commandReference The command reference.
*
* @return True if the arguments are suitable, false otherwise.
*/
public boolean hasSuitableArguments(CommandParts commandReference) {
@@ -853,6 +876,7 @@ public class CommandDescription {
* and get the difference in argument count.
*
* @param commandReference The command reference.
*
* @return The difference in argument count between the reference and the actual command.
*/
public int getSuitableArgumentsDifference(CommandParts commandReference) {
@@ -89,6 +89,7 @@ public class CommandHandler {
* @param bukkitCommand The command (Bukkit).
* @param bukkitCommandLabel The command label (Bukkit).
* @param bukkitArgs The command arguments (Bukkit).
*
* @return True if the command was executed, false otherwise.
*/
public boolean onCommand(CommandSender sender, org.bukkit.command.Command bukkitCommand, String bukkitCommandLabel, String[] bukkitArgs) {
@@ -181,6 +182,7 @@ public class CommandHandler {
* Process the command arguments, and return them as an array list.
*
* @param args The command arguments to process.
*
* @return The processed command arguments.
*/
private List<String> processArguments(String[] args) {
@@ -575,6 +575,7 @@ public class CommandManager {
* Find the best suitable command for the specified reference.
*
* @param queryReference The query reference to find a command for.
*
* @return The command found, or null.
*/
public FoundCommandResult findCommand(CommandParts queryReference) {
@@ -71,6 +71,7 @@ public class CommandParts {
* Add a part.
*
* @param part The part to add.
*
* @return The result.
*/
public boolean add(String part) {
@@ -81,6 +82,7 @@ public class CommandParts {
* Add some parts.
*
* @param parts The parts to add.
*
* @return The result.
*/
public boolean add(List<String> parts) {
@@ -91,6 +93,7 @@ public class CommandParts {
* Add some parts.
*
* @param parts The parts to add.
*
* @return The result.
*/
public boolean add(String[] parts) {
@@ -112,6 +115,7 @@ public class CommandParts {
* Get a part by it's index.
*
* @param i Part index.
*
* @return The part.
*/
public String get(int i) {
@@ -127,6 +131,7 @@ public class CommandParts {
* Get a range of the parts starting at the specified index up to the end of the range.
*
* @param start The starting index.
*
* @return The parts range. Arguments that were out of bound are not included.
*/
public List<String> getRange(int start) {
@@ -138,6 +143,7 @@ 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.
*/
public List<String> getRange(int start, int count) {
@@ -160,6 +166,7 @@ public class CommandParts {
* Get the difference value between two references. This won't do a full compare, just the last reference parts instead.
*
* @param other The other reference.
*
* @return The result from zero to above. A negative number will be returned on error.
*/
public double getDifference(CommandParts other) {
@@ -171,6 +178,7 @@ 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.
*/
public double getDifference(CommandParts other, boolean fullCompare) {
@@ -55,6 +55,7 @@ public class CommandPermissions {
* Add a permission node required to execute this command.
*
* @param permissionNode The permission node to add.
*
* @return True on success, false on failure.
*/
public boolean addPermissionNode(String permissionNode) {
@@ -77,6 +78,7 @@ public class CommandPermissions {
* Check whether this command requires a specified permission node to execute.
*
* @param permissionNode The permission node to check for.
*
* @return True if this permission node is required, false if not.
*/
public boolean hasPermissionNode(String permissionNode) {
@@ -114,6 +116,7 @@ public class CommandPermissions {
* Check whether this command requires any permission to be executed. This is based on the getPermission() method.
*
* @param sender CommandSender
*
* @return True if this command requires any permission to be executed by a player.
*/
public boolean hasPermission(CommandSender sender) {
@@ -165,6 +168,7 @@ public class CommandPermissions {
* Get the default permission for a specified command sender.
*
* @param sender The command sender to get the default permission for.
*
* @return True if the command sender has permission by default, false otherwise.
*/
public boolean getDefaultPermissionCommandSender(CommandSender sender) {
@@ -13,6 +13,7 @@ public abstract class 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.
*/
public abstract boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments);
@@ -88,6 +88,7 @@ public class FoundCommandResult {
* Execute the command.
*
* @param sender The command sender that executed the command.
*
* @return True on success, false on failure.
*/
public boolean executeCommand(CommandSender sender) {
@@ -103,6 +104,7 @@ public class FoundCommandResult {
* Check whether a command sender has permission to execute the command.
*
* @param sender The command sender.
*
* @return True if the command sender has permission, false otherwise.
*/
public boolean hasPermission(CommandSender sender) {
@@ -17,6 +17,7 @@ public class GetEmailCommand 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.
*/
@Override
@@ -20,6 +20,7 @@ public class PurgeBannedPlayersCommand 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.
*/
@Override
@@ -20,6 +20,7 @@ public class PurgeCommand 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.
*/
@Override
@@ -19,6 +19,7 @@ public class PurgeLastPositionCommand 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.
*/
@Override
@@ -23,6 +23,7 @@ public class RegisterCommand 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.
*/
@Override
@@ -21,6 +21,7 @@ public class ReloadCommand 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.
*/
@Override
@@ -19,6 +19,7 @@ public class ResetNameCommand 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.
*/
@Override
@@ -19,6 +19,7 @@ public class SetEmailCommand 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.
*/
@Override
@@ -17,6 +17,7 @@ public class SetFirstSpawnCommand 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.
*/
@Override
@@ -17,6 +17,7 @@ public class SetSpawnCommand 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.
*/
@Override
@@ -17,6 +17,7 @@ public class SpawnCommand 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.
*/
@Override
@@ -17,6 +17,7 @@ public class SwitchAntiBotCommand 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.
*/
@Override
@@ -29,6 +29,7 @@ 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.
*/
@Override
@@ -18,6 +18,7 @@ public class VersionCommand 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.
*/
@Override
@@ -70,6 +71,7 @@ public class VersionCommand extends ExecutableCommand {
* Check whether a player is online.
*
* @param minecraftName The Minecraft player name.
*
* @return True if the player is online, false otherwise.
*/
private boolean isPlayerOnline(String minecraftName) {
@@ -20,6 +20,7 @@ public class CaptchaCommand 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.
*/
@Override
@@ -18,6 +18,7 @@ public class ConverterCommand 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.
*/
@Override
@@ -104,6 +105,7 @@ public class ConverterCommand extends ExecutableCommand {
* Method fromName.
*
* @param name String
*
* @return ConvertType
*/
public static ConvertType fromName(String name) {
@@ -18,6 +18,7 @@ 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.
*/
@Override
@@ -23,6 +23,7 @@ public final class HelpSyntaxHelper {
* @param commandReference The reference of the command.
* @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.
*/
public static String getCommandSyntax(CommandDescription commandDescription, CommandParts commandReference,