commodore icon indicating copy to clipboard operation
commodore copied to clipboard

Issue with suggestions

Open DevonPalma opened this issue 7 years ago • 3 comments

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

DevonPalma avatar Oct 10 '18 21:10 DevonPalma

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 avatar Oct 16 '18 13:10 lucko

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

lucko avatar Oct 26 '18 17:10 lucko

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.

pop4959 avatar Jul 26 '19 04:07 pop4959