Record Class Result<T>

java.lang.Object
java.lang.Record
dev.jorel.commandapi.arguments.parser.Result<T>
Type Parameters:
T - The type of object held as a return result.
Record Components:
value - The result of parsing input, if the parse was successful.
exception - The CommandSyntaxException thrown, if the parse failed.
suggestionsStart - The point in the input StringReader where the suggestions should be placed.
suggestions - The SuggestionProvider object that will generate the suggestions.

public record Result<T>(T value, com.mojang.brigadier.exceptions.CommandSyntaxException exception, int suggestionsStart, SuggestionProvider suggestions) extends Record
Holds the information that results from a Parser parsing input. A parse either creates an object or throws a CommandSyntaxException explaining why it couldn't create its object. The result may optionally provide suggestions, which includes the point in the string where the suggestions should be placed and the SuggestionProvider that will generate the suggestions.

Results can be constructed with the following methods:

Additionally, a Result object with the same value but different suggestions can be created using withSuggestions(int, SuggestionProvider).

The information of a Result can be accessed directly using value(), exception(), suggestionsStart(), or suggestions(). Additionally, the information can be interacted with using throwOrReturn() or continueWith(Function, Function).