Package cn.lunadeer.dominion.api.dtos
Interface DominionDTO
public interface DominionDTO
Public view of a Dominion and its persisted settings.
Mutating methods update the Dominion data store and return this dominion
instance when the update succeeds. Database failures are reported through
SQLException.
-
Method Summary
Modifier and TypeMethodDescription@NotNull StringgetColor()Gets the color of the dominion as a hexadecimal string.intGets the blue component of the dominion's color.intGets the green component of the dominion's color.intGets the hexadecimal representation of the dominion's color.intGets the red component of the dominion's color.@NotNull CuboidDTOGets the cuboid of the dominion.booleangetEnvFlagValue(@NotNull EnvFlag flag) Gets the value of a specific environment flag of the dominion.Gets the environment flag values configured for the dominion.Gets all groups belonging to the dominion.booleangetGuestFlagValue(@NotNull PriFlag flag) Gets the value of a specific guest privilege flag of the dominion.Gets the privilege flag values applied to guests of the dominion.@NotNull IntegergetId()Gets the ID of the dominion.@NotNull StringGets the message sent when a player enters the dominion.@NotNull StringGets the message sent when a player leaves the dominion.Gets all members belonging to the dominion.@NotNull StringgetName()Gets the name of the dominion.@NotNull UUIDgetOwner()Gets the UUID of the dominion owner.@NotNull PlayerDTOGets the DTO of the dominion owner.@NotNull IntegerGets the ID of the parent dominion.Gets the server ID associated with the dominion.@NotNull org.bukkit.LocationGets the teleport location of the dominion.@Nullable org.bukkit.WorldgetWorld()Gets the world where the dominion is located.@NotNull UUIDGets the UUID of the world where the dominion is located.@NotNull DominionDTOsetColor(@NotNull org.bukkit.Color color) Sets the map color of the dominion.@NotNull DominionDTOSets the cuboid of the dominion.@NotNull DominionDTOsetEnvFlagValue(@NotNull EnvFlag flag, @NotNull Boolean value) Sets the value of an environment flag for the dominion.@NotNull DominionDTOsetGuestFlagValue(@NotNull PriFlag flag, @NotNull Boolean value) Sets the value of a guest privilege flag for the dominion.@NotNull DominionDTOsetJoinMessage(String joinMessage) Sets the message sent when a player enters the dominion.@NotNull DominionDTOsetLeaveMessage(String leaveMessage) Sets the message sent when a player leaves the dominion.@NotNull DominionDTOSets the name of the dominion.@NotNull DominionDTOSets the owner of the dominion.@NotNull DominionDTOsetOwner(org.bukkit.entity.Player owner) Sets the owner of the dominion using a Bukkit player.@NotNull DominionDTOsetTpLocation(org.bukkit.Location tpLocation) Sets the teleport location of the dominion.
-
Method Details
-
getId
Gets the ID of the dominion.- Returns:
- the ID of the dominion
-
getOwner
Gets the UUID of the dominion owner.- Returns:
- the UUID of the dominion owner
-
getOwnerDTO
Gets the DTO of the dominion owner.Implementations may return
PlayerDTO.UNKNOWNwhen the owner is not present in the player cache.- Returns:
- the DTO of the dominion owner
-
setOwner
Sets the owner of the dominion.- Parameters:
owner- the UUID of the dominion owner- Returns:
- this dominion after the owner has been updated
- Throws:
SQLException- if a database access error occurs
-
setOwner
Sets the owner of the dominion using a Bukkit player.- Parameters:
owner- the dominion owner- Returns:
- this dominion after the owner has been updated
- Throws:
SQLException- if a database access error occurs
-
getName
Gets the name of the dominion.- Returns:
- the name of the dominion
-
setName
Sets the name of the dominion.- Parameters:
name- the name of the dominion- Returns:
- this dominion after the name has been updated
- Throws:
SQLException- if a database access error occurs
-
getWorld
@Nullable @Nullable org.bukkit.World getWorld()Gets the world where the dominion is located. Returns null if the world does not exist.- Returns:
- the world where the dominion is located
-
getWorldUid
Gets the UUID of the world where the dominion is located. This method guarantees a non-null UUID, but does not guarantee the existence of the world. To check if the world exists, usegetWorld().- Returns:
- the UUID of the world where the dominion is located
-
getCuboid
Gets the cuboid of the dominion.The cuboid uses the coordinate conventions documented by
CuboidDTO.- Returns:
- the cuboid of the dominion
-
setCuboid
Sets the cuboid of the dominion.- Parameters:
cuboid- the cuboid of the dominion- Returns:
- this dominion after the cuboid has been updated
- Throws:
SQLException- if a database access error occurs
-
getParentDomId
Gets the ID of the parent dominion.- Returns:
- the ID of the parent dominion, or -1 if there is no parent dominion
-
getJoinMessage
Gets the message sent when a player enters the dominion.- Returns:
- the enter message
-
setJoinMessage
Sets the message sent when a player enters the dominion.- Parameters:
joinMessage- the enter message- Returns:
- this dominion after the message has been updated
- Throws:
SQLException- if a database access error occurs
-
getLeaveMessage
Gets the message sent when a player leaves the dominion.- Returns:
- the leave message
-
setLeaveMessage
Sets the message sent when a player leaves the dominion.- Parameters:
leaveMessage- the leave message- Returns:
- this dominion after the message has been updated
- Throws:
SQLException- if a database access error occurs
-
getEnvironmentFlagValue
Gets the environment flag values configured for the dominion.- Returns:
- a map from environment flags to their configured values
-
getEnvFlagValue
Gets the value of a specific environment flag of the dominion.- Parameters:
flag- the environment flag- Returns:
- the value of the environment flag
-
getGuestPrivilegeFlagValue
Gets the privilege flag values applied to guests of the dominion.- Returns:
- a map from privilege flags to their configured guest values
-
getGuestFlagValue
Gets the value of a specific guest privilege flag of the dominion.- Parameters:
flag- the guest privilege flag- Returns:
- the value of the guest privilege flag
-
setEnvFlagValue
@NotNull @NotNull DominionDTO setEnvFlagValue(@NotNull @NotNull EnvFlag flag, @NotNull @NotNull Boolean value) throws SQLException Sets the value of an environment flag for the dominion.- Parameters:
flag- the flagvalue- the value of the flag- Returns:
- this dominion after the flag has been updated
- Throws:
SQLException- if a database access error occurs
-
setGuestFlagValue
@NotNull @NotNull DominionDTO setGuestFlagValue(@NotNull @NotNull PriFlag flag, @NotNull @NotNull Boolean value) throws SQLException Sets the value of a guest privilege flag for the dominion.- Parameters:
flag- the flagvalue- the value of the flag- Returns:
- this dominion after the flag has been updated
- Throws:
SQLException- if a database access error occurs
-
getTpLocation
@NotNull @NotNull org.bukkit.Location getTpLocation()Gets the teleport location of the dominion.If no custom location is configured, the center location of the cuboid is returned.
- Returns:
- the teleport location of the dominion
-
setTpLocation
Sets the teleport location of the dominion.- Parameters:
tpLocation- the teleport location of the dominion- Returns:
- this dominion after the teleport location has been updated
- Throws:
SQLException- if a database access error occurs
-
getColorR
int getColorR()Gets the red component of the dominion's color.- Returns:
- the red component of the dominion's color
-
getColorG
int getColorG()Gets the green component of the dominion's color.- Returns:
- the green component of the dominion's color
-
getColorB
int getColorB()Gets the blue component of the dominion's color.- Returns:
- the blue component of the dominion's color
-
getColor
Gets the color of the dominion as a hexadecimal string.- Returns:
- a color in
#RRGGBBform
-
getColorHex
int getColorHex()Gets the hexadecimal representation of the dominion's color.- Returns:
- the RGB value in the range
0x000000to0xFFFFFF
-
setColor
@NotNull @NotNull DominionDTO setColor(@NotNull @NotNull org.bukkit.Color color) throws SQLException Sets the map color of the dominion.- Parameters:
color- the color- Returns:
- this dominion after the color has been updated
- Throws:
SQLException- if a database access error occurs
-
getGroups
Gets all groups belonging to the dominion.- Returns:
- the list of groups
-
getMembers
Gets all members belonging to the dominion.- Returns:
- the list of members
-
getServerId
Integer getServerId()Gets the server ID associated with the dominion.- Returns:
- the server ID associated with the dominion
-