Query the Current Claim
Docs/dominion-api/Query the Current Claim

Query the Current Claim

Read a claim's name, owner, members, and boundary from a location or player state.

Query the claim at a location

public void describeLocation(Player player) {
    DominionDTO dominion = api.getDominion(player.getLocation());
    if (dominion == null) {
        player.sendMessage("There is no claim here.");
        return;
    }

    player.sendMessage("Claim: " + dominion.getName());
    player.sendMessage("Owner: " + api.getPlayerName(dominion.getOwner()));
}

getDominion(Location) performs only a spatial query, making it suitable for commands, menus, and Placeholder-style display logic.

Display a player’s current claim

@EventHandler
public void onJoin(PlayerJoinEvent event) {
    Player player = event.getPlayer();
    DominionDTO dominion = api.getPlayerCurrentDominion(player);

    if (dominion != null) {
        player.sendMessage("You are currently in: " + dominion.getName());
    }
}

When a player joins or leaves the server, also clear any claim state that your addon caches itself. If you need to respond to boundary changes over time, listening directly for PlayerCrossDominionBorderEvent is more reliable.

Read the boundary

CuboidDTO cuboid = dominion.getCuboid();
player.sendMessage(String.format(
        "Range: (%d, %d, %d) -> (%d, %d, %d)",
        cuboid.x1(), cuboid.y1(), cuboid.z1(),
        cuboid.x2(), cuboid.y2(), cuboid.z2()
));

The upper boundary uses a half-open interval. When checking block coordinates, do not treat x2, y2, or z2 as included points. See Utilities for details.

Query members and groups

MemberDTO member = api.getMember(dominion, player.getUniqueId());
if (member == null) {
    player.sendMessage("You are not a member of this claim.");
    return;
}

GroupDTO group = api.getGroup(member);
if (group != null) {
    player.sendMessage("Permission group: " + group.getNamePlain());
}