Interface CommandSource

All Known Subinterfaces:
Damageable, Entity, LivingEntity, Player

public interface CommandSource
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the entity that executes this command.
    Gets the location that this command is being executed at.
    Gets the command sender that executed this command.
    Gets the server associated with this source.
  • Method Details

    • location

      Location location()
      Gets the location that this command is being executed at.
      Returns:
      a cloned location instance.
    • sender

      CommandSender sender()
      Gets the command sender that executed this command. The sender of a command source stack is the one that initiated/triggered the execution of a command. It differs to executor() as the executor can be changed by a command, e.g. /execute.
      Returns:
      the command sender instance
    • executor

      @Nullable Entity executor()
      Gets the entity that executes this command. May not always be sender() as the executor of a command can be changed to a different entity than the one that triggered the command.
      Returns:
      entity that executes this command
    • server

      Server server()
      Gets the server associated with this source.
      Returns:
      the server