Utilities
Use CuboidDTO, ColorParser, and McaRecord to work with Dominion spatial and display data.
CuboidDTO
CuboidDTO represents a three-dimensional cuboid. Common constructors include:
CuboidDTO cuboid = new CuboidDTO(
minX, minY, minZ,
maxX, maxY, maxZ
);
CuboidDTO fromLocations = new CuboidDTO(pos1, pos2);
Each axis is sorted during construction so that pos1 is not greater than pos2. It provides:
| Method | Use |
|---|---|
getPos1() / getPos2() | Get copies of the endpoint coordinate arrays |
getLoc1(World) / getLoc2(World) | Convert endpoints to Bukkit Location objects |
x1(), y1(), z1(), x2(), y2(), z2() | Read a coordinate on one axis |
xLength(), yLength(), zLength() | Read the length on each axis |
getSquare() / getVolume() | Read the base area / volume |
contain(x, y, z) | Check whether block coordinates are inside the range |
contain(other) / contain(other, ignoreY) | Check whether another range is contained |
containedBy(other) | Check whether this range is contained by another |
intersectWith(other) | Check whether two ranges intersect |
addUp, addDown, addNorth, addSouth, addEast, addWest | Change the range along a direction |
Coordinate boundaries
contain(x, y, z) uses half-open intervals:
x1 <= x < x2
y1 <= y < y2
z1 <= z < z2
Therefore x2, y2, and z2 are upper bounds, not included block coordinates. Methods such as xLength() use x2 - x1; do not add one again when calculating a claim size.
setPos1, setPos2, and add... mutate the object itself. Copy it before trying a boundary adjustment in an event:
CuboidDTO candidate = new CuboidDTO(dominion.getCuboid());
candidate.addEast(8);
ColorParser
ColorParser converts between Dominion’s string color format and Bukkit/Adventure representations:
| Method | Return value | Description |
|---|---|---|
getComponentType(String) | Adventure TextComponent | Parse as an Adventure component |
getBukkitType(String) | String | Convert to a Bukkit ChatColor string |
getPlainText(String) | String | Remove color codes and keep plain text |
Hex colors use the &#RRGGBB form, for example 7AAFFSky. Before displaying a group name or message, choose a Component, Bukkit string, or plain-text result according to the target API.
McaRecord
McaRecord is a Java record:
public record McaRecord(int x, int z, String world) {}
x and z are MCA region coordinates, and world is the world name. It describes only a region record; it is not a world backup and cannot replace a world or database backup.