# Developer API

You can import ExcellentClaims to your project using Maven. Replace {VERSION} with the latest version below:

<repository>
  <id>nightexpress-releases</id>
  <url>https://repo.nightexpressdev.com/releases</url>
</repository>

<dependency>
  <groupId>su.nightexpress.excellentclaims</groupId>
  <artifactId>ExcellentClaims</artifactId>
  <version>{VERSION}</version>
</dependency>

# Events

  • ChunkClaimedEvent - When chunk is claimed by a player.
  • ChunkClaimEvent - When player is about to claim a chunk. Cancellable
  • ChunkMergedEvent - When player merged chunk into claim.
  • ChunkMergeEvent - When player is about to merge chunk into claim. Cancellable
  • ChunkSeparatedEvent - When player seprated claim chunk.
  • ChunkSeprateEvent - When player is about to separate a claim chunk. Cancellable
  • ChunkUnclaimedEvent - When claim is removed by a player.
  • ChunkUnclaimEvent - When player is about to remove claim. Cancellable
  • RegionCreatedEvent - When region is created by a player.
  • RegionCreateEvent - When player is about to create a region. Cancellable
  • RegionRemovedEvent - When region removed by a player.
  • RegionRemoveEvent - When player is about to remove a region. Cancellable

# Accessing Data

// Ensure API is loaded
boolean isLoaded = ClaimsAPI.isLoaded();

// Get plugin instance.
ClaimPlugin plugin = ClaimsAPI.getPlugin();

// Get ClaimManager
ClaimManager claimManager = ClaimsAPI.getClaimManager();

// Get MemberManager
MemberManager memberManager = ClaimsAPI.getMemberManager();

// Get SelectionManager
SelectionManager selectionManager = ClaimsAPI.getSelectionManager();

// Get MenuManager
MenuManager menuManager = ClaimsAPI.getMenuManager();

// Test Claim Restrictions
boolean canMobSpawn = claimManager.canMobSpawn(@NotNull Entity entity, @NotNull Location location);
boolean canUseBlock = claimManager.canUseBlock(@NotNull Entity entity, @NotNull Block block, @Nullable Action action);
boolean canUseItem = claimManager.canUseItem(@NotNull Player player, @NotNull Location location, @NotNull ItemStack itemStack);
boolean canUseEntity = claimManager.canUseEntity(@NotNull Player player, @NotNull Location location, @NotNull Entity entity);
boolean canDamage = claimManager.canDamage(@Nullable Entity damager, @NotNull Entity target, @NotNull DamageType damageType);
boolean canThrowProjectile = claimManager.canThrowProjectile(@NotNull Player player, @NotNull Projectile projectile);
boolean canUseCommand = claimManager.canUseCommand(@NotNull Player player, @NotNull Command command);
boolean canBreak = claimManager.canBreak(@NotNull Player player, @NotNull Block block);
boolean canBuild = claimManager.canBuild(@NotNull Player player, @NotNull Block block);
boolean canHarvest = claimManager.canHarvest(@NotNull Player player, @NotNull Block block);

// Claims storage & lookup.
ClaimStorage storage = claimManager.getStorage();

// Claim management.
String claimName = claimManager.getClaimName(@NotNull Location location, @Nullable ClaimType type);
String claimId = claimManager.getClaimId(@NotNull Location location, @Nullable ClaimType type);
String ownerName = claimManager.getClaimOwnerName(@NotNull Location location, @Nullable ClaimType type);

// Get claims amount.
int claimsAmount = claimManager.countClaims(@NotNull Player player, @NotNull ClaimType type);

// Check if location is occipied by a claim or region.
boolean isClaimed = claimManager.isClaimed(@NotNull Location location);
boolean isClaimed = claimManager.isClaimed(@NotNull Block block);
boolean isClaimed = claimManager.isClaimed(@NotNull World world, @NotNull BlockPos pos);
boolean isClaimed = claimManager.isClaimed(@NotNull String worldName, @NotNull BlockPos blockPos);

// Check if chunk is claimed by chunk position.
boolean isChunkClaimed = claimManager.isChunkClaimed(@NotNull Location location);
boolean isChunkClaimed = claimManager.isChunkClaimed(@NotNull Block block);
boolean isChunkClaimed = claimManager.isChunkClaimed(@NotNull World world, int x, int z);
boolean isChunkClaimed = claimManager.isChunkClaimed(@NotNull World world, @NotNull ChunkPos pos);
boolean isChunkClaimed = claimManager.isChunkClaimed(@NotNull String worldName, @NotNull ChunkPos pos);

// Check if there are regions at given location.
boolean isRegionClaim = claimManager.isRegionClaim(@NotNull Location location);
boolean isRegionClaim = claimManager.isRegionClaim(@NotNull Block block);
boolean isRegionClaim = claimManager.isRegionClaim(@NotNull World world, @NotNull BlockPos pos);
boolean isRegionClaim = claimManager.isRegionClaim(@NotNull String worldName, @NotNull BlockPos pos);

// Get claim with the greatest priority by location.
LandClaim landClaim = claimManager.getPrioritizedLand(@NotNull Block block);
LandClaim landClaim = claimManager.getPrioritizedLand(@NotNull Location location);
LandClaim landClaim = claimManager.getPrioritizedLand(@NotNull World world, @NotNull BlockPos blockPos);

RegionClaim regionClaim = claimManager.getPrioritizedRegion(@NotNull Block block);
RegionClaim regionClaim = claimManager.getPrioritizedRegion(@NotNull Location location);
RegionClaim regionClaim = claimManager.getPrioritizedRegion(@NotNull World world, @NotNull BlockPos blockPos);

Claim claim = claimManager.getPrioritizedClaim(@NotNull Block block);
Claim claim = claimManager.getPrioritizedClaim(@NotNull Block block, @Nullable ClaimType type);
Claim claim = claimManager.getPrioritizedClaim(@NotNull Location location);
Claim claim = claimManager.getPrioritizedClaim(@NotNull Location location, @Nullable ClaimType type);
Claim claim = claimManager.getPrioritizedClaim(@NotNull World world, @NotNull BlockPos blockPos);
Claim claim = claimManager.getPrioritizedClaim(@NotNull World world, @NotNull BlockPos blockPos, @Nullable ClaimType type);
Claim claim = claimManager.getPrioritizedClaim(@NotNull String worldName, @NotNull BlockPos blockPos, @Nullable ClaimType type);