diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fac41c2..d729c56b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/cloud-annotations/src/main/java/cloud/commandframework/annotations/AnnotationParser.java b/cloud-annotations/src/main/java/cloud/commandframework/annotations/AnnotationParser.java index a78ffbd2..dccc0054 100644 --- a/cloud-annotations/src/main/java/cloud/commandframework/annotations/AnnotationParser.java +++ b/cloud-annotations/src/main/java/cloud/commandframework/annotations/AnnotationParser.java @@ -522,7 +522,10 @@ public final class AnnotationParser { 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 { } builder = (Command.Builder) builderModifier.apply(annotation, builder); } + /* Construct and register the command */ final Command builtCommand = builder.build(); commands.add(builtCommand);