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 java.lang.Object implements ResultedEvent.Result
Represents the result of theCommandExecuteEvent
.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CommandExecuteEvent.CommandResult
allowed()
Allows the command to be sent, without modification.static CommandExecuteEvent.CommandResult
command(@NonNull java.lang.String newCommand)
Allows the command to be executed, but silently replaced old command with another.static CommandExecuteEvent.CommandResult
denied()
Prevents the command from being executed.static CommandExecuteEvent.CommandResult
forwardToServer()
Prevents the command from being executed, but forward command to server.static CommandExecuteEvent.CommandResult
forwardToServer(@NonNull java.lang.String newCommand)
Prevents the command from being executed on proxy, but forward command to server.java.util.Optional<java.lang.String>
getCommand()
boolean
isAllowed()
Returns whether or not the event is allowed to proceed.boolean
isForwardToServer()
java.lang.String
toString()
-
-
-
Method Detail
-
getCommand
public java.util.Optional<java.lang.String> getCommand()
-
isForwardToServer
public boolean isForwardToServer()
-
isAllowed
public boolean isAllowed()
Description copied from interface:ResultedEvent.Result
Returns 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:
isAllowed
in interfaceResultedEvent.Result
- Returns:
- whether or not the event is allowed to proceed
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
allowed
public static CommandExecuteEvent.CommandResult allowed()
Allows the command to be sent, without modification.- Returns:
- the allowed result
-
denied
public static CommandExecuteEvent.CommandResult denied()
Prevents the command from being executed.- Returns:
- the denied result
-
forwardToServer
public static CommandExecuteEvent.CommandResult forwardToServer()
Prevents the command from being executed, but forward command to server.- Returns:
- the forward result
-
forwardToServer
public static CommandExecuteEvent.CommandResult forwardToServer(@NonNull java.lang.String newCommand)
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
public static CommandExecuteEvent.CommandResult command(@NonNull java.lang.String newCommand)
Allows the command to be executed, but silently replaced old command with another.- Parameters:
newCommand
- the command to use instead without first slash- Returns:
- a result with a new command
-
-