Class GroupProvider

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

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

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 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

    • 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 CompletableFuture that resolves to the updated GroupDTO. Use CompletableFuture.get() to get the result if null meaning the operation failed.
    • 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 CompletableFuture that resolves to the created GroupDTO. Use CompletableFuture.get() to get the result if null meaning the operation failed.
    • 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 CompletableFuture that resolves to the deleted GroupDTO. Use CompletableFuture.get() to get the result if null meaning the operation failed.
    • 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 CompletableFuture that resolves to the updated GroupDTO. Use CompletableFuture.get() to get the result if null meaning the operation failed.
    • 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 CompletableFuture that resolves to the updated MemberDTO. Use CompletableFuture.get() to get the result if null meaning the operation failed.
    • 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 CompletableFuture that resolves to the updated MemberDTO. Use CompletableFuture.get() to get the result if null meaning the operation failed.