Record Class CommandArguments
- Record Components:
args- The arguments for this commandargsMap- The arguments for this command mapped to their node names. This is an ordered maprawArgs- The raw arguments for this command.rawArgsMap- The raw arguments for this command mapped to their node names. This is an ordered mapfullInput- The command string a player has entered (including the /)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionObject[]args()Returns the value of theargsrecord component.argsMap()Returns the value of theargsMaprecord component.intcount()final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefullInputrecord component.get(int index) Returns an argument by its positionReturns an argument by its node nameDeprecated, for removal: This API element is subject to removal in a future version.getOptional(int index) Returns anOptionalholding the argument by its indexgetOptional(String nodeName) Returns an argument by its node name<T> Optional<T>getOptionalUnchecked(int index) Returns anOptionalholding the argument at its index<T> Optional<T>getOptionalUnchecked(String nodeName) Returns anOptionalholding the argument by its node namegetOrDefault(int index, Object defaultValue) Returns an argument by its indexgetOrDefault(int index, Supplier<?> defaultValue) Returns an argument by its indexgetOrDefault(String nodeName, Object defaultValue) Returns an argument by its node namegetOrDefault(String nodeName, Supplier<?> defaultValue) Returns an argument by its node namegetOrDefaultRaw(int index, String defaultValue) Returns a raw argument by its indexgetOrDefaultRaw(int index, Supplier<String> defaultValue) Returns a raw argument by its indexgetOrDefaultRaw(String nodeName, String defaultValue) Returns a raw argument by its node namegetOrDefaultRaw(String nodeName, Supplier<String> defaultValue) Returns a raw argument by its node name<T> TgetOrDefaultUnchecked(int index, Supplier<T> defaultValue) Returns an argument by its index<T> TgetOrDefaultUnchecked(int index, T defaultValue) Returns an argument by its index<T> TgetOrDefaultUnchecked(String nodeName, Supplier<T> defaultValue) Returns an argument by its node name<T> TgetOrDefaultUnchecked(String nodeName, T defaultValue) Returns an argument by its node namegetRaw(int index) Returns a raw argument by its positionReturns a raw argument by its node namegetRawOptional(int index) Returns anOptionalholding the raw argument by its indexgetRawOptional(String nodeName) Returns anOptionalholding the raw argument by its node name<T> TgetUnchecked(int index) Returns an argument by its position<T> TgetUnchecked(String nodeName) Returns an argument by its node namefinal inthashCode()Returns a hash code value for this object.String[]rawArgs()Returns the value of therawArgsrecord component.Returns the value of therawArgsMaprecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
CommandArguments
public CommandArguments(Object[] args, Map<String, Object> argsMap, String[] rawArgs, Map<String, String> rawArgsMap, String fullInput) Creates an instance of aCommandArgumentsrecord class.- Parameters:
args- the value for theargsrecord componentargsMap- the value for theargsMaprecord componentrawArgs- the value for therawArgsrecord componentrawArgsMap- the value for therawArgsMaprecord componentfullInput- the value for thefullInputrecord component
-
-
Method Details
-
argsMap
Returns the value of theargsMaprecord component.- Returns:
- the value of the
argsMaprecord component
-
rawArgsMap
Returns the value of therawArgsMaprecord component.- Returns:
- the value of the
rawArgsMaprecord component
-
getFullInput
Deprecated, for removal: This API element is subject to removal in a future version.This method has been deprecated in favour offullInput()This returns the raw command string a player has entered- Returns:
- The raw command string a player has entered
-
count
public int count()- Returns:
- The number of arguments for this command
-
get
Returns an argument by its position- Parameters:
index- The position of this argument- Returns:
- An argument which is placed at the given index, or
nullif the provided index does not point to an argument.
-
get
Returns an argument by its node name- Parameters:
nodeName- The node name of this argument. This was set when initializing an argument- Returns:
- An argument which has the given node name. Can be
nullifnodeNamewas not found.
-
getOrDefault
Returns an argument by its index- Parameters:
index- The position of this argumentdefaultValue- The Object returned if the argument is not existent- Returns:
- An argument which is placed at the given index, or the provided default value
-
getOrDefault
Returns an argument by its node name- Parameters:
nodeName- The node name of this argument. This was set when initializing an argumentdefaultValue- The Object returned if the argument was not found.- Returns:
- The argument with the specified node name or the provided default value
-
getOrDefault
Returns an argument by its index- Parameters:
index- The position of this argumentdefaultValue- The Object returned if the argument is not existent- Returns:
- An argument which is placed at the given index, or the provided default value
-
getOrDefault
Returns an argument by its node name- Parameters:
nodeName- The node name of this argument. This was set when initializing an argumentdefaultValue- The Object returned if the argument was not found.- Returns:
- The argument with the specified node name or the provided default value
-
getOptional
Returns anOptionalholding the argument by its index- Parameters:
index- The position of this argument- Returns:
- An optional holding the argument which is placed at the given index, or an empty optional if index is invalid
-
getOptional
Returns an argument by its node name- Parameters:
nodeName- The node name of this argument. This was set when initializing an argument- Returns:
- An optional holding the argument with the specified node name or an empty optional if the node name was not found
-
getRaw
Returns a raw argument by its positionA raw argument is the
Stringform of an argument as written in a command. For example take this command:/mycommand @e 15.3When using this method to access these arguments,
@eand15.3will be available asStrings and not as aCollectionandDouble- Parameters:
index- The position of this argument- Returns:
- An argument which is placed at the given index, or
nullif the provided index does not point to an argument.
-
getRaw
Returns a raw argument by its node nameA raw argument is the
Stringform of an argument as written in a command. For example take this command:/mycommand @e 15.3When using this method to access these arguments,
@eand15.3will be available asStrings and not as aCollectionandDouble- Parameters:
nodeName- The node name of this argument. This was set when initializing an argument- Returns:
- A raw argument which has the given node name. Can be
nullifnodeNamewas not found.
-
getOrDefaultRaw
Returns a raw argument by its indexA raw argument is the
Stringform of an argument as written in a command. For example take this command:/mycommand @e 15.3When using this method to access these arguments,
@eand15.3will be available asStrings and not as aCollectionandDouble- Parameters:
index- The position of this argumentdefaultValue- The String returned if the raw argument is not existent- Returns:
- A raw argument which is placed at the given index, or the provided default value
-
getOrDefaultRaw
Returns a raw argument by its node nameA raw argument is the
Stringform of an argument as written in a command. For example take this command:/mycommand @e 15.3When using this method to access these arguments,
@eand15.3will be available asStrings and not as aCollectionandDouble- Parameters:
nodeName- The node name of this argument. This was set when initializing an argumentdefaultValue- The String returned if the raw argument was not found.- Returns:
- A raw argument with the specified node name or the provided default value
-
getOrDefaultRaw
Returns a raw argument by its indexA raw argument is the
Stringform of an argument as written in a command. For example take this command:/mycommand @e 15.3When using this method to access these arguments,
@eand15.3will be available asStrings and not as aCollectionandDouble- Parameters:
index- The position of this argumentdefaultValue- The String returned if the raw argument is not existent- Returns:
- A raw argument which is placed at the given index, or the provided default value
-
getOrDefaultRaw
Returns a raw argument by its node nameA raw argument is the
Stringform of an argument as written in a command. For example take this command:/mycommand @e 15.3When using this method to access these arguments,
@eand15.3will be available asStrings and not as aCollectionandDouble- Parameters:
nodeName- The node name of this raw argument. This was set when initializing an argumentdefaultValue- The String returned if the raw argument was not found.- Returns:
- A raw argument with the specified node name or the provided default value
-
getRawOptional
Returns anOptionalholding the raw argument by its indexA raw argument is the
Stringform of an argument as written in a command. For example take this command:/mycommand @e 15.3When using this method to access these arguments,
@eand15.3will be available asStrings and not as aCollectionandDouble- Parameters:
index- The position of this argument- Returns:
- An optional holding the raw argument which is placed at the given index, or an empty optional if index is invalid
-
getRawOptional
Returns anOptionalholding the raw argument by its node nameA raw argument is the
Stringform of an argument as written in a command. For example take this command:/mycommand @e 15.3When using this method to access these arguments,
@eand15.3will be available asStrings and not as aCollectionandDouble- Parameters:
nodeName- The node name of this argument. This was set when initializing an argument- Returns:
- An optional holding the argument with the specified node name or an empty optional if the node name was not found
-
getUnchecked
@Nullable public <T> T getUnchecked(int index) Returns an argument by its position- Parameters:
index- The position of this argument- Returns:
- An argument which is placed at the given index, or
nullif the provided index does not point to an argument.
-
getUnchecked
Returns an argument by its node name- Parameters:
nodeName- The node name of this argument. This was set when initializing an argument- Returns:
- An argument which has the given node name. Can be null if
nodeNamewas not found.
-
getOrDefaultUnchecked
public <T> T getOrDefaultUnchecked(int index, T defaultValue) Returns an argument by its index- Parameters:
index- The position of this argumentdefaultValue- The Object returned if the argument is not existent- Returns:
- An argument which is placed at the given index, or the provided default value
-
getOrDefaultUnchecked
Returns an argument by its node name- Parameters:
nodeName- The node name of this argument. This was set when initializing an argumentdefaultValue- The Object returned if the argument was not found.- Returns:
- The argument with the specified node name or the provided default value
-
getOrDefaultUnchecked
Returns an argument by its index- Parameters:
index- The position of this argumentdefaultValue- The Object returned if the argument is not existent- Returns:
- An argument which is placed at the given index, or the provided default value
-
getOrDefaultUnchecked
Returns an argument by its node name- Parameters:
nodeName- The node name of this argument. This was set when initializing an argumentdefaultValue- The Object returned if the argument was not found.- Returns:
- The argument with the specified node name or the provided default value
-
getOptionalUnchecked
Returns anOptionalholding the argument at its index- Parameters:
index- The position of this argument- Returns:
- An optional holding the argument at its index, or an empty optional if the index was invalid
-
getOptionalUnchecked
Returns anOptionalholding the argument by its node name- Parameters:
nodeName- The node name of this argument. This was set when initializing an argument- Returns:
- An optional holding the argument with the specified node name, or an empty optional if the index was invalid
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
args
Returns the value of theargsrecord component.- Returns:
- the value of the
argsrecord component
-
rawArgs
Returns the value of therawArgsrecord component.- Returns:
- the value of the
rawArgsrecord component
-
fullInput
Returns the value of thefullInputrecord component.- Returns:
- the value of the
fullInputrecord component
-
fullInput()