Class Claim
A Claim is defined by its owner, claim type, world, and a rectangular
region of chunks. Claims may have additional attributes such
as a name, whitelisted players, and protections.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddProtection(@NotNull org.bukkit.NamespacedKey protection) Adds a protection to this claim.voidaddWhitelistedPlayer(@NotNull UUID playerId) Adds a player to the whitelist of this claim.booleanChecks whether this claim contains the given chunk coordinates in the given world.booleancontains(@NotNull org.bukkit.Chunk chunk) Checks whether this claim contains the given chunk.intGets the first X-coordinate of the claimed area.intGets the second X-coordinate of the claimed area.intGets the first Z-coordinate of the claimed area.intGets the second Z-coordinate of the claimed area.@Nullable LonggetId()Gets the database ID of this claim.getName()Gets the display name of this claim.Gets the owner ID of this claim.Gets the list of protections applied to this claim.getType()Gets the type of this claim.Gets the list of whitelisted players in this claim.Gets the world UUID where this claim exists.booleanhasProtection(@NotNull Protection protection) Checks if this claim has a specific protection.booleanhasProtection(@NotNull org.bukkit.NamespacedKey protection) Checks if this claim has a specific protection.booleanisPlayerWhitelisted(@NotNull UUID playerID) Checks if a player is whitelisted in this claim.voidremoveProtection(@NotNull org.bukkit.NamespacedKey protection) Removes a protection from this claim.voidremoveWhitelistedPlayer(@NotNull UUID playerId) Removes a player from the whitelist of this claim.voidSets the database ID of this claim.voidSets the claim name of this claim.voidsetOwnerId(@NotNull String ownerId) Sets the owner ID of this claim.toString()
-
Constructor Details
-
Claim
public Claim(@Nullable @Nullable Long id, @NotNull @NotNull ClaimType type, @NotNull @NotNull String ownerId, @NotNull @NotNull UUID worldId, int chunkX1, int chunkZ1, int chunkX2, int chunkZ2, @NotNull @NotNull String name, @NotNull @NotNull List<UUID> whitelistedPlayers, @NotNull @NotNull List<String> protections) Constructs a new claim.- Parameters:
id- The database ID of this claim, ornullif not yet persisted.type- TheClaimTypeof this claim.ownerId- The ID of the owner (usually a player UUID as string, a team name or "server" depending on theClaimType).worldId- The UUID of the world where this claim is located.chunkX1- The X-coordinate of the first chunk corner.chunkZ1- The Z-coordinate of the first chunk corner.chunkX2- The X-coordinate of the opposite chunk corner.chunkZ2- The Z-coordinate of the opposite chunk corner.name- The display name of this claim.whitelistedPlayers- The list of players who are whitelisted in this claim.protections- The list of protections (as string keys). If empty and the Claim is not a placeholder, the default protections will be applied.
-
-
Method Details
-
getId
Gets the database ID of this claim.- Returns:
- The ID, or
nullif not yet persisted.
-
getType
Gets the type of this claim.- Returns:
- The claim type.
-
getOwnerId
Gets the owner ID of this claim.- Returns:
- The owner ID (usually a player UUID as string, a team name or "server" depending on the
ClaimType).
-
setOwnerId
Sets the owner ID of this claim.This method is intended for internal use only. Use ClaimManager to set the Owner ID. (usually a player UUID as string, a team name or "server" depending on the
ClaimType)- Parameters:
ownerId- The new owner ID.
-
getWorldId
Gets the world UUID where this claim exists.- Returns:
- The world UUID.
-
getChunkX1
public int getChunkX1()Gets the first X-coordinate of the claimed area.- Returns:
- The X-coordinate of the first corner chunk.
-
getChunkZ1
public int getChunkZ1()Gets the first Z-coordinate of the claimed area.- Returns:
- The Z-coordinate of the first corner chunk.
-
getChunkX2
public int getChunkX2()Gets the second X-coordinate of the claimed area.- Returns:
- The X-coordinate of the opposite corner chunk.
-
getChunkZ2
public int getChunkZ2()Gets the second Z-coordinate of the claimed area.- Returns:
- The Z-coordinate of the opposite corner chunk.
-
getName
Gets the display name of this claim.- Returns:
- The name of the claim
-
setName
Sets the claim name of this claim.This method is intended for internal use only. Use ClaimManager to change claim name.
- Parameters:
name- The new claim name.
-
setID
Sets the database ID of this claim.This method is intended for internal use only. DO NOT OVERRIDE THE ID OF CLAIMS THAT DON'T BELONG TO YOU.
- Parameters:
id- The new claim ID.
-
getWhitelistedPlayers
Gets the list of whitelisted players in this claim.- Returns:
- A list of whitelisted player UUIDs.
-
isPlayerWhitelisted
Checks if a player is whitelisted in this claim.- Parameters:
playerID- The player's UUID.- Returns:
trueif the player is whitelisted, otherwisefalse.
-
addWhitelistedPlayer
Adds a player to the whitelist of this claim.This method is intended for internal use only. Use ClaimManager to add a player to the whitelist.
- Parameters:
playerId- The UUID of the player to add.
-
removeWhitelistedPlayer
Removes a player from the whitelist of this claim.This method is intended for internal use only. Use ClaimManager to remove a player from the whitelist.
- Parameters:
playerId- The UUID of the player to remove.
-
getProtections
Gets the list of protections applied to this claim.- Returns:
- A list of protections keys as strings.
-
hasProtection
public boolean hasProtection(@NotNull @NotNull org.bukkit.NamespacedKey protection) Checks if this claim has a specific protection.- Parameters:
protection- TheNamespacedKeyof the protection.- Returns:
trueif the protection is present, otherwisefalse.
-
hasProtection
Checks if this claim has a specific protection.- Parameters:
protection- TheProtectionobject representing the protection.- Returns:
trueif the protection is present, otherwisefalse.
-
addProtection
@Internal public void addProtection(@NotNull @NotNull org.bukkit.NamespacedKey protection) Adds a protection to this claim.This method is intended for internal use only. Use ClaimManager to add protections.
- Parameters:
protection- TheNamespacedKeyof the protection to add.
-
removeProtection
@Internal public void removeProtection(@NotNull @NotNull org.bukkit.NamespacedKey protection) Removes a protection from this claim.This method is intended for internal use only. Use ClaimManager to remove protections.
- Parameters:
protection- TheNamespacedKeyof the protection to remove.
-
contains
Checks whether this claim contains the given chunk coordinates in the given world.- Parameters:
chunkX- The X-coordinate of the chunk.chunkZ- The Z-coordinate of the chunk.worldUUID- The UUID of the world.- Returns:
trueif the chunk is inside this claim, otherwisefalse.
-
contains
public boolean contains(@NotNull @NotNull org.bukkit.Chunk chunk) Checks whether this claim contains the given chunk.- Parameters:
chunk- TheChunkto check.- Returns:
trueif the chunk is inside this claim, otherwisefalse.
-
toString
-