Module ultimategdbot.api
Class ExecutableCommand
- java.lang.Object
-
- com.github.alex1304.ultimategdbot.api.command.ExecutableCommand
-
public final class ExecutableCommand extends Object
Represents a command ready to be executed, meaning that the context and the error handler of the command are already defined.
-
-
Constructor Summary
Constructors Constructor Description ExecutableCommand(Command command, Context context, CommandErrorHandler errorHandler, PermissionChecker permissionChecker)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description reactor.core.publisher.Mono<Void>
execute()
Executes the command by taking into account the context and by applying the error handler.Command
getCommand()
Gets the underlying command instance.Context
getContext()
Gets the context of the command.CommandErrorHandler
getErrorHandler()
Gets the error handler applied to this command.String
toString()
-
-
-
Constructor Detail
-
ExecutableCommand
public ExecutableCommand(Command command, Context context, CommandErrorHandler errorHandler, PermissionChecker permissionChecker)
-
-
Method Detail
-
execute
public reactor.core.publisher.Mono<Void> execute()
Executes the command by taking into account the context and by applying the error handler. Scope and permission checks are performed here. If the user is not granted the permission to use the command, the command will fail with aPermissionDeniedException
. If the context is outside the scope of the command, nothing happens and the command completes empty.- Returns:
- a Mono completing when the command execution is complete. Errors caused by a failed permission check or an abnormal termination of the command will be forwarded through this Mono.
-
getCommand
public Command getCommand()
Gets the underlying command instance.- Returns:
- the command
-
getContext
public Context getContext()
Gets the context of the command.- Returns:
- the context
-
getErrorHandler
public CommandErrorHandler getErrorHandler()
Gets the error handler applied to this command.- Returns:
- the error handler
-
-