Interface ClaimManager


public interface ClaimManager
The ClaimAPI provides methods to interact with land claims, protections, and whitelists within the BuildMC plugin.

It allows checking claim ownership, player permissions, protections, and managing claims through players or teams.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addPlayerToWhitelist(long claimID, UUID playerID)
    Adds a player to a claim's whitelist.
    void
    addProtection(long claimId, @NotNull Protection protection)
    Adds a protection to a claim by ID.
    void
    addProtection(long claimId, @NotNull org.bukkit.NamespacedKey protection)
    Adds a protection to a claim by ID.
    boolean
    Checks whether the owner already has a claim with the given name.
    @Nullable Claim
    getClaim(org.bukkit.Chunk chunk)
    Gets the claim associated with a chunk.
    @Nullable Claim
    getClaim(org.bukkit.Location location)
    Gets the claim at a given location.
    @Nullable Claim
    getClaimByID(long claimID)
    Gets a claim by its ID.
    @Nullable Long
    getClaimId(org.bukkit.Chunk chunk)
    Gets the claim ID of a claimed chunk.
    @Nullable String
    getClaimNameById(long claimId)
    Gets the name of a claim by its ID.
    getClaimsInArea(org.bukkit.Location pos1, org.bukkit.Location pos2)
    Gets all claims within the given area.
    @Nullable org.bukkit.scoreboard.Team
    getPlayerTeam(@NotNull org.bukkit.entity.Player player)
    Gets the current scoreboard team of a player.
    @Nullable Integer
    Gets how many claimable chunks a player has left.
    @Nullable Integer
    Gets how many claimable chunks a player has left.
    @Nullable Integer
    Gets how many claimable chunks a team has left.
    boolean
    hasAllProtectionKeys(Claim claim, Collection<org.bukkit.NamespacedKey> keys)
    Checks if a claim has all the specified protections by key.
    boolean
    hasAllProtections(Claim claim, Collection<String> protections)
    Checks if a claim has all the specified protections by string identifiers.
    boolean
    hasAnyProtection(Claim claim, Collection<org.bukkit.NamespacedKey> protections)
    Checks if a claim has any of the provided protections.
    boolean
    hasProtection(Claim claim, org.bukkit.NamespacedKey protection)
    Checks if a claim has a specific protection.
    boolean
    isClaimed(org.bukkit.Chunk chunk)
    Checks if a chunk is claimed.
    boolean
    isClaimInArea(UUID worldID, int chunkX1, int chunkZ1, int chunkX2, int chunkZ2)
    Checks if there is any claim within the given chunk area.
    boolean
    isPlayerAllowed(@NotNull org.bukkit.entity.Player player, @NotNull Collection<org.bukkit.NamespacedKey> protections, @Nullable Claim claim)
    Checks whether a player is allowed to perform an action in a claim given multiple protection keys.
    boolean
    isPlayerAllowed(@NotNull org.bukkit.entity.Player player, @NotNull Collection<org.bukkit.NamespacedKey> protections, org.bukkit.Location location)
    Checks whether a player is allowed to perform an action at a specific location given multiple protection keys.
    boolean
    isPlayerAllowed(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.NamespacedKey protection, @Nullable Claim claim)
    Checks whether a player is allowed to perform an action in a given claim for a single protection key.
    boolean
    isPlayerAllowed(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.NamespacedKey protection, org.bukkit.Location location)
    Checks whether a player is allowed to perform an action at a location for a single protection key.
    boolean
    removeClaimById(long claimId)
    Removes a claim by its ID.
    void
    removePlayerFromWhitelist(long claimID, UUID playerID)
    Removes a player from a claim's whitelist.
    void
    removeProtection(long claimId, @NotNull Protection protection)
    Removes a protection from a claim by ID.
    void
    removeProtection(long claimId, @NotNull org.bukkit.NamespacedKey protection)
    Removes a protection from a claim by ID.
    void
    setRemainingPlayerClaims(String playerUUID, @Nullable Integer remainingClaims)
    Sets the number of claimable chunks a player has left.
    void
    setRemainingPlayerClaims(UUID playerUUID, @Nullable Integer remainingClaims)
    Sets the number of claimable chunks a player has left.
    void
    setRemainingTeamClaims(String teamName, @Nullable Integer remainingClaims)
    Sets the number of claimable chunks a team has left.
    boolean
    tryClaimPlaceholderArea(String claimName, org.bukkit.Location pos1, org.bukkit.Location pos2)
    Attempts to create a placeholder claim between two positions.
    boolean
    tryClaimPlayerArea(@NotNull org.bukkit.entity.Player player, String claimName, org.bukkit.Location pos1, org.bukkit.Location pos2)
    Attempts to create a claim for a player between two positions.
    boolean
    tryClaimServerArea(String claimName, org.bukkit.Location pos1, org.bukkit.Location pos2)
    Attempts to create a claim owned by the server between two positions.
    boolean
    tryClaimTeamArea(@NotNull org.bukkit.scoreboard.Team team, String claimName, org.bukkit.Location pos1, org.bukkit.Location pos2)
    Attempts to create a claim for a team between two positions.
  • Method Details

    • getPlayerTeam

      @Nullable @Nullable org.bukkit.scoreboard.Team getPlayerTeam(@NotNull @NotNull org.bukkit.entity.Player player)
      Gets the current scoreboard team of a player.
      Parameters:
      player - the player
      Returns:
      the team the player is in, or null if none
    • isPlayerAllowed

      boolean isPlayerAllowed(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull Collection<org.bukkit.NamespacedKey> protections, org.bukkit.Location location)
      Checks whether a player is allowed to perform an action at a specific location given multiple protection keys. If all provided protections are false, the player is allowed.
      Parameters:
      player - the player
      protections - the protections to check
      location - the location
      Returns:
      true if the player is allowed, otherwise false
    • isPlayerAllowed

      boolean isPlayerAllowed(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull Collection<org.bukkit.NamespacedKey> protections, @Nullable @Nullable Claim claim)
      Checks whether a player is allowed to perform an action in a claim given multiple protection keys. If all provided protections are false, the player is allowed.
      Parameters:
      player - the player
      protections - the protections to check
      claim - the claim, or null if outside a claim
      Returns:
      true if the player is allowed, otherwise false
    • isPlayerAllowed

      boolean isPlayerAllowed(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.NamespacedKey protection, @Nullable @Nullable Claim claim)
      Checks whether a player is allowed to perform an action in a given claim for a single protection key.
      Parameters:
      player - the player
      protection - the protection to check
      claim - the claim, or null if outside a claim
      Returns:
      true if the player is allowed, otherwise false
    • isPlayerAllowed

      boolean isPlayerAllowed(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.NamespacedKey protection, org.bukkit.Location location)
      Checks whether a player is allowed to perform an action at a location for a single protection key.
      Parameters:
      player - the player
      protection - the protection to check
      location - the location
      Returns:
      true if the player is allowed, otherwise false
    • hasAnyProtection

      boolean hasAnyProtection(Claim claim, Collection<org.bukkit.NamespacedKey> protections)
      Checks if a claim has any of the provided protections.
      Parameters:
      claim - the claim
      protections - the protections (protections) to check
      Returns:
      true if the claim has any of the protections
    • hasProtection

      boolean hasProtection(Claim claim, org.bukkit.NamespacedKey protection)
      Checks if a claim has a specific protection.
      Parameters:
      claim - the claim
      protection - the protection (protection) to check
      Returns:
      true if the claim has the protection
    • hasAllProtections

      boolean hasAllProtections(Claim claim, Collection<String> protections)
      Checks if a claim has all the specified protections by string identifiers.
      Parameters:
      claim - the claim
      protections - the protections to check
      Returns:
      true if the claim has all the protections
    • hasAllProtectionKeys

      boolean hasAllProtectionKeys(Claim claim, Collection<org.bukkit.NamespacedKey> keys)
      Checks if a claim has all the specified protections by key.
      Parameters:
      claim - the claim
      keys - the protection keys to check
      Returns:
      true if the claim has all the protections
    • isClaimInArea

      boolean isClaimInArea(UUID worldID, int chunkX1, int chunkZ1, int chunkX2, int chunkZ2) throws SQLException
      Checks if there is any claim within the given chunk area.
      Parameters:
      worldID - the world UUID
      chunkX1 - first corner chunk X
      chunkZ1 - first corner chunk Z
      chunkX2 - opposite corner chunk X
      chunkZ2 - opposite corner chunk Z
      Returns:
      true if a claim exists in the area
      Throws:
      SQLException - if a database error occurs
    • getClaimsInArea

      List<Claim> getClaimsInArea(org.bukkit.Location pos1, org.bukkit.Location pos2) throws SQLException, IllegalArgumentException
      Gets all claims within the given area.
      Parameters:
      pos1 - first corner location
      pos2 - opposite corner location
      Returns:
      list of claims in the area
      Throws:
      SQLException - if a database error occurs
      IllegalArgumentException - if any of the locations are null, or they're not in the same world.
    • isClaimed

      boolean isClaimed(org.bukkit.Chunk chunk)
      Checks if a chunk is claimed.
      Parameters:
      chunk - the chunk
      Returns:
      true if the chunk is claimed
    • getClaimId

      @Nullable @Nullable Long getClaimId(org.bukkit.Chunk chunk)
      Gets the claim ID of a claimed chunk.
      Parameters:
      chunk - the chunk
      Returns:
      the claim ID, or null if unclaimed
    • getClaim

      @Nullable @Nullable Claim getClaim(org.bukkit.Chunk chunk) throws SQLException
      Gets the claim associated with a chunk.
      Parameters:
      chunk - the chunk
      Returns:
      the claim
      Throws:
      SQLException - if a database error occurs
    • getClaimByID

      @Nullable @Nullable Claim getClaimByID(long claimID)
      Gets a claim by its ID.
      Parameters:
      claimID - the claim ID
      Returns:
      the claim, or null if none exists
    • getClaim

      @Nullable @Nullable Claim getClaim(org.bukkit.Location location) throws SQLException
      Gets the claim at a given location.
      Parameters:
      location - the location
      Returns:
      the claim, or null if unclaimed
      Throws:
      SQLException
    • tryClaimPlayerArea

      boolean tryClaimPlayerArea(@NotNull @NotNull org.bukkit.entity.Player player, String claimName, org.bukkit.Location pos1, org.bukkit.Location pos2) throws IllegalArgumentException
      Attempts to create a claim for a player between two positions.
      Parameters:
      player - the player
      claimName - the claim name
      pos1 - first corner location
      pos2 - opposite corner location
      Returns:
      true if the claim was created successfully
      Throws:
      IllegalArgumentException - if any of the locations are null, or they're not in the same world.
    • tryClaimTeamArea

      boolean tryClaimTeamArea(@NotNull @NotNull org.bukkit.scoreboard.Team team, String claimName, org.bukkit.Location pos1, org.bukkit.Location pos2) throws IllegalArgumentException
      Attempts to create a claim for a team between two positions.
      Parameters:
      team - the team
      claimName - the claim name
      pos1 - first corner location
      pos2 - opposite corner location
      Returns:
      true if the claim was created successfully
      Throws:
      IllegalArgumentException - if any of the locations are null, or they're not in the same world.
    • tryClaimServerArea

      boolean tryClaimServerArea(String claimName, org.bukkit.Location pos1, org.bukkit.Location pos2) throws IllegalArgumentException
      Attempts to create a claim owned by the server between two positions.
      Parameters:
      claimName - the claim name
      pos1 - first corner location
      pos2 - opposite corner location
      Returns:
      true if the claim was created successfully
      Throws:
      IllegalArgumentException - if any of the locations are null, or they're not in the same world
    • tryClaimPlaceholderArea

      boolean tryClaimPlaceholderArea(String claimName, org.bukkit.Location pos1, org.bukkit.Location pos2) throws IllegalArgumentException
      Attempts to create a placeholder claim between two positions.

      A placeholder claim may be used to reserve an area temporarily without assigning it to a player, team, or the server.

      Parameters:
      claimName - the claim name
      pos1 - first corner location
      pos2 - opposite corner location
      Returns:
      true if the claim was created successfully
      Throws:
      IllegalArgumentException - if any of the locations are null, or they're not in the same world
    • addPlayerToWhitelist

      void addPlayerToWhitelist(long claimID, UUID playerID)
      Adds a player to a claim's whitelist.
      Parameters:
      claimID - the claim ID
      playerID - the player UUID
    • removePlayerFromWhitelist

      void removePlayerFromWhitelist(long claimID, UUID playerID)
      Removes a player from a claim's whitelist.
      Parameters:
      claimID - the claim ID
      playerID - the player UUID
    • addProtection

      void addProtection(long claimId, @NotNull @NotNull Protection protection)
      Adds a protection to a claim by ID.
      Parameters:
      claimId - the claim ID
      protection - the protection
    • addProtection

      void addProtection(long claimId, @NotNull @NotNull org.bukkit.NamespacedKey protection)
      Adds a protection to a claim by ID.
      Parameters:
      claimId - the claim ID
      protection - the protection key
    • removeProtection

      void removeProtection(long claimId, @NotNull @NotNull Protection protection)
      Removes a protection from a claim by ID.
      Parameters:
      claimId - the claim ID
      protection - the protection
    • removeProtection

      void removeProtection(long claimId, @NotNull @NotNull org.bukkit.NamespacedKey protection)
      Removes a protection from a claim by ID.
      Parameters:
      claimId - the claim ID
      protection - the protection key
    • getClaimNameById

      @Nullable @Nullable String getClaimNameById(long claimId)
      Gets the name of a claim by its ID.
      Parameters:
      claimId - the claim ID
      Returns:
      the claim name
    • removeClaimById

      boolean removeClaimById(long claimId)
      Removes a claim by its ID.
      Parameters:
      claimId - the claim ID
      Returns:
      true if the claim was removed successfully
    • doesOwnerHaveClaimWithName

      boolean doesOwnerHaveClaimWithName(String ownerId, String claimName) throws SQLException
      Checks whether the owner already has a claim with the given name.
      Parameters:
      ownerId - the owner identifier
      claimName - the claim name
      Returns:
      true if the owner already has a claim with that name
      Throws:
      SQLException - if a database error occurs
    • getRemainingTeamClaims

      @Nullable @Nullable Integer getRemainingTeamClaims(String teamName)
      Gets how many claimable chunks a team has left.
      Parameters:
      teamName - the team name
      Returns:
      the number of remaining claims available to the team, or null if no data is available
    • getRemainingPlayerClaims

      @Nullable @Nullable Integer getRemainingPlayerClaims(String playerUUID)
      Gets how many claimable chunks a player has left.
      Parameters:
      playerUUID - the player's UUID as a string
      Returns:
      the number of remaining claims available to the player, or null if no data is available
    • getRemainingPlayerClaims

      @Nullable @Nullable Integer getRemainingPlayerClaims(UUID playerUUID)
      Gets how many claimable chunks a player has left.
      Parameters:
      playerUUID - the player's UUID
      Returns:
      the number of remaining claims available to the player, or null if no data is available
    • setRemainingTeamClaims

      void setRemainingTeamClaims(String teamName, @Nullable @Nullable Integer remainingClaims)
      Sets the number of claimable chunks a team has left.

      If remainingClaims is null, the team's remaining claim record is removed.

      Parameters:
      teamName - the team name
      remainingClaims - the new number of remaining claims, or null to remove the record
    • setRemainingPlayerClaims

      void setRemainingPlayerClaims(String playerUUID, @Nullable @Nullable Integer remainingClaims)
      Sets the number of claimable chunks a player has left.

      If remainingClaims is null, the player's remaining claim record is removed.

      Parameters:
      playerUUID - the player's UUID as a string
      remainingClaims - the new number of remaining claims, or null to remove the record
    • setRemainingPlayerClaims

      void setRemainingPlayerClaims(UUID playerUUID, @Nullable @Nullable Integer remainingClaims)
      Sets the number of claimable chunks a player has left.

      If remainingClaims is null, the player's remaining claim record is removed.

      Parameters:
      playerUUID - the player's UUID
      remainingClaims - the new number of remaining claims, or null to remove the record