DTOs and Data Model
Docs/dominion-api/DTOs and Data Model

DTOs and Data Model

Read claims, members, groups, players, templates, and three-dimensional range objects.

What is a DTO?

A DTO (Data Transfer Object) is a runtime data view exposed by Dominion to addons. DTOs are suitable for reading and display; they are not an entry point for bypassing providers and editing the database directly.

DominionDTO

DominionDTO represents a claim. Common fields include:

MethodMeaning
getId()Claim ID
getName()Claim name
getOwner() / getOwnerDTO()Owner UUID / player DTO
getWorld() / getWorldUid()Current world object / world UUID
getCuboid()The claim’s three-dimensional boundary
getParentDomId()Parent claim ID; -1 means there is no parent
getTpLocation()Teleport point; returns the claim center when none is set
getJoinMessage() / getLeaveMessage()Entry and exit messages
getGroups() / getMembers()Group and member lists
getServerId()Server ID that created or manages the claim
getColorR(), getColorG(), getColorB(), getColor(), getColorHex()Different representations of the map color

If a world is unloaded or does not exist, getWorld() may be null; getWorldUid() still has a value. Check getWorld() before accessing the world object.

Read claim flags individually or as complete maps:

boolean allowsCreeper = dominion.getEnvFlagValue(Flags.CREEPER_EXPLODE);
boolean guestCanOpen = dominion.getGuestFlagValue(Flags.CONTAINER);
Map<EnvFlag, Boolean> environment = dominion.getEnvironmentFlagValue();
Map<PriFlag, Boolean> guest = dominion.getGuestPrivilegeFlagValue();

MemberDTO

MemberDTO represents a player’s membership in a claim:

MethodMeaning
getId()Member record ID
getPlayerUUID()Member’s player UUID
getDomID()Claim ID
getGroupId()Group ID; -1 means the member is not in a group
getPlayer()The corresponding PlayerDTO
getFlagValue(PriFlag)The member’s individual permission value
getFlagsValue()The member’s individual permission Map

When a flag is not stored separately for a member, getFlagValue returns that flag’s default value. To determine whether a player can actually perform an action, prefer the main API’s checkPrivilegeFlag; do not read the member Map and reproduce the permission-merging logic yourself.

GroupDTO

GroupDTO represents a permission group inside a claim:

  • getId(): group ID; getDomID(): claim ID;
  • getNamePlain(): name without colors, suitable for logs, comparisons, and persistent display;
  • getNameRaw(): raw name with Dominion color codes;
  • getNameColoredComponent(): an Adventure Component;
  • getNameColoredBukkit(): a Bukkit ChatColor string;
  • getFlagValue(PriFlag) / getFlagsValue(): group permissions;
  • getMembers(): members in the group.

Group names may contain color information. Unless you actually need to render the name, do not use getNameRaw() as the only identifier; the group ID is the stable association value.

PlayerDTO

PlayerDTO stores data about a player known to Dominion: getId(), getUuid(), getLastKnownName(), getUsingGroupTitleID(), and getSkinUrl(). Query methods usually return null when a player cannot be found. PlayerDTO.UNKNOWN is an explicit placeholder with special unknown ID and UUID values; it is not a real player.

TemplateDTO

TemplateDTO is a reusable set of permission values owned by a player. It provides getId(), getCreator(), getName(), getFlagValue(PriFlag), and getFlagsValue(). Create, modify, and apply templates through TemplateProvider.

Write boundaries

Although the following DTO methods exist, addons should not call them directly in business code:

  • DominionDTO.setOwner, setName, setCuboid, set...FlagValue, and similar methods;
  • MemberDTO.setFlagValue;
  • GroupDTO.setName, setFlagValue;
  • mutating an object returned by get...() and expecting Dominion to synchronize it automatically.

Use Providers or the corresponding event flow instead. This keeps the cache, database, economy, and other addons aligned on the same state.