Class ExecuteCommandEvent

java.lang.Object
org.bukkit.event.Event
org.purpurmc.purpur.event.ExecuteCommandEvent
All Implemented Interfaces:
Cancellable

@NullMarked public class ExecuteCommandEvent extends Event implements Cancellable
This event is called whenever someone runs a command
  • Constructor Details

  • Method Details

    • getCommand

      public Command getCommand()
      Gets the command that the player is attempting to execute.
      Returns:
      Command the player is attempting to execute
    • setCommand

      public void setCommand(Command command) throws IllegalArgumentException
      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

      public CommandSender getSender()
      Gets the sender that this command will be executed as.
      Returns:
      Sender this command will be executed as
    • setSender

      public void setSender(CommandSender sender) throws IllegalArgumentException
      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

      public String getLabel()
      Get the label used to execute this command
      Returns:
      Label used to execute this command
    • setLabel

      public void setLabel(String label)
      Set the label used to execute this command
      Parameters:
      label - Label used
    • getArgs

      public String[] getArgs()
      Get the args passed to the command
      Returns:
      Args passed to the command
    • setArgs

      public void setArgs(String[] args)
      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 interface Cancellable
      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 interface Cancellable
      Parameters:
      cancel - true if you wish to cancel this event
    • getHandlers

      public HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
    • getHandlerList

      public static HandlerList getHandlerList()