API Modules
The public DominionAPI modules, package structure, and boundaries of each module.
Module overview
| Module | Main package | Purpose | Details |
|---|---|---|---|
| Main API | cn.lunadeer.dominion.api | Get the singleton, query data, check permissions, and access providers | Main API |
| Providers | cn.lunadeer.dominion.providers | Create, modify, and delete data in a controlled way | Providers |
| DTOs and data model | cn.lunadeer.dominion.api.dtos | Represent claims, members, groups, players, templates, and spatial ranges | DTOs and data model |
| Flags | cn.lunadeer.dominion.api.dtos.flag | Read built-in flags, register custom flags, and organize UI groups | Flags |
| Events | cn.lunadeer.dominion.events | Listen for claim movement, data operations, and custom flag registration | Events |
| Utilities | cn.lunadeer.dominion.utils | Handle colors, MCA region records, and cuboid ranges | Utilities |
Dependencies
A typical call path looks like this:
DominionAPI
├─ Query -> DominionDTO / MemberDTO / GroupDTO / PlayerDTO
├─ Permission -> PriFlag / EnvFlag
├─ Write -> DominionProvider / GroupProvider / MemberProvider / ...
└─ Integration -> Dominion events
Most addons only need the main API, DTOs, Flags, and a few events. Add providers only when you actually need to create or modify Dominion data. The fact that an internal class is accessible does not make it part of the extension API.
How to choose a module
- To display a claim name, boundary, or owner: use DTOs;
- to check whether a player can perform an action: use
DominionAPI.checkPrivilegeFlag(...); - to check a claim’s environment rule: use
DominionAPI.checkEnvironmentFlag(...); - to rename a claim, add a member, or change a flag: use the corresponding provider;
- to respond to claim entry or exit: listen for
PlayerMoveInDominionEvent,PlayerMoveOutDominionEvent, orPlayerCrossDominionBorderEvent; - to add a rule configurable in the Dominion UI: register a custom flag and implement its actual behavior in the addon.