Class TownyAPIWrapper

java.lang.Object
me.EtienneDx.RealEstate.ClaimAPI.Towny.TownyAPIWrapper
All Implemented Interfaces:
IClaimAPI

public class TownyAPIWrapper extends Object implements IClaimAPI
TownyAPIWrapper provides a Towny-specific implementation of the IClaimAPI interface.

Since Towny does not use claims in the same manner as other claim management plugins, this implementation wraps a Towny plot as an IClaim.

  • Constructor Details

    • TownyAPIWrapper

      public TownyAPIWrapper()
      Instantiates a new TownyAPIWrapper.
  • Method Details

    • getClaimAt

      public IClaim getClaimAt(org.bukkit.Location location)
      Retrieves the Towny plot (wrapped as an IClaim) at the given location.

      Note: Towny does not have claims like GriefPrevention, so this method wraps the Towny plot at the specified location.

      Specified by:
      getClaimAt in interface IClaimAPI
      Parameters:
      location - the Bukkit location to check for a Towny plot
      Returns:
      an instance of IClaim representing the Towny plot at the given location
    • saveClaim

      public void saveClaim(IClaim claim)
      Saves the given claim.

      Towny claims are managed internally by Towny; therefore, no saving is necessary.

      Specified by:
      saveClaim in interface IClaimAPI
      Parameters:
      claim - the claim to be saved
    • getPlayerData

      public IPlayerData getPlayerData(UUID player)
      Retrieves the player data for the specified player UUID.

      This method creates a TownyPlayerData wrapper for the given player's data.

      Specified by:
      getPlayerData in interface IClaimAPI
      Parameters:
      player - the UUID of the player whose claim data is requested
      Returns:
      an instance of IPlayerData representing the player's data
    • changeClaimOwner

      public void changeClaimOwner(IClaim claim, UUID newOwner)
      Changes the owner of the specified claim to the new owner.

      Changing the owner of a Towny plot is not supported in the same way as with other claim management systems. This method always throws an UnsupportedOperationException.

      Specified by:
      changeClaimOwner in interface IClaimAPI
      Parameters:
      claim - the claim whose ownership is to be transferred
      newOwner - the UUID of the new owner
      Throws:
      UnsupportedOperationException - always, since changing owner is not supported
    • registerEvents

      public void registerEvents()
      Registers any necessary Towny-specific events.

      This implementation is empty; if Towny-specific events need to be registered, add the registration logic here.

      Specified by:
      registerEvents in interface IClaimAPI
    • getResident

      public com.palmergames.bukkit.towny.object.Resident getResident(String name)
      Retrieves a Resident object corresponding to the given resident name.

      If the resident is not registered within Towny, this method returns null.

      Parameters:
      name - the name of the resident
      Returns:
      the Resident associated with the given name, or null if not found