Class TownyAPIWrapper
java.lang.Object
me.EtienneDx.RealEstate.ClaimAPI.Towny.TownyAPIWrapper
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
changeClaimOwner
(IClaim claim, UUID newOwner) Changes the owner of the specified claim to the new owner.getClaimAt
(org.bukkit.Location location) Retrieves the Towny plot (wrapped as an IClaim) at the given location.getPlayerData
(UUID player) Retrieves the player data for the specified player UUID.com.palmergames.bukkit.towny.object.Resident
getResident
(String name) Retrieves a Resident object corresponding to the given resident name.void
Registers any necessary Towny-specific events.void
Saves the given claim.
-
Constructor Details
-
TownyAPIWrapper
public TownyAPIWrapper()Instantiates a new TownyAPIWrapper.
-
-
Method Details
-
getClaimAt
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 interfaceIClaimAPI
- 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
-
getPlayerData
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 interfaceIClaimAPI
- Parameters:
player
- the UUID of the player whose claim data is requested- Returns:
- an instance of IPlayerData representing the player's data
-
changeClaimOwner
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 interfaceIClaimAPI
- Parameters:
claim
- the claim whose ownership is to be transferrednewOwner
- 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 interfaceIClaimAPI
-
getResident
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
-