Developer API
ClaimsForge exposes a public Java API so other plugins can query claim ownership and permissions.
Getting the API instance
import org.bukkit.Bukkit;
ChunkClaimApi api = Bukkit.getServicesManager()
.getRegistration(ChunkClaimApi.class)
.getProvider();
Warning: Always null-check the registration. ClaimsForge might not be installed on all servers.
var reg = Bukkit.getServicesManager().getRegistration(ChunkClaimApi.class);
if (reg == null) {
// ClaimsForge not installed — handle gracefully
return;
}
ChunkClaimApi api = reg.getProvider();
API methods
Checking Claim Status
// Is this chunk claimed by anyone?
boolean claimed = api.isClaimed(chunk);
// Who owns this chunk? (empty if wilderness)
Optional<UUID> owner = api.getOwner(chunk);
owner.ifPresent(uuid -> {
String name = Bukkit.getOfflinePlayer(uuid).getName();
player.sendMessage("This chunk belongs to: " + name);
});
Checking Player Permissions
// Can this player place/break blocks here?
boolean canBuild = api.canBuild(player, block);
// Can this player use buttons/doors/levers?
boolean canInteract = api.canInteract(player, block);
// Can this player open chests/barrels/furnaces?
boolean canOpenContainer = api.canOpenContainer(player, block);
Example: custom protection listener
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
Player player = event.getPlayer();
Block block = event.getBlock();
if (!api.canBuild(player, block)) {
event.setCancelled(true);
player.sendMessage("§cYou don't have permission to build here!");
}
}
Soft-dependency setup (plugin.yml)
name: MyPlugin
version: 1.0.0
depend: []
softdepend:
- ClaimsForge
Using softdepend means your plugin loads after ClaimsForge if it's present, but still loads without it.