Class CommandExecuteEvent.CommandResult
java.lang.Object
com.velocitypowered.api.event.command.CommandExecuteEvent.CommandResult
- All Implemented Interfaces:
ResultedEvent.Result
- Enclosing class:
CommandExecuteEvent
public static final class CommandExecuteEvent.CommandResult
extends Object
implements ResultedEvent.Result
Represents the result of the
CommandExecuteEvent.-
Method Summary
Modifier and TypeMethodDescriptionallowed()Allows the command to be sent, without modification.Allows the command to be executed, but silently replaces the command with a different command.denied()Prevents the command from being executed.Forwards the command to server instead of executing it on the proxy.forwardToServer(@NonNull String newCommand) Prevents the command from being executed on proxy, but forward command to server.Returns the command to be executed, if it was overridden.booleanReturns whether or not the event is allowed to proceed.booleanIndicates whether this command should be forwarded directly to the backend server instead of being processed by the proxy.toString()
-
Method Details
-
getCommand
Returns the command to be executed, if it was overridden.- Returns:
- an
Optionalcontaining the new command string (without leading slash), or empty if no override is present
-
isForwardToServer
public boolean isForwardToServer()Indicates whether this command should be forwarded directly to the backend server instead of being processed by the proxy.- Returns:
trueif the command should be forwarded to the server,falseotherwise
-
isAllowed
public boolean isAllowed()Description copied from interface:ResultedEvent.ResultReturns whether or not the event is allowed to proceed. Plugins may choose to skip denied events, and the proxy will respect the result of this method.- Specified by:
isAllowedin interfaceResultedEvent.Result- Returns:
- whether or not the event is allowed to proceed
-
toString
-
allowed
Allows the command to be sent, without modification.- Returns:
- the allowed result
-
denied
Prevents the command from being executed.- Returns:
- the denied result
-
forwardToServer
Forwards the command to server instead of executing it on the proxy. This is the default behavior when a command is not registered on Velocity.- Returns:
- the forward result
-
forwardToServer
Prevents the command from being executed on proxy, but forward command to server.- Parameters:
newCommand- the command without first slash to use instead- Returns:
- a result with a new command being forwarded to server
-
command
Allows the command to be executed, but silently replaces the command with a different command.- Parameters:
newCommand- the command to use instead without first slash- Returns:
- a result with a new command
-