Interface ICommandSender

All Superinterfaces:
IMessageable
All Known Subinterfaces:
IPlayer, IServer
All Known Implementing Classes:
OfflinePlayerSpigot, PlayerSpigot, SpigotServer

public interface ICommandSender extends IMessageable
  • Method Details

    • getPlayer

      Optional<IPlayer> getPlayer()
      Gets the IPlayer that issued the command.
      Returns:
      The IPlayer that issued the command, if it was a player that issued the command. Otherwise, an empty Optional is returned.
    • isPlayer

      boolean isPlayer()
      Checks if the command sender is a player.
      Returns:
      True if the command sender is a player.
    • hasPermission

      default CompletableFuture<Boolean> hasPermission(String permission)
      Checks if this sender has a given permission.
      Parameters:
      permission - The permission node to check.
      Returns:
      True if the player has access to the provided permission, otherwise false.
    • hasPermission

      default CompletableFuture<PermissionsStatus> hasPermission(CommandDefinition command)
      Checks if this sender has a given command.

      Both the user permission (See CommandDefinition.getUserPermission()) and the admin permission (See CommandDefinition.getAdminPermission()) are checked.

      Parameters:
      command - The CommandDefinition of a command to check.
      Returns:
      A PermissionsStatus that is true if the player has access to the provided permissions, otherwise false for the user and the admin permission nodes respectively.