Package co.aikar.commands
Class CommandCompletions<C extends CommandCompletionContext>
java.lang.Object
co.aikar.commands.CommandCompletions<C>
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
static class
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionRegistr a completion handler to provide command completions based on the user input.registerCompletion
(String id, CommandCompletions.CommandCompletionHandler<C> handler) Registr a completion handler to provide command completions based on the user input.registerStaticCompletion
(String id, String list) Register a static list of command completions that will never change.registerStaticCompletion
(String id, String[] completions) Register a static list of command completions that will never changeregisterStaticCompletion
(String id, Collection<String> completions) Register a static list of command completions that will never changeregisterStaticCompletion
(String id, Supplier<Collection<String>> supplier) Register a static list of command completions that will never change.void
setDefaultCompletion
(String id, Class... classes) Registers a completion handler such as @players to default apply to all command parameters of the specified typesUnregister a completion handler.
-
Constructor Details
-
CommandCompletions
-
-
Method Details
-
registerCompletion
public CommandCompletions.CommandCompletionHandler registerCompletion(String id, CommandCompletions.CommandCompletionHandler<C> handler) Registr a completion handler to provide command completions based on the user input.- Parameters:
id
-handler
-- Returns:
-
unregisterCompletion
Unregister a completion handler.- Parameters:
id
-- Returns:
- Throws:
IllegalStateException
- If the completion couldn't be found
-
registerAsyncCompletion
public CommandCompletions.CommandCompletionHandler registerAsyncCompletion(String id, CommandCompletions.AsyncCommandCompletionHandler<C> handler) Registr a completion handler to provide command completions based on the user input. This handler is declared to be safe to be executed asynchronously.Not all platforms support this, so if the platform does not support asynchronous execution, your handler will be executed on the main thread.
Use this anytime your handler does not need to access state that is not considered thread safe.
Use context.isAsync() to determine if you are async or not.
- Parameters:
id
-handler
-- Returns:
-
registerStaticCompletion
Register a static list of command completions that will never change. Like @CommandCompletion, values are | (PIPE) separated.Example: foo|bar|baz
- Parameters:
id
-list
-- Returns:
-
registerStaticCompletion
public CommandCompletions.CommandCompletionHandler registerStaticCompletion(String id, String[] completions) Register a static list of command completions that will never change- Parameters:
id
-completions
-- Returns:
-
registerStaticCompletion
public CommandCompletions.CommandCompletionHandler registerStaticCompletion(String id, Supplier<Collection<String>> supplier) Register a static list of command completions that will never change. The list is obtained from the supplier immediately as part of this method call.- Parameters:
id
-supplier
-- Returns:
-
registerStaticCompletion
public CommandCompletions.CommandCompletionHandler registerStaticCompletion(String id, Collection<String> completions) Register a static list of command completions that will never change- Parameters:
id
-completions
-- Returns:
-
setDefaultCompletion
Registers a completion handler such as @players to default apply to all command parameters of the specified typesThis enables automatic completion support for parameters without manually defining it for custom objects
- Parameters:
id
-classes
-
-