✨ Add flag support to the annotation system.
This commit is contained in:
parent
782f3023fc
commit
c67619e5da
9 changed files with 214 additions and 2 deletions
|
|
@ -58,6 +58,8 @@ class AnnotationParserTest {
|
|||
manager.executeCommand(new TestCommandSender(), "proxycommand 10").join();
|
||||
Assertions.assertThrows(CompletionException.class, () ->
|
||||
manager.executeCommand(new TestCommandSender(), "test 101").join());
|
||||
manager.executeCommand(new TestCommandSender(), "flagcommand -p").join();
|
||||
manager.executeCommand(new TestCommandSender(), "flagcommand --print --word peanut").join();
|
||||
}
|
||||
|
||||
@ProxiedBy("proxycommand")
|
||||
|
|
@ -69,4 +71,13 @@ class AnnotationParserTest {
|
|||
System.out.printf("Received int: %d and string '%s'\n", argument, string);
|
||||
}
|
||||
|
||||
@CommandMethod("flagcommand")
|
||||
public void testFlags(final TestCommandSender sender,
|
||||
@Flag(value = "print", aliases = "p") boolean print,
|
||||
@Flag(value = "word", aliases = "w") String word) {
|
||||
if (print) {
|
||||
System.out.println(word);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue