Package org.purpurmc.purpur.event
Class ExecuteCommandEvent
java.lang.Object
org.bukkit.event.Event
org.purpurmc.purpur.event.ExecuteCommandEvent
- All Implemented Interfaces:
Cancellable
This event is called whenever someone runs a command
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
Constructor Summary
ConstructorDescriptionExecuteCommandEvent
(CommandSender sender, Command command, String label, @Nullable String[] args) -
Method Summary
Modifier and TypeMethodDescriptionString[]
getArgs()
Get the args passed to the commandGets the command that the player is attempting to execute.static HandlerList
getLabel()
Get the label used to execute this commandGets the sender that this command will be executed as.boolean
Gets the cancellation state of this event.void
Set the args passed to the commandvoid
setCancelled
(boolean cancel) Sets the cancellation state of this event.void
setCommand
(Command command) Sets the command that the player will execute.void
Set the label used to execute this commandvoid
setSender
(CommandSender sender) Sets the sender that this command will be executed as.Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
ExecuteCommandEvent
-
-
Method Details
-
getCommand
Gets the command that the player is attempting to execute.- Returns:
- Command the player is attempting to execute
-
setCommand
Sets the command that the player will execute.- Parameters:
command
- New command that the player will execute- Throws:
IllegalArgumentException
- if command is null or empty
-
getSender
Gets the sender that this command will be executed as.- Returns:
- Sender this command will be executed as
-
setSender
Sets the sender that this command will be executed as.- Parameters:
sender
- New sender which this event will execute as- Throws:
IllegalArgumentException
- if the sender provided is null
-
getLabel
Get the label used to execute this command- Returns:
- Label used to execute this command
-
setLabel
Set the label used to execute this command- Parameters:
label
- Label used
-
getArgs
Get the args passed to the command- Returns:
- Args passed to the command
-
setArgs
Set the args passed to the command- Parameters:
args
- Args passed to the command
-
isCancelled
public boolean isCancelled()Description copied from interface:Cancellable
Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins- Specified by:
isCancelled
in interfaceCancellable
- Returns:
- true if this event is cancelled
-
setCancelled
public void setCancelled(boolean cancel) Description copied from interface:Cancellable
Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.- Specified by:
setCancelled
in interfaceCancellable
- Parameters:
cancel
- true if you wish to cancel this event
-
getHandlers
- Specified by:
getHandlers
in classEvent
-
getHandlerList
-