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 1e460631..1f02c75a 100644 --- a/cloud-annotations/src/main/java/cloud/commandframework/annotations/AnnotationParser.java +++ b/cloud-annotations/src/main/java/cloud/commandframework/annotations/AnnotationParser.java @@ -49,6 +49,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import java.lang.annotation.Annotation; import java.lang.reflect.Method; +import java.lang.reflect.Modifier; import java.lang.reflect.Parameter; import java.util.ArrayList; import java.util.Arrays; @@ -243,6 +244,12 @@ public final class AnnotationParser { method.getName() )); } + if (Modifier.isStatic(method.getModifiers())) { + throw new IllegalArgumentException(String.format( + "@CommandMethod annotated method '%s' is static! @CommandMethod annotated methods should not be static.", + method.getName() + )); + } commandMethodPairs.add(new CommandMethodPair(method, commandMethod)); } final Collection> commands = this.construct(instance, commandMethodPairs); diff --git a/cloud-core/src/main/java/cloud/commandframework/Command.java b/cloud-core/src/main/java/cloud/commandframework/Command.java index 35b7faf5..4d965ed8 100644 --- a/cloud-core/src/main/java/cloud/commandframework/Command.java +++ b/cloud-core/src/main/java/cloud/commandframework/Command.java @@ -639,7 +639,7 @@ public class Command { * Specify a required sender type * * @param senderType Required sender type - * @return New builder instance using the command execution handler + * @return New builder instance using the required sender type */ public @NonNull Builder senderType(final @NonNull Class senderType) { return new Builder<>(