Package co.aikar.commands
Class CommandCompletions<C extends CommandCompletionContext>
- java.lang.Object
-
- co.aikar.commands.CommandCompletions<C>
-
public class CommandCompletions<C extends CommandCompletionContext> extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceCommandCompletions.AsyncCommandCompletionHandler<C extends CommandCompletionContext>static interfaceCommandCompletions.CommandCompletionHandler<C extends CommandCompletionContext>static classCommandCompletions.SyncCompletionRequired
-
Constructor Summary
Constructors Constructor Description CommandCompletions(CommandManager manager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CommandCompletions.CommandCompletionHandlerregisterAsyncCompletion(String id, CommandCompletions.AsyncCommandCompletionHandler<C> handler)Registr a completion handler to provide command completions based on the user input.CommandCompletions.CommandCompletionHandlerregisterCompletion(String id, CommandCompletions.CommandCompletionHandler<C> handler)Registr a completion handler to provide command completions based on the user input.CommandCompletions.CommandCompletionHandlerregisterStaticCompletion(String id, String list)Register a static list of command completions that will never change.CommandCompletions.CommandCompletionHandlerregisterStaticCompletion(String id, String[] completions)Register a static list of command completions that will never changeCommandCompletions.CommandCompletionHandlerregisterStaticCompletion(String id, Collection<String> completions)Register a static list of command completions that will never changeCommandCompletions.CommandCompletionHandlerregisterStaticCompletion(String id, Supplier<Collection<String>> supplier)Register a static list of command completions that will never change.voidsetDefaultCompletion(String id, Class... classes)Registers a completion handler such as @players to default apply to all command parameters of the specified types
-
-
-
Constructor Detail
-
CommandCompletions
public CommandCompletions(CommandManager manager)
-
-
Method Detail
-
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:
-
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
public CommandCompletions.CommandCompletionHandler registerStaticCompletion(String id, String list)
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
public void setDefaultCompletion(String id, Class... classes)
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-
-
-