Record Class ParserArgument.WithSuggestions<T>
java.lang.Object
java.lang.Record
dev.jorel.commandapi.arguments.parser.ParserArgument.WithSuggestions<T>
- Type Parameters:
T- The type of object thatparse(StringReader)returns.- Record Components:
base- TheParserArgumentthat defines the parsing behavior.suggestions- TheSuggestionProviderthat will generate the suggestions.
- All Implemented Interfaces:
Parser<T>,ParserArgument<T>
- Enclosing interface:
ParserArgument<T>
public static record ParserArgument.WithSuggestions<T>(ParserArgument<T> base, SuggestionProvider suggestions)
extends Record
implements ParserArgument<T>
A
ParserArgument that also places suggestions at the cursor of the StringReader when invoked.-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.jorel.commandapi.arguments.parser.ParserArgument
ParserArgument.WithSuggestions<T> -
Constructor Summary
ConstructorsConstructorDescriptionWithSuggestions(ParserArgument<T> base, SuggestionProvider suggestions) Creates an instance of aWithSuggestionsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbase()Returns the value of thebaserecord component.final booleanIndicates whether some other object is "equal to" this one.getResult(com.mojang.brigadier.StringReader reader) Parses the given input.final inthashCode()Returns a hash code value for this object.parse(com.mojang.brigadier.StringReader reader) Parses the given input and either returns the corresponding object or throws an exception explaining why the input could not be interpreted.Returns the value of thesuggestionsrecord component.suggests(SuggestionProvider suggestions) Adds suggestions to theResultof thisParserArgument.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.jorel.commandapi.arguments.parser.Parser
listSuggestions
-
Constructor Details
-
WithSuggestions
Creates an instance of aWithSuggestionsrecord class.- Parameters:
base- the value for thebaserecord componentsuggestions- the value for thesuggestionsrecord component
-
-
Method Details
-
parse
public T parse(com.mojang.brigadier.StringReader reader) throws com.mojang.brigadier.exceptions.CommandSyntaxException Description copied from interface:ParserParses the given input and either returns the corresponding object or throws an exception explaining why the input could not be interpreted.- Specified by:
parsein interfaceParser<T>- Specified by:
parsein interfaceParserArgument<T>- Parameters:
reader- TheStringReaderthat holds the input to parse.- Returns:
- The object represented by the given input.
- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException- If the input is malformed.
-
getResult
-
suggests
Description copied from interface:ParserArgumentAdds suggestions to theResultof thisParserArgument. The suggestions will be placed where the cursor of theStringReaderwas when the parser was invoked.- Specified by:
suggestsin interfaceParserArgument<T>- Parameters:
suggestions- TheSuggestionProviderobject that will generate the suggestions.- Returns:
- A
ParserArgument.WithSuggestionsobject to continue the building process with.
-
toString
-
hashCode
-
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). -
base
-
suggestions
Returns the value of thesuggestionsrecord component.- Returns:
- the value of the
suggestionsrecord component
-