Annotation Type Parser
-
@Target(METHOD) @Retention(RUNTIME) public @interface Parser
This annotation allows you to create annotated methods that behave like argument parsers. The method must have this exact signature:﹫Parser("name") // Name may be left out public ParsedType methodName(CommandContext<YourSender> sender, Queue<String> input) { }
The method can throw exceptions, and the thrown exceptions will automatically be wrapped by a
ArgumentParseResult.failure(Throwable)
- Since:
- 1.3.0
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.String
name
The name of the parser.java.lang.String
suggestions
Name of the suggestions provider to use.
-
-
-
-
suggestions
java.lang.String suggestions
Name of the suggestions provider to use. If the string is left empty, the default provider for theArgument
will be used. Otherwise, theParserRegistry
instance in theCommandManager
will be queried for a matching suggestion provider.For this to work, the suggestion needs to be registered in the parser registry. To do this, use
ParserRegistry.registerSuggestionProvider(String, BiFunction)
. The registry instance can be retrieved usingCommandManager.getParserRegistry()
.- Returns:
- The name of the suggestion provider, or
""
- Default:
- ""
-
-