Package cloud.commandframework.execution
Class CommandExecutionCoordinator<C>
java.lang.Object
cloud.commandframework.execution.CommandExecutionCoordinator<C>
- Type Parameters:
C
- Command sender type
- Direct Known Subclasses:
AsynchronousCommandExecutionCoordinator
,CommandExecutionCoordinator.SimpleCoordinator
The command execution coordinator is responsible for
coordinating command execution. This includes determining
what thread the command should be executed on, whether or
not command may be executed in parallel, etc.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A simple command execution coordinator that executes all commands immediately, on the calling thread -
Constructor Summary
ModifierConstructorDescriptionprotected
CommandExecutionCoordinator(@NonNull CommandTree<C> commandTree)
Construct a new command execution coordinator -
Method Summary
Modifier and TypeMethodDescriptionabstract @NonNull CompletableFuture<CommandResult<C>>
coordinateExecution(@NonNull CommandContext<C> commandContext, @NonNull Queue<@NonNull String> input)
Coordinate the execution of a command and return the resultprotected @NonNull CommandTree<C>
Get the command treestatic <C> @NonNull Function<@NonNull CommandTree<C>,@NonNull CommandExecutionCoordinator<C>>
Returns a simple command execution coordinator that executes all commands immediately, on the calling thread
-
Constructor Details
-
CommandExecutionCoordinator
Construct a new command execution coordinator- Parameters:
commandTree
- Command tree
-
-
Method Details
-
simpleCoordinator
public static <C> @NonNull Function<@NonNull CommandTree<C>,@NonNull CommandExecutionCoordinator<C>> simpleCoordinator()Returns a simple command execution coordinator that executes all commands immediately, on the calling thread- Type Parameters:
C
- Command sender type- Returns:
- New coordinator instance
-
coordinateExecution
public abstract @NonNull CompletableFuture<CommandResult<C>> coordinateExecution(@NonNull CommandContext<C> commandContext, @NonNull Queue<@NonNull String> input)Coordinate the execution of a command and return the result- Parameters:
commandContext
- Command contextinput
- Command input- Returns:
- Future that completes with the result
-
getCommandTree
Get the command tree- Returns:
- Command tree
-