Interface CommandSource

All Superinterfaces:
Audience, ForwardingAudience, ForwardingAudience.Single, Pointered

public sealed interface CommandSource extends ForwardingAudience.Single
The context a command runs in. /execute can change the executor and location, but never the sender. Messages sent to a source go to its sender.
Since:
0.1.0
  • Method Details

    • of

      static CommandSource of(CommandSender sender)
      Returns a source for sender, with no executor or location.
      Parameters:
      sender - who runs the command
      Returns:
      a source for sender, with no executor or location
      Since:
      0.1.0
    • sender

      CommandSender sender()
      Returns who ran the command.
      Returns:
      who ran the command
      Since:
      0.1.0
    • executor

      @Nullable Entity executor()
      Returns the entity the command acts as, or null if none.
      Returns:
      the entity the command acts as, or null if none
      Since:
      0.1.0
    • location

      @Nullable Location location()
      Returns where the command runs, or null if no world is loaded.
      Returns:
      where the command runs, or null if no world is loaded
      Since:
      0.1.0
    • as

      CommandSource as(Entity executor)
      Returns a copy of this source acting as executor, like /execute as.
      Returns:
      a copy of this source acting as executor, like /execute as
      Since:
      0.1.0
    • at

      CommandSource at(Location location)
      Returns a copy of this source running at location, like /execute at.
      Returns:
      a copy of this source running at location, like /execute at
      Since:
      0.1.0
    • server

      default Server server()
      Returns the server the command runs on.
      Returns:
      the server the command runs on
      Since:
      0.1.0
    • audience

      default Audience audience()
      Specified by:
      audience in interface ForwardingAudience.Single