# CommandCompletions (ACF (Core) 0.5.1-SNAPSHOT API)
declaration: package: co.aikar.commands, class: CommandCompletions

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 interface`
`CommandCompletions.AsyncCommandCompletionHandler<C extends CommandCompletionContext>`
`static interface`
`CommandCompletions.CommandCompletionHandler<C extends CommandCompletionContext>`
`static class`
`CommandCompletions.SyncCompletionRequired`

## Constructor Summary

Constructors
Constructor
Description
`CommandCompletions(CommandManager manager)`

## Method Summary

Modifier and Type
Method
Description
`CommandCompletions.CommandCompletionHandler`
`registerAsyncCompletion(String id, CommandCompletions.AsyncCommandCompletionHandler<C> handler)`
Registr a completion handler to provide command completions based on the user input.
`CommandCompletions.CommandCompletionHandler`
`registerCompletion(String id, CommandCompletions.CommandCompletionHandler<C> handler)`
Registr a completion handler to provide command completions based on the user input.
`CommandCompletions.CommandCompletionHandler`
`registerStaticCompletion(String id, String list)`
Register a static list of command completions that will never change.
`CommandCompletions.CommandCompletionHandler`
`registerStaticCompletion(String id, String[] completions)`
Register a static list of command completions that will never change
`CommandCompletions.CommandCompletionHandler`
`registerStaticCompletion(String id, Collection<String> completions)`
Register a static list of command completions that will never change
`CommandCompletions.CommandCompletionHandler`
`registerStaticCompletion(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 types
`CommandCompletions.CommandCompletionHandler`
`unregisterCompletion(String id)`
Unregister a completion handler.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### CommandCompletions

public CommandCompletions (CommandManager manager)

## 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

public CommandCompletions.CommandCompletionHandler unregisterCompletion (String id)
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

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 types

This enables automatic completion support for parameters without manually defining it for custom objects

Parameters:
  `id` -
  `classes` -