Class DominionProvider

java.lang.Object
cn.lunadeer.dominion.providers.DominionProvider

public abstract class DominionProvider extends Object
This class provides the API interface for creating, modifying, and managing dominions. All operations are asynchronous and return CompletableFuture objects for non-blocking execution.

These methods are controlled by the Dominion system so they are safe to use in any context.

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 Details

  • Constructor Details

    • DominionProvider

      public DominionProvider()
  • Method Details

    • getInstance

      public static DominionProvider getInstance()
      Gets the singleton instance of the DominionProvider.
      Returns:
      the current DominionProvider instance, or null if 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 dominion
      world - the world where the dominion will be created
      cuboid - the 3D area that defines the dominion's boundaries
      parent - the parent dominion, or null if this is a top-level dominion
      skipEconomy - whether to skip economy checks and charges for this operation
      Returns:
      a CompletableFuture that resolves to the created DominionDTO. Use CompletableFuture.get() to get the result if null meaning the operation failed.
    • 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 operation
      dominion - the dominion to be resized
      type - 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 CompletableFuture that resolves to the updated DominionDTO. Use CompletableFuture.get() to get the result if null meaning the operation failed.
    • 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 operation
      dominion - the dominion to be deleted
      skipEconomy - whether to skip economy refunds for this operation
      force - whether to force deletion even if there are sub-dominions or other dependencies
      Returns:
      a CompletableFuture that resolves to the deleted DominionDTO. Use CompletableFuture.get() to get the result if null meaning the operation failed.
    • 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 calls deleteDominion(CommandSender, DominionDTO, boolean, boolean) with force set to true.
      Parameters:
      operator - the command sender performing this operation
      dominion - the dominion to be deleted
      skipEconomy - whether to skip economy refunds for this operation
      Returns:
      a CompletableFuture that resolves to the deleted DominionDTO. Use CompletableFuture.get() to get the result if null meaning the operation failed.
    • 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 operation
      dominion - the dominion to be renamed
      newName - the new name for the dominion (must be unique within the parent scope)
      Returns:
      a CompletableFuture that resolves to the updated DominionDTO. Use CompletableFuture.get() to get the result if null meaning the operation failed.
    • 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 operation
      dominion - the dominion to be transferred
      newOwner - the player who will become the new owner
      force - whether to force the transfer even if the new owner doesn't meet requirements
      Returns:
      a CompletableFuture that resolves to the updated DominionDTO. Use CompletableFuture.get() to get the result if null meaning the operation failed.
    • 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 calls transferDominion(CommandSender, DominionDTO, PlayerDTO, boolean) with force set to true.
      Parameters:
      operator - the command sender performing this operation
      dominion - the dominion to be transferred
      newOwner - the player who will become the new owner
      Returns:
      a CompletableFuture that resolves to the updated DominionDTO. Use CompletableFuture.get() to get the result if null meaning the operation failed.
    • 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 operation
      dominion - the dominion whose teleport location will be updated
      newTpLocation - the new teleport location within the dominion
      Returns:
      a CompletableFuture that resolves to the updated DominionDTO. Use CompletableFuture.get() to get the result if null meaning the operation failed.
    • 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 operation
      dominion - the dominion whose message will be updated
      type - the type of message to set (enter, leave, etc.)
      newMessage - the new message text
      Returns:
      a CompletableFuture that resolves to the updated DominionDTO. Use CompletableFuture.get() to get the result if null meaning the operation failed.
    • 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 operation
      dominion - the dominion whose map color will be updated
      newColor - the new color for the dominion on maps
      Returns:
      a CompletableFuture that resolves to the updated DominionDTO. Use CompletableFuture.get() to get the result if null meaning the operation failed.
    • 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 operation
      dominion - the dominion whose environment flag will be updated
      flag - the specific environment flag to modify
      newValue - the new value for the flag (true to enable, false to disable)
      Returns:
      a CompletableFuture that resolves to the updated DominionDTO. Use CompletableFuture.get() to get the result if null meaning the operation failed.
    • 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 operation
      dominion - the dominion whose guest flag will be updated
      flag - the specific privilege flag to modify
      newValue - the new value for the flag (true to allow, false to deny)
      Returns:
      a CompletableFuture that resolves to the updated DominionDTO. Use CompletableFuture.get() to get the result if null meaning the operation failed.