Queries and Permissions
Retrieve claims, members, and groups, then perform the correct Dominion permission check before a player action.
Query the claim at a location
DominionDTO dominion = api.getDominion(location);
if (dominion == null) {
// Handle an unclaimed area using your addon's default logic.
return;
}
String name = dominion.getName();
UUID owner = dominion.getOwner();
This is the best query for menus, messages, logs, and pre-checking an action. The location should come from the current event, and you should confirm that its world is not null.
Query a player’s current claim
DominionDTO current = api.getPlayerCurrentDominion(player);
This method participates in Dominion’s cache of the player’s current location and may fire entry/exit events. If you only want to read the claim containing the current block, use getDominion(player.getLocation()).
Query members and permission groups
MemberDTO member = api.getMember(dominion, player.getUniqueId());
if (member != null) {
GroupDTO group = api.getGroup(member);
boolean personalContainer = member.getFlagValue(Flags.CONTAINER);
boolean groupContainer = group != null && group.getFlagValue(Flags.CONTAINER);
}
The example is suitable for displaying data. Do not implement the final permission decision as personalContainer || groupContainer: Dominion also considers the owner, guests, world-wide rules, admin permissions, and other precedence rules. For the final action, call checkPrivilegeFlag.
Permission checks
With Dominion feedback
if (!api.checkPrivilegeFlag(
block.getLocation(),
Flags.BREAK_BLOCK,
player
)) {
return;
}
// Continue with your logic.
Silent check
boolean allowed = api.checkPrivilegeFlagSilence(
location,
Flags.CONTAINER,
player
);
The silent version does not send Dominion’s denial message or trigger related feedback events. It is suitable for deciding whether to show a menu button, background pre-checks, and integrations that do not directly represent a player’s action. Use the non-silent version when a real action should explain the reason for denial to the player.
Environment checks
if (api.checkEnvironmentFlag(location, Flags.FIRE_SPREAD)) {
// The Dominion environment rules allow fire to spread at this location.
}
An environment check does not need a player parameter. The position-based overload is recommended because it also considers world-wide rules. Use checkEnvironmentFlag(DominionDTO, EnvFlag) only when you explicitly want to check a specific claim object.
Multiple servers and caching
Some queries by ID, name, owner, and group read Dominion’s local or multi-server cache. A cache is not a real-time database connection:
- do not retain a DTO reference as permanent truth; query again when you need to use it;
- do not edit the database or Dominion’s internal cache directly;
- for cross-server integrations, handle temporary target-server unavailability, cache delay, and teleport failure;
- after a claim is deleted or a member is removed, an old DTO may still be held by your asynchronous callback; re-confirm its state before using it.