annotations: Also apply builder modifiers from class (#303)
This commit is contained in:
parent
a92ff9d39a
commit
3df3560d91
2 changed files with 6 additions and 1 deletions
|
|
@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Changed
|
||||
- Added `executeFuture` to `CommandExecutionHandler` which is now used internally. By default, this delegates to the old
|
||||
`execute` method
|
||||
- Annotations: Apply builder modifiers from class annotations ([#303](https://github.com/Incendo/cloud/pull/303))
|
||||
|
||||
### Fixed
|
||||
- Bukkit: Permission checking and syntax string for Bukkit '/help' command
|
||||
|
|
|
|||
|
|
@ -522,7 +522,10 @@ public final class AnnotationParser<C> {
|
|||
for (final CommandFlag<?> flag : flags) {
|
||||
builder = builder.flag(flag);
|
||||
}
|
||||
for (final Annotation annotation : method.getDeclaredAnnotations()) {
|
||||
|
||||
/* Apply builder modifiers */
|
||||
for (final Annotation annotation
|
||||
: AnnotationAccessor.of(classAnnotations, AnnotationAccessor.of(method)).annotations()) {
|
||||
@SuppressWarnings("rawtypes")
|
||||
final BiFunction builderModifier = this.builderModifiers.get(annotation.annotationType());
|
||||
if (builderModifier == null) {
|
||||
|
|
@ -530,6 +533,7 @@ public final class AnnotationParser<C> {
|
|||
}
|
||||
builder = (Command.Builder<C>) builderModifier.apply(annotation, builder);
|
||||
}
|
||||
|
||||
/* Construct and register the command */
|
||||
final Command<C> builtCommand = builder.build();
|
||||
commands.add(builtCommand);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue