Package cn.lunadeer.dominion.providers
Class DominionProvider
java.lang.Object
cn.lunadeer.dominion.providers.DominionProvider
Provides asynchronous operations for creating, modifying, and managing dominions.
These methods are controlled by the Dominion system, including permission,
validation, economy, cache, and event processing.
A returned future normally completes with the updated DTO and completes
with null when the event is cancelled or the operation fails.
The operator parameter of each method defines who triggers the operation. If the operator is a specific player,
these methods will check permissions accordingly. For no-permission-required operations, you can pass
the console command sender Bukkit.getConsoleSender().
- Since:
- 4.6.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static DominionProviderThe provider instance initialized by Dominion. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract CompletableFuture<DominionDTO>createDominion(@NotNull org.bukkit.command.CommandSender operator, @NotNull String name, @NotNull UUID owner, @NotNull org.bukkit.World world, @NotNull CuboidDTO cuboid, @Nullable DominionDTO parent, boolean skipEconomy) Creates a new dominion in the specified world with the given parameters.deleteDominion(@NotNull org.bukkit.command.CommandSender operator, @NotNull DominionDTO dominion, boolean skipEconomy) Deletes a dominion with force enabled by default.abstract CompletableFuture<DominionDTO>deleteDominion(@NotNull org.bukkit.command.CommandSender operator, @NotNull DominionDTO dominion, boolean skipEconomy, boolean force) Deletes a dominion and optionally all of its sub-dominions.static DominionProviderGets the singleton instance of the DominionProvider.abstract CompletableFuture<DominionDTO>renameDominion(@NotNull org.bukkit.command.CommandSender operator, @NotNull DominionDTO dominion, @NotNull String newName) Renames an existing dominion to a new name.abstract CompletableFuture<DominionDTO>resizeDominion(@NotNull org.bukkit.command.CommandSender operator, @NotNull DominionDTO dominion, DominionReSizeEvent.TYPE type, DominionReSizeEvent.DIRECTION direction, int size) Resizes an existing dominion by expanding or contracting it in a specified direction.abstract CompletableFuture<DominionDTO>setDominionEnvFlag(@NotNull org.bukkit.command.CommandSender operator, @NotNull DominionDTO dominion, @NotNull EnvFlag flag, boolean newValue) Sets an environment flag for the dominion.abstract CompletableFuture<DominionDTO>setDominionGuestFlag(@NotNull org.bukkit.command.CommandSender operator, @NotNull DominionDTO dominion, @NotNull PriFlag flag, boolean newValue) Sets a guest privilege flag for the dominion.abstract CompletableFuture<DominionDTO>setDominionMapColor(@NotNull org.bukkit.command.CommandSender operator, @NotNull DominionDTO dominion, @NotNull org.bukkit.Color newColor) Sets the map display color for the dominion.abstract CompletableFuture<DominionDTO>setDominionMessage(@NotNull org.bukkit.command.CommandSender operator, @NotNull DominionDTO dominion, DominionSetMessageEvent.TYPE type, @NotNull String newMessage) Sets a message for the dominion (enter/leave messages, etc.).abstract CompletableFuture<DominionDTO>setDominionTpLocation(@NotNull org.bukkit.command.CommandSender operator, @NotNull DominionDTO dominion, @NotNull org.bukkit.Location newTpLocation) Sets the teleport location for a dominion.transferDominion(@NotNull org.bukkit.command.CommandSender operator, @NotNull DominionDTO dominion, @NotNull PlayerDTO newOwner) Transfers ownership of a dominion to a new player with force enabled by default.abstract CompletableFuture<DominionDTO>transferDominion(@NotNull org.bukkit.command.CommandSender operator, @NotNull DominionDTO dominion, @NotNull PlayerDTO newOwner, boolean force) Transfers ownership of a dominion to a new player.
-
Field Details
-
instance
The provider instance initialized by Dominion.
-
-
Constructor Details
-
DominionProvider
public DominionProvider()
-
-
Method Details
-
getInstance
Gets the singleton instance of the DominionProvider.- Returns:
- the current provider instance, or
nullif not initialized
-
createDominion
public abstract CompletableFuture<DominionDTO> createDominion(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull String name, @NotNull @NotNull UUID owner, @NotNull @NotNull org.bukkit.World world, @NotNull @NotNull CuboidDTO cuboid, @Nullable @Nullable DominionDTO parent, boolean skipEconomy) Creates a new dominion in the specified world with the given parameters.- Parameters:
operator- the command sender performing this operation (for permission checks and logging)name- the name of the new dominion (must be unique within the parent scope)owner- the UUID of the player who will own this dominionworld- the world where the dominion will be createdcuboid- the 3D area that defines the dominion's boundariesparent- the parent dominion, or null if this is a top-level dominionskipEconomy- whether to skip economy checks and charges for this operation- Returns:
- a future that completes with the created dominion, or
nullif the operation is cancelled or fails
-
resizeDominion
public abstract CompletableFuture<DominionDTO> resizeDominion(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion, @NotNull DominionReSizeEvent.TYPE type, @NotNull DominionReSizeEvent.DIRECTION direction, int size) Resizes an existing dominion by expanding or contracting it in a specified direction.- Parameters:
operator- the command sender performing this operationdominion- the dominion to be resizedtype- the type of resize operation (expand or contract)direction- the direction in which to resize (north, south, east, west, up, down)size- the number of blocks to resize by (positive integer)- Returns:
- a future that completes with the resized dominion, or
nullif the operation is cancelled or fails
-
deleteDominion
public abstract CompletableFuture<DominionDTO> deleteDominion(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion, boolean skipEconomy, boolean force) Deletes a dominion and optionally all of its sub-dominions.- Parameters:
operator- the command sender performing this operationdominion- the dominion to be deletedskipEconomy- whether to skip economy refunds for this operationforce- whether to force deletion even if there are sub-dominions or other dependencies- Returns:
- a future that completes with the deleted dominion, or
nullif the operation is cancelled, denied, or fails
-
deleteDominion
public CompletableFuture<DominionDTO> deleteDominion(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion, boolean skipEconomy) Deletes a dominion with force enabled by default. This is a convenience method that callsdeleteDominion(CommandSender, DominionDTO, boolean, boolean)with force set to true.- Parameters:
operator- the command sender performing this operationdominion- the dominion to be deletedskipEconomy- whether to skip economy refunds for this operation- Returns:
- a future that completes with the deleted dominion, or
nullif the operation is cancelled, denied, or fails
-
renameDominion
public abstract CompletableFuture<DominionDTO> renameDominion(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion, @NotNull @NotNull String newName) Renames an existing dominion to a new name.- Parameters:
operator- the command sender performing this operationdominion- the dominion to be renamednewName- the new name for the dominion (must be unique within the parent scope)- Returns:
- a future that completes with the renamed dominion, or
nullif the operation is cancelled or fails
-
transferDominion
public abstract CompletableFuture<DominionDTO> transferDominion(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion, @NotNull @NotNull PlayerDTO newOwner, boolean force) Transfers ownership of a dominion to a new player.- Parameters:
operator- the command sender performing this operationdominion- the dominion to be transferrednewOwner- the player who will become the new ownerforce- whether to force the transfer even if the new owner doesn't meet requirements- Returns:
- a future that completes with the transferred dominion, or
nullif the operation is cancelled, denied, or fails
-
transferDominion
public CompletableFuture<DominionDTO> transferDominion(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion, @NotNull @NotNull PlayerDTO newOwner) Transfers ownership of a dominion to a new player with force enabled by default. This is a convenience method that callstransferDominion(CommandSender, DominionDTO, PlayerDTO, boolean)with force set to true.- Parameters:
operator- the command sender performing this operationdominion- the dominion to be transferrednewOwner- the player who will become the new owner- Returns:
- a future that completes with the updated dominion, or
nullif the operation is cancelled or fails
-
setDominionTpLocation
public abstract CompletableFuture<DominionDTO> setDominionTpLocation(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion, @NotNull @NotNull org.bukkit.Location newTpLocation) Sets the teleport location for a dominion. This is where players will be teleported when using the dominion teleport feature.- Parameters:
operator- the command sender performing this operationdominion- the dominion whose teleport location will be updatednewTpLocation- the new teleport location within the dominion- Returns:
- a future that completes with the updated dominion, or
nullif the operation is cancelled or fails
-
setDominionMessage
public abstract CompletableFuture<DominionDTO> setDominionMessage(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion, @NotNull DominionSetMessageEvent.TYPE type, @NotNull @NotNull String newMessage) Sets a message for the dominion (enter/leave messages, etc.).- Parameters:
operator- the command sender performing this operationdominion- the dominion whose message will be updatedtype- the type of message to set (enter, leave, etc.)newMessage- the new message text- Returns:
- a future that completes with the updated dominion, or
nullif the operation is cancelled or fails
-
setDominionMapColor
public abstract CompletableFuture<DominionDTO> setDominionMapColor(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion, @NotNull @NotNull org.bukkit.Color newColor) Sets the map display color for the dominion. This affects how the dominion appears on dynmap or other mapping plugins.- Parameters:
operator- the command sender performing this operationdominion- the dominion whose map color will be updatednewColor- the new color for the dominion on maps- Returns:
- a future that completes with the updated dominion, or
nullif the operation is cancelled or fails
-
setDominionEnvFlag
public abstract CompletableFuture<DominionDTO> setDominionEnvFlag(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion, @NotNull @NotNull EnvFlag flag, boolean newValue) Sets an environment flag for the dominion. Environment flags control various world interactions within the dominion (like fire spread, mob spawning, etc.).- Parameters:
operator- the command sender performing this operationdominion- the dominion whose environment flag will be updatedflag- the specific environment flag to modifynewValue- the new value for the flag (true to enable, false to disable)- Returns:
- a future that completes with the updated dominion, or
nullif the operation is cancelled or fails
-
setDominionGuestFlag
public abstract CompletableFuture<DominionDTO> setDominionGuestFlag(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion, @NotNull @NotNull PriFlag flag, boolean newValue) Sets a guest privilege flag for the dominion. Guest flags control what actions non-privileged players can perform within the dominion.- Parameters:
operator- the command sender performing this operationdominion- the dominion whose guest flag will be updatedflag- the specific privilege flag to modifynewValue- the new value for the flag (true to allow, false to deny)- Returns:
- a future that completes with the updated dominion, or
nullif the operation is cancelled or fails
-