Class CommandExecuteEvent
java.lang.Object
com.velocitypowered.api.event.command.CommandExecuteEvent
- All Implemented Interfaces:
ResultedEvent<CommandExecuteEvent.CommandResult>
@AwaitingEvent
public final class CommandExecuteEvent
extends Object
implements ResultedEvent<CommandExecuteEvent.CommandResult>
This event is fired when someone executes a command. Velocity will wait for this event to finish
firing before trying to handle the command and/or forwarding it to the server.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Represents the result of theCommandExecuteEvent
.Nested classes/interfaces inherited from interface com.velocitypowered.api.event.ResultedEvent
ResultedEvent.ComponentResult, ResultedEvent.GenericResult, ResultedEvent.Result
-
Constructor Summary
ConstructorDescriptionCommandExecuteEvent
(CommandSource commandSource, String command) Constructs a CommandExecuteEvent. -
Method Summary
Modifier and TypeMethodDescriptionGets the original command being executed without the first slash.Gets the source responsible for the execution of this command.Returns the result associated with this event.void
setResult
(@NonNull CommandExecuteEvent.CommandResult result) Sets the result of this event.toString()
-
Constructor Details
-
CommandExecuteEvent
Constructs a CommandExecuteEvent.- Parameters:
commandSource
- the source executing the commandcommand
- the command being executed without first slash
-
-
Method Details
-
getCommandSource
Gets the source responsible for the execution of this command.- Returns:
- the source executing the command
-
getCommand
Gets the original command being executed without the first slash.- Returns:
- the original command being executed
- API Note:
- Note that the player can provide a command that begins with spaces,
but still be validly executed. For example, the command
/ velocity info
, although not valid in the chat bar, will be executed as correctly as if the player had executed/velocity info
-
getResult
Description copied from interface:ResultedEvent
Returns the result associated with this event.- Specified by:
getResult
in interfaceResultedEvent<CommandExecuteEvent.CommandResult>
- Returns:
- the result of this event
-
setResult
Description copied from interface:ResultedEvent
Sets the result of this event. The result must be non-null.- Specified by:
setResult
in interfaceResultedEvent<CommandExecuteEvent.CommandResult>
- Parameters:
result
- the new result
-
toString
-