Package net.winmister332.libs.commands
Class CommandArgs
java.lang.Object
net.winmister332.libs.commands.CommandArgs
Represents the arguments that were passed to the command invoker.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsArgument(String arg) Checks if the specified argument exists anywhere in the argument array.intcount()The size of the argument array.booleanChecks if the specified argument is at the end of the argument array.getArgumentAt(int position) Gets ab argument at the specified position within the argument array.String[]Gets all the arguments that was passed to a command.intGets the index of the specified array if the argument exists anywhere within the argument array.booleanisArgumentAtPosition(int position, String argument) Checks if an argument is at the specified position within the argument array.booleanisEmpty()Checks if the length of the argument array is empty.iterator()static CommandArgsparseArguments(String rawArgs) Parse the raw argument string (without command name as that'll just be treated as an argument.static CommandArgsparseArguments(String rawArgs, boolean parseQuotes, boolean ignoreQuotes) Parse the raw argument string (without command name as that'll just be treated as an argument.intsize()The size of the argument array.booleanstartsWith(String arg) Checks if the specified argument is at the start (index 0) of the array.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
CommandArgs
-
-
Method Details
-
iterator
-
count
public int count()The size of the argument array.- Returns:
- the size of the argument array.
-
size
public int size()The size of the argument array.- Returns:
- the size of the argument array.
-
isEmpty
public boolean isEmpty()Checks if the length of the argument array is empty.- Returns:
- True if the argument array is empty.
-
getArgumentAt
Gets ab argument at the specified position within the argument array. Treat the position index as if it were an array (The first position is actually 0.)- Parameters:
position- The array-safe position within the array.- Returns:
- The string which was at the specified position.
-
getArguments
Gets all the arguments that was passed to a command.- Returns:
- See Also:
-
isArgumentAtPosition
Checks if an argument is at the specified position within the argument array.- Parameters:
position- The array-safe position.argument- The argument/string to check.- Returns:
-
containsArgument
Checks if the specified argument exists anywhere in the argument array.- Parameters:
arg- The argument to check.- Returns:
- True if the argument was found.
-
startsWith
Checks if the specified argument is at the start (index 0) of the array.- Parameters:
arg- The argument to check.- Returns:
- True if the argument existed at index 0.
-
endsWith
Checks if the specified argument is at the end of the argument array.- Parameters:
arg- The argument to check.- Returns:
- True if the argument is at the last position in the array.
-
indexOf
Gets the index of the specified array if the argument exists anywhere within the argument array.- Parameters:
arg- The argument to check.- Returns:
- The index of the array. -1 if the argument was NOT found in the array.
-
parseArguments
Parse the raw argument string (without command name as that'll just be treated as an argument.- Parameters:
rawArgs- The unprocessed arguments.- Returns:
- An instance of @see CommandArgs which contains the processed arguments.
-
parseArguments
Parse the raw argument string (without command name as that'll just be treated as an argument.- Parameters:
rawArgs- The unprocessed arguments.parseQuotes- If true, it tells the CommandArgs class to treat any data within quotes as its own argument.ignoreQuotes- If true, it tells the CommandArgs class to ignore innerquotes.- Returns:
- An instance of @see CommandArgs which contains the processed arguments.
-