Usage
Custom Suggestions
You can easily override tab completions/command suggestions the arguments have.
Basic Usage
Suggestions use the Suggestion
data class, which have a title and a tooltip. You can override suggestions by using the addSuggestion
method on arguments:
new StellarCommand("test")
.addStringArgument("string")
.addSuggestion(
new Suggestion("string", "description")
); // or addSuggestion(title, description) to add a single suggestion
Or with an execution that returns a list of Suggestion:
new StellarCommand("test")
.addStringArgument("string")
.addSuggestion(Player.class, (commandContext, s) -> {
return List.of(new Suggestion("title", "description"));
});
Additionally, you can create an empty suggestion with Suggestion.empty()
, which creates a Suggestion
with an empty title and a null description. Any suggestions with blank (no text) titles will not be included, and any null descriptions will just not render.