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 TypeMethodDescriptionvoidaddPlayerPermission(IClaim claim, UUID player, ClaimPermission permission) Adds the given player's permission to the specified claim.voidchangeClaimOwner(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.voidRegisters any necessary event listeners for claim-related events.voidremovePlayerPermission(IClaim claim, UUID player) Removes any permission for the given player from the specified claim.voidSaves 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:
getClaimAtin interfaceIClaimAPI- Parameters:
bukkitLocation- the Bukkit location to check for a claim- Returns:
- an IClaim instance representing the claim at the location, or
nullif no claim exists
-
saveClaim
-
getPlayerData
Retrieves player-specific claim data.Not supported in this implementation.
- Specified by:
getPlayerDatain interfaceIClaimAPI- Parameters:
player- the UUID of the player- Returns:
nullas 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:
changeClaimOwnerin 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:
registerEventsin interfaceIClaimAPI
-
addPlayerPermission
Adds the given player's permission to the specified claim.This method delegates to the WGClaim implementation's
addPlayerPermissionsmethod.- 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
dropPlayerPermissionsmethod.- Parameters:
claim- the claim (must be an instance of WGClaim)player- the UUID of the player whose permission should be removed
-