[go: nahoru, domu]

Skip to content

Command Suggestions

Mazen edited this page May 7, 2023 · 1 revision

Adding your own suggestions

To add specific things to suggest while pressing tab to complete the argument, you need to use Argument#suggest(T suggestionThing) where T is the type of the argument

here's a simple example of creating an argument with suggestions:

Argument.word("test")
.suggest("obama")
.suggest("7mada");

Annotated suggestions

Simply by using @Suggest here's a friendly example:

@Command(name = "example")
public class TestAnnotatedCommand {

	@CommandSyntaxMeta(syntax = "<firstArg>")
	public void firstArgumentExample(@NotNull CommandSender sender,
	                                 @NotNull @Arg(id= "firstArg") @Suggest({"first", "first2", "first3"}) String firstArg) {
		sender.sendMessage(firstArg);
	}

}