commands icon indicating copy to clipboard operation
commands copied to clipboard

Allow per-parameter tab completion

Open lus opened this issue 4 years ago • 3 comments

Hello. I define the following command:

@Subcommand("create")
    public CompletableFuture<Punishment> handlePunishmentCreateCommand(CommandSender sender, Player target, PunishmentType type, int duration, String reason) { //... }

and I see that this framework automatically includes the tab completion for PunishmentType, which is an enum, but does not automatically suggest players for the target parameter. Now I need to register tab completion just for this exact parameter to make it functional, but I could not find any way to do so.

It would be nice if that could be implemented.

Kind regards, Lukas

lus avatar Oct 15 '20 00:10 lus

You should annotate Player target with @Flags("other") Player target or use the wrapper class OnlinePlayer insted to tell acf that you want to resolve the player object from an argument. With your current implementation acf transforms the command issuer to the player object.

With that the command completions should work fine

Joo200 avatar Oct 15 '20 11:10 Joo200

Ooh, that sounds reasonable to me. I'll try it asap. Thank you very much!

lus avatar Oct 15 '20 11:10 lus

Now I am using the other flag and I can punish players on that server but the tab completion still doesn't work.

lus avatar Oct 15 '20 11:10 lus