Interface ExecuteCommandEvent.Pre
-
- All Superinterfaces:
Cancellable,Event,ExecuteCommandEvent
- Enclosing interface:
- ExecuteCommandEvent
public static interface ExecuteCommandEvent.Pre extends ExecuteCommandEvent, Cancellable
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanisCancelled()If true, the command will not run and theCommandResultgiven byresult()will be returned.Optional<CommandResult>result()The result of the command.voidsetArguments(String arguments)Sets the arguments as a string.voidsetCancelled(boolean cancel)Sets whether the command will run.voidsetCommand(String command)Sets the command as a string, without any sort of command prefix.voidsetResult(@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 Detail
-
setCommand
void setCommand(String command)
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
void setArguments(String arguments)
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
void setResult(@Nullable CommandResult result)
Sets the result of the command.- Parameters:
result- The result of the command
-
isCancelled
boolean isCancelled()
If true, the command will not run and theCommandResultgiven byresult()will be returned.- Specified by:
isCancelledin 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 appropriateCommandResultwill be set (and returned fromresult()).- Specified by:
setCancelledin interfaceCancellable- Parameters:
cancel- The new cancelled state
-
-