Class GroupProvider

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

public abstract class GroupProvider extends Object
Provides asynchronous operations for creating, modifying, and managing groups within dominions.

Groups allow dominion owners to organize players with similar permissions and manage their access to the dominion collectively. Each group can have its own set of privilege flags that determine what actions group members can perform within the dominion.

These methods are controlled by the Dominion system, including permission, validation, cache, and event processing. A returned future normally completes with the updated DTO and completes with null when the operation is cancelled or 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 Details

    • instance

      protected static GroupProvider instance
      The provider instance initialized by Dominion.
  • Constructor Details

    • GroupProvider

      public GroupProvider()
  • Method Details

    • getInstance

      public static GroupProvider getInstance()
      Gets the singleton instance of the GroupProvider.
      Returns:
      the current GroupProvider instance, or null if not initialized
    • setGroupFlag

      public abstract CompletableFuture<GroupDTO> setGroupFlag(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion, @NotNull @NotNull GroupDTO group, @NotNull @NotNull PriFlag flag, boolean newValue)
      Sets a privilege flag for a specific group within a dominion. Group flags control what actions members of this group can perform within the dominion.
      Parameters:
      operator - the command sender performing this operation (for permission checks and logging)
      dominion - the dominion containing the group
      group - the group whose 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 future that completes with the updated group, or null if the operation is cancelled or fails
    • createGroup

      public abstract CompletableFuture<GroupDTO> createGroup(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion, @NotNull @NotNull String groupName)
      Creates a new group within the specified dominion.
      Parameters:
      operator - the command sender performing this operation (for permission checks and logging)
      dominion - the dominion where the group will be created
      groupName - the name of the new group (must be unique within the dominion)
      Returns:
      a future that completes with the created group, or null if the operation is cancelled or fails
    • deleteGroup

      public abstract CompletableFuture<GroupDTO> deleteGroup(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion, @NotNull @NotNull GroupDTO group)
      Deletes an existing group from the specified dominion. All members will be removed from the group when it is deleted.
      Parameters:
      operator - the command sender performing this operation (for permission checks and logging)
      dominion - the dominion containing the group to be deleted
      group - the group to be deleted
      Returns:
      a future that completes with the deleted group, or null if the operation is cancelled or fails
    • renameGroup

      public abstract CompletableFuture<GroupDTO> renameGroup(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion, @NotNull @NotNull GroupDTO group, @NotNull @NotNull String newName)
      Renames an existing group within the specified dominion.
      Parameters:
      operator - the command sender performing this operation (for permission checks and logging)
      dominion - the dominion containing the group to be renamed
      group - the group to be renamed
      newName - the new name for the group (must be unique within the dominion)
      Returns:
      a future that completes with the renamed group, or null if the operation is cancelled or fails
    • addMember

      public abstract CompletableFuture<MemberDTO> addMember(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion, @NotNull @NotNull GroupDTO group, @NotNull @NotNull MemberDTO member)
      Adds a member to the specified group within a dominion. The member will inherit all privileges assigned to the group.
      Parameters:
      operator - the command sender performing this operation (for permission checks and logging)
      dominion - the dominion containing the group
      group - the group to which the member will be added
      member - the member to be added to the group
      Returns:
      a future that completes with the updated member, or null if the operation is cancelled or fails
    • removeMember

      public abstract CompletableFuture<MemberDTO> removeMember(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion, @NotNull @NotNull GroupDTO group, @NotNull @NotNull MemberDTO member)
      Removes a member from the specified group within a dominion. The member will lose all privileges that were granted through group membership, but may retain individual member privileges if any were assigned directly.
      Parameters:
      operator - the command sender performing this operation (for permission checks and logging)
      dominion - the dominion containing the group
      group - the group from which the member will be removed
      member - the member to be removed from the group
      Returns:
      a future that completes with the updated member, or null if the operation is cancelled or fails