lucko / commodore

Utility for using Minecraft's 1.13 'brigadier' library in Bukkit plugins.
MIT License
175 stars 15 forks source link

Issue with suggestions #2

Open DevonPalma opened 5 years ago

DevonPalma commented 5 years ago

So I'm attempting to add suggestions to the commands like so

public class Commands {
    public static void register(PluginCommand command, Commodore commodore) {
        LiteralArgumentBuilder<Object> commandBuild = LiteralArgumentBuilder.literal("foo")
                .then(
                    RequiredArgumentBuilder.argument("bar", StringArgumentType.string())
                        .suggests((context, builder) -> {
                            builder.suggest("bara");
                            builder.suggest("barb");
                            return builder.buildFuture();
                        })
                );
        commodore.register(command, commandBuild);

    }
}

However when doing so, the only time a player is able to actually properly use the tab completion is when you reload the server while the players are online. If a player is to (re)join in, then it requires a reload in order for them to tab complete

lucko commented 5 years ago

This is likely due to the way Spigot/CB sends the command data, I'm not totally sure and need to look into it a bit more.

lucko commented 5 years ago

This may be fixed in version 1.3 - I've improved the way arguments are registered.

pop4959 commented 5 years ago

It looks like this is still an issue in version 1.3. Also occurs if you use JavaPlugin::onTabComplete from the Bukkit API (and in a similar fashion, reloading with players online seems to temporarily fix it). Just thought I'd share my findings.