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
ConstructorsConstructorDescriptionExecuteCommandEvent(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 HandlerListgetLabel()Get the label used to execute this commandGets the sender that this command will be executed as.booleanGets the cancellation state of this event.voidSet the args passed to the commandvoidsetCancelled(boolean cancel) Sets the cancellation state of this event.voidsetCommand(Command command) Sets the command that the player will execute.voidSet the label used to execute this commandvoidsetSender(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:CancellableGets 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:
isCancelledin interfaceCancellable- Returns:
trueif this event is cancelled
-
setCancelled
public void setCancelled(boolean cancel) Description copied from interface:CancellableSets 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:
setCancelledin interfaceCancellable- Parameters:
cancel-trueif you wish to cancel this event
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getHandlerList
-