Interface ExecuteCommandEvent.Pre
- All Superinterfaces:
Cancellable
,Event
,ExecuteCommandEvent
- Enclosing interface:
- ExecuteCommandEvent
Fired before the command is executed.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.spongepowered.api.event.command.ExecuteCommandEvent
ExecuteCommandEvent.Post, ExecuteCommandEvent.Pre
-
Method Summary
Modifier and TypeMethodDescriptionboolean
If true, the command will not run and theCommandResult
given byresult()
will be returned.result()
The result of the command.void
setArguments
(String arguments) Sets the arguments as a string.void
setCancelled
(boolean cancel) Sets whether the command will run.void
setCommand
(String command) Sets the command as a string, without any sort of command prefix.void
setResult
(@Nullable CommandResult result) Sets the result of the command.Methods inherited from interface org.spongepowered.api.event.command.ExecuteCommandEvent
arguments, command, commandCause, originalArguments, originalCommand
-
Method Details
-
setCommand
Sets the command as a string, without any sort of command prefix.For example, if the message was
/example bob 3 -f
, then the command would beexample
.- Parameters:
command
- The command
-
setArguments
Sets the arguments as a string.For example, if the message was
/example bob 3 -f
, then the arguments would bebob 3 -f
.- Parameters:
arguments
- The arguments
-
result
Optional<CommandResult> result()The result of the command.If set, this indicates cancellation of the command.
- Returns:
- The result of the command, if set.
-
setResult
Sets the result of the command.- Parameters:
result
- The result of the command
-
isCancelled
boolean isCancelled()If true, the command will not run and theCommandResult
given byresult()
will be returned.- Specified by:
isCancelled
in interfaceCancellable
- Returns:
- The cancellation status of the event.
-
setCancelled
void setCancelled(boolean cancel) Sets whether the command will run. If the command is cancelled using this method, an appropriateCommandResult
will be set (and returned fromresult()
).- Specified by:
setCancelled
in interfaceCancellable
- Parameters:
cancel
- The new cancelled state
-