Interface CommandSender


public interface CommandSender
Represents an entity that can execute commands.

This can be a player, the server console, or any other command source.

  • Method Summary

    Modifier and Type
    Method
    Description
    default TalePlayer
    Returns this sender as a player, if applicable.
    Returns the name of this command sender.
    boolean
    hasPermission(String permission)
    Checks if this sender has the specified permission.
    default boolean
    Checks if this sender is a player.
    void
    Sends a message to this command sender.
  • Method Details

    • sendMessage

      void sendMessage(String message)
      Sends a message to this command sender.
      Parameters:
      message - the message to send
    • hasPermission

      boolean hasPermission(String permission)
      Checks if this sender has the specified permission.

      Console senders typically have all permissions.

      Parameters:
      permission - the permission node to check
      Returns:
      true if the sender has the permission
    • getName

      String getName()
      Returns the name of this command sender.

      For players, this returns their display name. For console, this typically returns "Console" or "Server".

      Returns:
      the sender's name
    • isPlayer

      default boolean isPlayer()
      Checks if this sender is a player.
      Returns:
      true if this sender is a player
    • asPlayer

      default TalePlayer asPlayer()
      Returns this sender as a player, if applicable.
      Returns:
      the player, or null if this sender is not a player