Class WorldGuardAPI
- All Implemented Interfaces:
IClaimAPI
This class uses WorldGuard's platform API to query and wrap claims in the WGClaim class. Note that some operations (such as changing a claim's owner) are not supported.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPlayerPermission
(IClaim claim, UUID player, ClaimPermission permission) Adds the given player's permission to the specified claim.void
changeClaimOwner
(IClaim claim, UUID newOwner) Changes the owner of the specified claim.getClaimAt
(org.bukkit.Location bukkitLocation) Retrieves a claim at the specified Bukkit location.getPlayerData
(UUID player) Retrieves player-specific claim data.void
Registers any necessary event listeners for claim-related events.void
removePlayerPermission
(IClaim claim, UUID player) Removes any permission for the given player from the specified claim.void
Saves the specified claim.
-
Constructor Details
-
WorldGuardAPI
public WorldGuardAPI()Constructs a new WorldGuardAPI instance.It obtains the RegionContainer via the WorldGuard platform API.
-
-
Method Details
-
getClaimAt
Retrieves a claim at the specified Bukkit location.The method converts the given Bukkit location into a WorldEdit location and queries for applicable WorldGuard regions. If one or more regions are found, the first region is wrapped in a WGClaim instance.
- Specified by:
getClaimAt
in interfaceIClaimAPI
- Parameters:
bukkitLocation
- the Bukkit location to check for a claim- Returns:
- an IClaim instance representing the claim at the location, or
null
if no claim exists
-
saveClaim
-
getPlayerData
Retrieves player-specific claim data.Not supported in this implementation.
- Specified by:
getPlayerData
in interfaceIClaimAPI
- Parameters:
player
- the UUID of the player- Returns:
null
as player data is not implemented
-
changeClaimOwner
Changes the owner of the specified claim.Changing a claim's owner is not supported by WorldGuard. This method always throws an exception.
- Specified by:
changeClaimOwner
in interfaceIClaimAPI
- Parameters:
claim
- the claim whose owner is to be changednewOwner
- the UUID of the new owner- Throws:
UnsupportedOperationException
- always thrown as this operation is not supported
-
registerEvents
public void registerEvents()Registers any necessary event listeners for claim-related events.No events are registered for WorldGuard integration in this implementation.
- Specified by:
registerEvents
in interfaceIClaimAPI
-
addPlayerPermission
Adds the given player's permission to the specified claim.This method delegates to the WGClaim implementation's
addPlayerPermissions
method.- Parameters:
claim
- the claim (must be an instance of WGClaim)player
- the UUID of the player to grant permissionpermission
- the permission type to add (e.g. BUILD, ACCESS, etc.)
-
removePlayerPermission
Removes any permission for the given player from the specified claim.This method delegates to the WGClaim implementation's
dropPlayerPermissions
method.- Parameters:
claim
- the claim (must be an instance of WGClaim)player
- the UUID of the player whose permission should be removed
-