Package xyz.srnyx.annoyingapi
Class Arguments
- java.lang.Object
-
- xyz.srnyx.javautilities.parents.Stringable
-
- xyz.srnyx.annoyingapi.Arguments
-
- Direct Known Subclasses:
AnnoyingSender
public class Arguments extends xyz.srnyx.javautilities.parents.StringableA utility class for managing arguments
-
-
Field Summary
Fields Modifier and Type Field Description @Nullable java.lang.String[]argsThe arguments
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanargEquals(int index, @Nullable java.lang.String... strings)Returns if the specifiedargsindex is equal to any of the specified strings (case-insensitive)@Nullable java.lang.StringgetArgument(int index)Gets the argument at the specified index@NotNull java.util.Optional<java.lang.String>getArgumentOptional(int index)Gets the argument at the specified index as anOptional@NotNull java.lang.StringgetArgumentsJoined()Gets all arguments joined together
If no arguments are found, it returns an empty string@NotNull java.lang.StringgetArgumentsJoined(int start)Gets multiple arguments joined together starting from the specified index
If no arguments are found, it returns an empty string@NotNull java.lang.StringgetArgumentsJoined(int start, int end)Gets multiple arguments joined together starting from the specified index and ending at the specified index (if too high, it will stop at the last argument)
If no arguments are found, it returns an empty string
-
-
-
Constructor Detail
-
Arguments
public Arguments(@Nullable @Nullable java.lang.String[] args)Construct a newArgumentswith the specified arguments- Parameters:
args- the arguments
-
-
Method Detail
-
argEquals
public boolean argEquals(int index, @Nullable @Nullable java.lang.String... strings)Returns if the specifiedargsindex is equal to any of the specified strings (case-insensitive)- Parameters:
index- the argument indexstrings- the strings to compare to- Returns:
trueif the specifiedargsindex is equal to any of the specified strings (case-insensitive)
-
getArgument
@Nullable public @Nullable java.lang.String getArgument(int index)
Gets the argument at the specified index- Parameters:
index- the argument index- Returns:
- the argument at the specified index
-
getArgumentOptional
@NotNull public @NotNull java.util.Optional<java.lang.String> getArgumentOptional(int index)
Gets the argument at the specified index as anOptional- Parameters:
index- the argument index- Returns:
- the argument at the specified index as an
Optional
-
getArgumentsJoined
@NotNull public @NotNull java.lang.String getArgumentsJoined(int start, int end)Gets multiple arguments joined together starting from the specified index and ending at the specified index (if too high, it will stop at the last argument)
If no arguments are found, it returns an empty string- Parameters:
start- the starting indexend- the ending index- Returns:
- the arguments joined together
-
getArgumentsJoined
@NotNull public @NotNull java.lang.String getArgumentsJoined(int start)
Gets multiple arguments joined together starting from the specified index
If no arguments are found, it returns an empty string- Parameters:
start- the starting index- Returns:
- the arguments joined together
-
getArgumentsJoined
@NotNull public @NotNull java.lang.String getArgumentsJoined()
Gets all arguments joined together
If no arguments are found, it returns an empty string- Returns:
- all arguments joined together
-
-