Add asynchronous tab completion to the paper module
This commit is contained in:
parent
9d5f007e37
commit
6f0dba0bf0
14 changed files with 203 additions and 21 deletions
|
|
@ -88,6 +88,12 @@ public final class BukkitTest extends JavaPlugin {
|
|||
getLogger().warning("Failed to initialize Brigadier support: " + e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
((PaperCommandManager<CommandSender>) mgr).registerAsynchronousCompletions();
|
||||
} catch (final Throwable e) {
|
||||
getLogger().warning("Failed to register asynchronous command completions: " + e.getMessage());
|
||||
}
|
||||
|
||||
final AnnotationParser<CommandSender> annotationParser
|
||||
= new AnnotationParser<>(mgr, CommandSender.class, p ->
|
||||
BukkitCommandMetaBuilder.builder().withDescription(p.get(StandardParameters.DESCRIPTION,
|
||||
|
|
@ -180,7 +186,8 @@ public final class BukkitTest extends JavaPlugin {
|
|||
@CommandMethod(value = "annotation|a <input> [number]", permission = "some.permission.node")
|
||||
private void annotatedCommand(@Nonnull final Player player,
|
||||
@Argument("input") @Completions("one,two,duck") @Nonnull final String input,
|
||||
@Argument("number") @Range(min = "10", max = "100") final int number) {
|
||||
@Argument(value = "number", defaultValue = "5") @Range(min = "10", max = "100")
|
||||
final int number) {
|
||||
player.sendMessage(ChatColor.GOLD + "Your input was: " + ChatColor.AQUA + input + ChatColor.GREEN + " (" + number + ")");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue