Class FlagArgumentType<S extends CommandSource>
java.lang.Object
studio.mevera.imperat.util.TypeCapturer
studio.mevera.imperat.command.arguments.type.ArgumentType<S,ParsedFlagArgument<S>>
studio.mevera.imperat.command.arguments.type.FlagArgumentType<S>
- All Implemented Interfaces:
Prioritizable
public class FlagArgumentType<S extends CommandSource>
extends ArgumentType<S,ParsedFlagArgument<S>>
-
Field Summary
Fields inherited from class studio.mevera.imperat.command.arguments.type.ArgumentType
suggestions, type -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetNumberOfParametersToConsume(Argument<S> argument) Returns the number of arguments consumed by this parameter type.Returns the suggestion resolver associated with this parameter type.Parses the argument value from the given input string, using the provided execution context.parse(@NotNull ExecutionContext<S> context, @NotNull Cursor<S> cursor) Parses the argument value from the current position of the cursor, using the provided execution context.Methods inherited from class studio.mevera.imperat.command.arguments.type.ArgumentType
addStaticSuggestions, equalsExactly, getDefaultValueProvider, getPriority, isGreedy, isRelatedToType, type, wrappedTypeMethods inherited from class studio.mevera.imperat.util.TypeCapturer
extractType, extractType
-
Constructor Details
-
FlagArgumentType
-
-
Method Details
-
parse
public ParsedFlagArgument<S> parse(@NotNull @NotNull CommandContext<S> context, @NotNull @NotNull Argument<S> argument, @NotNull @NotNull String input) throws CommandException Description copied from class:ArgumentTypeParses the argument value from the given input string, using the provided execution context. This method is responsible for converting the raw input into the appropriate type, handling any necessary validation or error handling during the parsing process.- Specified by:
parsein classArgumentType<S extends CommandSource,ParsedFlagArgument<S extends CommandSource>> - Parameters:
context- the execution context.argument- the argument with this type.input- the raw input string to parse.- Returns:
- the resolved value of type T.
- Throws:
CommandException- if parsing fails.
-
parse
public ParsedFlagArgument<S> parse(@NotNull @NotNull ExecutionContext<S> context, @NotNull @NotNull Cursor<S> cursor) throws CommandException Description copied from class:ArgumentTypeParses the argument value from the current position of the cursor, using the provided execution context. This method fetches the input from the cursor and delegates toArgumentType.parse(CommandContext, Argument, String). This is the main entry point for argument parsing during command execution.- Overrides:
parsein classArgumentType<S extends CommandSource,ParsedFlagArgument<S extends CommandSource>> - Parameters:
context- the execution context.cursor- the command input stream.- Returns:
- the resolved value of type T.
- Throws:
CommandException- if parsing fails.
-
getSuggestionProvider
Description copied from class:ArgumentTypeReturns the suggestion resolver associated with this parameter type.- Overrides:
getSuggestionProviderin classArgumentType<S extends CommandSource,ParsedFlagArgument<S extends CommandSource>> - Returns:
- the suggestion resolver for generating suggestions based on the parameter type.
-
getNumberOfParametersToConsume
Description copied from class:ArgumentTypeReturns the number of arguments consumed by this parameter type. By default, returns1.- Overrides:
getNumberOfParametersToConsumein classArgumentType<S extends CommandSource,ParsedFlagArgument<S extends CommandSource>> - Returns:
- the number of consumed arguments.
-