Make CommandMethod applicable to class
This commit is contained in:
parent
6cd1105642
commit
730e78e212
3 changed files with 21 additions and 4 deletions
|
|
@ -37,6 +37,7 @@ import cloud.commandframework.context.CommandContext;
|
|||
import cloud.commandframework.meta.SimpleCommandMeta;
|
||||
import io.leangen.geantyref.TypeToken;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
import java.util.Set;
|
||||
|
|
@ -91,7 +92,9 @@ class AnnotationParserTest {
|
|||
(injector, builder) -> builder.argument(IntegerArgument.of(injector.value()))
|
||||
);
|
||||
/* Parse the class. Required for both testMethodConstruction() and testNamedSuggestionProvider() */
|
||||
commands = annotationParser.parse(this);
|
||||
commands = new ArrayList<>();
|
||||
commands.addAll(annotationParser.parse(this));
|
||||
commands.addAll(annotationParser.parse(new ClassCommandMethod()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -104,6 +107,7 @@ class AnnotationParserTest {
|
|||
manager.executeCommand(new TestCommandSender(), "test 101").join());
|
||||
manager.executeCommand(new TestCommandSender(), "flagcommand -p").join();
|
||||
manager.executeCommand(new TestCommandSender(), "flagcommand --print --word peanut").join();
|
||||
manager.executeCommand(new TestCommandSender(), "class method").join();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -253,6 +257,16 @@ class AnnotationParserTest {
|
|||
System.out.printf("Injected value: %s\n", injectableValue.toString());
|
||||
}
|
||||
|
||||
@CommandMethod("class")
|
||||
private static class ClassCommandMethod {
|
||||
|
||||
@CommandMethod("method")
|
||||
public void annotatedMethod() {
|
||||
System.out.println("kekw");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@CommandPermission("some.permission")
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue