Class TownyClaim

java.lang.Object
me.EtienneDx.RealEstate.ClaimAPI.Towny.TownyClaim
All Implemented Interfaces:
IClaim

public class TownyClaim extends Object implements IClaim
A simple Towny claim wrapper.

In Towny, the “claim” is the plot belonging to a town. This class creates an IClaim implementation from a Bukkit Location.

  • Constructor Summary

    Constructors
    Constructor
    Description
    TownyClaim(org.bukkit.Location location)
    Constructs a new TownyClaim using the given location.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addManager(UUID player)
    Adds a manager to this claim.
    void
    Adds a specific permission for the given player on this claim.
    void
    Clears all managers from this claim.
    void
    Clears all player-specific permissions on this claim.
    void
    Drops any player-specific permissions for the given player on this claim.
    int
    Returns the area of the Towny claim.
    Returns an iterable over the child claims.
    Returns a unique identifier for this Towny claim.
    Returns the owner of the claim as a UUID.
    Returns the name of the claim's owner.
    Returns the parent claim of this claim.
    org.bukkit.World
    Returns the world where this claim is located.
    int
    Returns the X-coordinate of the claim's location.
    int
    Returns the Y-coordinate of the claim's location.
    int
    Returns the Z-coordinate of the claim's location.
    boolean
    Indicates whether this claim is an admin claim.
    boolean
    Indicates whether this claim is a parent claim.
    boolean
    Indicates whether this claim is a subclaim.
    boolean
    Indicates whether this claim represents wilderness.
    void
    Removes the specified manager from this claim.
    void
    setInheritPermissions(boolean inherit)
    Sets whether this claim should inherit permissions from its parent.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TownyClaim

      public TownyClaim(org.bukkit.Location location)
      Constructs a new TownyClaim using the given location.
      Parameters:
      location - the Bukkit Location representing the Towny plot
  • Method Details

    • getId

      public String getId()
      Returns a unique identifier for this Towny claim.

      The ID is generated based on the world name and the block X and Z coordinates.

      Specified by:
      getId in interface IClaim
      Returns:
      a unique string identifier for the claim
    • getArea

      public int getArea()
      Returns the area of the Towny claim.

      Assumes a standard Towny plot size of 16x16 blocks.

      Specified by:
      getArea in interface IClaim
      Returns:
      the area of the claim in blocks
    • getWorld

      public org.bukkit.World getWorld()
      Returns the world where this claim is located.
      Specified by:
      getWorld in interface IClaim
      Returns:
      the World of the claim
    • getX

      public int getX()
      Returns the X-coordinate of the claim's location.
      Specified by:
      getX in interface IClaim
      Returns:
      the block X coordinate
    • getY

      public int getY()
      Returns the Y-coordinate of the claim's location.
      Specified by:
      getY in interface IClaim
      Returns:
      the block Y coordinate
    • getZ

      public int getZ()
      Returns the Z-coordinate of the claim's location.
      Specified by:
      getZ in interface IClaim
      Returns:
      the block Z coordinate
    • isAdminClaim

      public boolean isAdminClaim()
      Indicates whether this claim is an admin claim.

      Towny does not designate "admin claims" in the same manner.

      Specified by:
      isAdminClaim in interface IClaim
      Returns:
      false always
    • getChildren

      public Iterable<IClaim> getChildren()
      Returns an iterable over the child claims.

      Towny plots do not have child claims.

      Specified by:
      getChildren in interface IClaim
      Returns:
      an empty list
    • isWilderness

      public boolean isWilderness()
      Indicates whether this claim represents wilderness.

      For simplicity, a Towny claim is never considered wilderness.

      Specified by:
      isWilderness in interface IClaim
      Returns:
      false always
    • isSubClaim

      public boolean isSubClaim()
      Indicates whether this claim is a subclaim.

      Not applicable for Towny.

      Specified by:
      isSubClaim in interface IClaim
      Returns:
      false always
    • isParentClaim

      public boolean isParentClaim()
      Indicates whether this claim is a parent claim.

      All Towny claims are treated as parent claims.

      Specified by:
      isParentClaim in interface IClaim
      Returns:
      true always
    • getParent

      public IClaim getParent()
      Returns the parent claim of this claim.

      Towny plots do not have a parent claim.

      Specified by:
      getParent in interface IClaim
      Returns:
      null always
    • dropPlayerPermissions

      public void dropPlayerPermissions(UUID player)
      Drops any player-specific permissions for the given player on this claim.

      Not applicable for Towny.

      Specified by:
      dropPlayerPermissions in interface IClaim
      Parameters:
      player - the UUID of the player
    • addPlayerPermissions

      public void addPlayerPermissions(UUID player, ClaimPermission permission)
      Adds a specific permission for the given player on this claim.

      Not applicable for Towny.

      Specified by:
      addPlayerPermissions in interface IClaim
      Parameters:
      player - the UUID of the player
      permission - the permission to add
    • clearPlayerPermissions

      public void clearPlayerPermissions()
      Clears all player-specific permissions on this claim.

      Not applicable for Towny.

      Specified by:
      clearPlayerPermissions in interface IClaim
    • removeManager

      public void removeManager(UUID player)
      Removes the specified manager from this claim.

      Not applicable for Towny.

      Specified by:
      removeManager in interface IClaim
      Parameters:
      player - the UUID of the manager to remove
    • addManager

      public void addManager(UUID player)
      Adds a manager to this claim.

      Not applicable for Towny.

      Specified by:
      addManager in interface IClaim
      Parameters:
      player - the UUID of the manager to add
    • clearManagers

      public void clearManagers()
      Clears all managers from this claim.

      Not applicable for Towny.

      Specified by:
      clearManagers in interface IClaim
    • getOwner

      public UUID getOwner()
      Returns the owner of the claim as a UUID.

      In a full implementation, this method would resolve the owner's UUID from Towny data. For this example, it returns null.

      Specified by:
      getOwner in interface IClaim
      Returns:
      the UUID of the claim's owner, or null if not available
    • getOwnerName

      public String getOwnerName()
      Returns the name of the claim's owner.
      Specified by:
      getOwnerName in interface IClaim
      Returns:
      the owner name as a String
    • setInheritPermissions

      public void setInheritPermissions(boolean inherit)
      Sets whether this claim should inherit permissions from its parent.

      Not applicable for Towny.

      Specified by:
      setInheritPermissions in interface IClaim
      Parameters:
      inherit - true to inherit permissions, false otherwise