✨ Merge pull request #43
* ✨ Add a new caption system to allow for the configuration of… * ✨ Add caption support to all numerical types * Add more standard pasres to the registry * Add default messages for captions * ✨ Improve captions in core * Add captions for Bukkit * ✨ Add FactoryDelegatingCaptionRegistry.java
This commit is contained in:
parent
378d57964f
commit
6ab1c8a2e0
46 changed files with 1482 additions and 200 deletions
|
|
@ -34,6 +34,7 @@ import cloud.commandframework.arguments.parser.ParserParameter;
|
|||
import cloud.commandframework.arguments.parser.ParserParameters;
|
||||
import cloud.commandframework.arguments.parser.StandardParameters;
|
||||
import cloud.commandframework.arguments.preprocessor.RegexPreprocessor;
|
||||
import cloud.commandframework.captions.Caption;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import cloud.commandframework.execution.CommandExecutionHandler;
|
||||
import cloud.commandframework.extra.confirmation.CommandConfirmationManager;
|
||||
|
|
@ -97,7 +98,10 @@ public final class AnnotationParser<C> {
|
|||
this.flagExtractor = new FlagExtractor(manager);
|
||||
this.registerAnnotationMapper(CommandDescription.class, d ->
|
||||
ParserParameters.single(StandardParameters.DESCRIPTION, d.value()));
|
||||
this.registerPreprocessorMapper(Regex.class, annotation -> RegexPreprocessor.of(annotation.value()));
|
||||
this.registerPreprocessorMapper(Regex.class, annotation -> RegexPreprocessor.of(
|
||||
annotation.value(),
|
||||
Caption.of(annotation.failureCaption())
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -46,4 +46,12 @@ public @interface Regex {
|
|||
*/
|
||||
@NonNull String value();
|
||||
|
||||
/**
|
||||
* Key for the caption used to generate the failure exception.
|
||||
* Defaults to {@link cloud.commandframework.captions.StandardCaptionKeys#ARGUMENT_PARSE_FAILURE_REGEX}
|
||||
*
|
||||
* @return Failure caption key
|
||||
*/
|
||||
@NonNull String failureCaption() default "argument.parse.failure.regex";
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue