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 TypeMethodDescriptionvoidaddPlayerToWhitelist(long claimID, UUID playerID) Adds a player to a claim's whitelist.voidaddProtection(long claimId, @NotNull Protection protection) Adds a protection to a claim by ID.voidaddProtection(long claimId, @NotNull org.bukkit.NamespacedKey protection) Adds a protection to a claim by ID.booleandoesOwnerHaveClaimWithName(String ownerId, String claimName) Checks whether the owner already has a claim with the given name.@Nullable ClaimgetClaim(org.bukkit.Chunk chunk) Gets the claim associated with a chunk.@Nullable ClaimgetClaim(org.bukkit.Location location) Gets the claim at a given location.@Nullable ClaimgetClaimByID(long claimID) Gets a claim by its ID.@Nullable LonggetClaimId(org.bukkit.Chunk chunk) Gets the claim ID of a claimed chunk.@Nullable StringgetClaimNameById(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.TeamgetPlayerTeam(@NotNull org.bukkit.entity.Player player) Gets the current scoreboard team of a player.@Nullable IntegergetRemainingPlayerClaims(String playerUUID) Gets how many claimable chunks a player has left.@Nullable IntegergetRemainingPlayerClaims(UUID playerUUID) Gets how many claimable chunks a player has left.@Nullable IntegergetRemainingTeamClaims(String teamName) Gets how many claimable chunks a team has left.booleanhasAllProtectionKeys(Claim claim, Collection<org.bukkit.NamespacedKey> keys) Checks if a claim has all the specified protections by key.booleanhasAllProtections(Claim claim, Collection<String> protections) Checks if a claim has all the specified protections by string identifiers.booleanhasAnyProtection(Claim claim, Collection<org.bukkit.NamespacedKey> protections) Checks if a claim has any of the provided protections.booleanhasProtection(Claim claim, org.bukkit.NamespacedKey protection) Checks if a claim has a specific protection.booleanisClaimed(org.bukkit.Chunk chunk) Checks if a chunk is claimed.booleanisClaimInArea(UUID worldID, int chunkX1, int chunkZ1, int chunkX2, int chunkZ2) Checks if there is any claim within the given chunk area.booleanisPlayerAllowed(@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.booleanisPlayerAllowed(@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.booleanisPlayerAllowed(@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.booleanisPlayerAllowed(@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.booleanremoveClaimById(long claimId) Removes a claim by its ID.voidremovePlayerFromWhitelist(long claimID, UUID playerID) Removes a player from a claim's whitelist.voidremoveProtection(long claimId, @NotNull Protection protection) Removes a protection from a claim by ID.voidremoveProtection(long claimId, @NotNull org.bukkit.NamespacedKey protection) Removes a protection from a claim by ID.voidsetRemainingPlayerClaims(String playerUUID, @Nullable Integer remainingClaims) Sets the number of claimable chunks a player has left.voidsetRemainingPlayerClaims(UUID playerUUID, @Nullable Integer remainingClaims) Sets the number of claimable chunks a player has left.voidsetRemainingTeamClaims(String teamName, @Nullable Integer remainingClaims) Sets the number of claimable chunks a team has left.booleantryClaimPlaceholderArea(String claimName, org.bukkit.Location pos1, org.bukkit.Location pos2) Attempts to create a placeholder claim between two positions.booleantryClaimPlayerArea(@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.booleantryClaimServerArea(String claimName, org.bukkit.Location pos1, org.bukkit.Location pos2) Attempts to create a claim owned by the server between two positions.booleantryClaimTeamArea(@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
nullif 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 playerprotections- the protections to checklocation- the location- Returns:
trueif the player is allowed, otherwisefalse
-
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 playerprotections- the protections to checkclaim- the claim, ornullif outside a claim- Returns:
trueif the player is allowed, otherwisefalse
-
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 playerprotection- the protection to checkclaim- the claim, ornullif outside a claim- Returns:
trueif the player is allowed, otherwisefalse
-
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 playerprotection- the protection to checklocation- the location- Returns:
trueif the player is allowed, otherwisefalse
-
hasAnyProtection
Checks if a claim has any of the provided protections.- Parameters:
claim- the claimprotections- the protections (protections) to check- Returns:
trueif the claim has any of the protections
-
hasProtection
Checks if a claim has a specific protection.- Parameters:
claim- the claimprotection- the protection (protection) to check- Returns:
trueif the claim has the protection
-
hasAllProtections
Checks if a claim has all the specified protections by string identifiers.- Parameters:
claim- the claimprotections- the protections to check- Returns:
trueif the claim has all the protections
-
hasAllProtectionKeys
Checks if a claim has all the specified protections by key.- Parameters:
claim- the claimkeys- the protection keys to check- Returns:
trueif 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 UUIDchunkX1- first corner chunk XchunkZ1- first corner chunk ZchunkX2- opposite corner chunk XchunkZ2- opposite corner chunk Z- Returns:
trueif 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 locationpos2- opposite corner location- Returns:
- list of claims in the area
- Throws:
SQLException- if a database error occursIllegalArgumentException- 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:
trueif the chunk is claimed
-
getClaimId
Gets the claim ID of a claimed chunk.- Parameters:
chunk- the chunk- Returns:
- the claim ID, or
nullif unclaimed
-
getClaim
Gets the claim associated with a chunk.- Parameters:
chunk- the chunk- Returns:
- the claim
- Throws:
SQLException- if a database error occurs
-
getClaimByID
Gets a claim by its ID.- Parameters:
claimID- the claim ID- Returns:
- the claim, or
nullif none exists
-
getClaim
Gets the claim at a given location.- Parameters:
location- the location- Returns:
- the claim, or
nullif 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 playerclaimName- the claim namepos1- first corner locationpos2- opposite corner location- Returns:
trueif 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 teamclaimName- the claim namepos1- first corner locationpos2- opposite corner location- Returns:
trueif 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 namepos1- first corner locationpos2- opposite corner location- Returns:
trueif 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 namepos1- first corner locationpos2- opposite corner location- Returns:
trueif the claim was created successfully- Throws:
IllegalArgumentException- if any of the locations are null, or they're not in the same world
-
addPlayerToWhitelist
Adds a player to a claim's whitelist.- Parameters:
claimID- the claim IDplayerID- the player UUID
-
removePlayerFromWhitelist
Removes a player from a claim's whitelist.- Parameters:
claimID- the claim IDplayerID- the player UUID
-
addProtection
Adds a protection to a claim by ID.- Parameters:
claimId- the claim IDprotection- 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 IDprotection- the protection key
-
removeProtection
Removes a protection from a claim by ID.- Parameters:
claimId- the claim IDprotection- 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 IDprotection- the protection key
-
getClaimNameById
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:
trueif the claim was removed successfully
-
doesOwnerHaveClaimWithName
Checks whether the owner already has a claim with the given name.- Parameters:
ownerId- the owner identifierclaimName- the claim name- Returns:
trueif the owner already has a claim with that name- Throws:
SQLException- if a database error occurs
-
getRemainingTeamClaims
-
getRemainingPlayerClaims
-
getRemainingPlayerClaims
-
setRemainingTeamClaims
Sets the number of claimable chunks a team has left.If
remainingClaimsisnull, the team's remaining claim record is removed.- Parameters:
teamName- the team nameremainingClaims- the new number of remaining claims, ornullto remove the record
-
setRemainingPlayerClaims
Sets the number of claimable chunks a player has left.If
remainingClaimsisnull, the player's remaining claim record is removed.- Parameters:
playerUUID- the player's UUID as a stringremainingClaims- the new number of remaining claims, ornullto remove the record
-
setRemainingPlayerClaims
Sets the number of claimable chunks a player has left.If
remainingClaimsisnull, the player's remaining claim record is removed.- Parameters:
playerUUID- the player's UUIDremainingClaims- the new number of remaining claims, ornullto remove the record
-