Interface ParserLiteral
- All Superinterfaces:
Parser<Result.Void>
- All Known Implementing Classes:
ParserLiteral.WithSuggestions
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A
FunctionalInterface with abstract method read(StringReader).
This extends Parser<Result.Void>, so it only
reads from the input StringReader and doesn't return any specific object
when successful.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordAParserLiteralthat also places suggestions at the cursor of theStringReaderwhen invoked. -
Method Summary
Modifier and TypeMethodDescriptiondefault Result<Result.Void> getResult(com.mojang.brigadier.StringReader reader) Parses the given input.voidread(com.mojang.brigadier.StringReader reader) Reads from the given input and either returns successfully or throws an exception explaining why the input could not be interpreted.default ParserLiteral.WithSuggestionssuggests(SuggestionProvider suggestions) Adds suggestions to theResultof thisParserLiteral.Methods inherited from interface dev.jorel.commandapi.arguments.parser.Parser
listSuggestions, parse
-
Method Details
-
read
void read(com.mojang.brigadier.StringReader reader) throws com.mojang.brigadier.exceptions.CommandSyntaxException Reads from the given input and either returns successfully or throws an exception explaining why the input could not be interpreted.- Parameters:
reader- TheStringReaderthat holds the input to parse.- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException- If the input is malformed.
-
getResult
Description copied from interface:ParserParses the given input. The returnedResultmust either have a value or an exception.- Specified by:
getResultin interfaceParser<Result.Void>- Parameters:
reader- TheStringReaderthat holds the input to parse.- Returns:
- A
Resultobject holding information about the parse.
-
suggests
Adds suggestions to theResultof thisParserLiteral. The suggestions will be placed where the cursor of theStringReaderwas when the parser was invoked.- Parameters:
suggestions- TheSuggestionProviderobject that will generate the suggestions.- Returns:
- A
ParserLiteral.WithSuggestionsobject to continue the building process with.
-