-
-
Notifications
You must be signed in to change notification settings - Fork 150
Command Completions
When a user inputs a command into a system that supports tab completion (All of our supported platforms do), when you type a partial command, ACF can programmatically build suggestions into what the user is wanting to complete to.
This may be sub commands, or input into your defined command such as online players, enum values, etc.
When using your own custom context objects, you can define a matching completion handler to provide completion values.
Special Completion Handlers are prefixed @ like @foo, you may tack on additional config data by then using : followed by a comma separated list of key/value configs, like so:
@foo:foo=bar,baz=qux
The context handler can then do c.getConfig("foo") to get bar, and c.getConfig("baz") to get qux.
To register your own custom ones, one would do
manager.getCommandCompletions().registerCompletion("foo", c -> {
return ImmutableList.of("some", "custom", "completion");
});
-
@nothing
- returns nothing -
@range
- takes a completion, pass range like so@range:0-20
or@range:20
(assumed 0 start)
-
@mobs
- list of EntityType enum values (Bukkit) -
@chatcolors
- lists of all the chat colors supported by your platform (Bukkit, Bungee) -
@worlds
- lists all world names (Bukkit) -
@players
- lists all online players that you can see (depending on platform API/vanish) (Bukkit, Bungee(no vanish))