commands
commands copied to clipboard
Allow per-parameter tab completion
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
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
Ooh, that sounds reasonable to me. I'll try it asap. Thank you very much!
Now I am using the other
flag and I can punish players on that server but the tab completion still doesn't work.