Common API
Docs/dominion-api/Common API

Common API

Find DominionAPI calls for queries, permission checks, data writes, and event integrations.

Common API at a glance

NeedPreferred APIDetails
Query the claim at a locationDominionAPI#getDominion(Location)Queries and permissions
Query a player’s current claimDominionAPI#getPlayerCurrentDominion(Player)Queries and permissions
Check whether a player can perform an actioncheckPrivilegeFlag / checkPrivilegeFlagSilenceQueries and permissions
Check an environment rulecheckEnvironmentFlag(Location, EnvFlag)Queries and permissions
Modify a claim, member, or groupThe corresponding ProviderData writes
Listen for claim entry and exitPlayerMoveInDominionEvent, and othersEvent integrations
Register a configurable new ruleFlags.register... + Flags.applyChanges()Flags module

Call sequence

Typical addon logic can follow this sequence:

  1. Cache the DominionAPI singleton in onEnable();
  2. query the target DTO by location or UUID;
  3. end the flow immediately when the query returns nothing; do not use a special ID to pretend that an object exists;
  4. use the position-based permission check when a player action needs authorization;
  5. use a provider for data changes and process the completion value asynchronously;
  6. listen for events when you need to respond to state changes instead of periodically scanning every claim.