Class MemberProvider

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

public abstract class MemberProvider extends Object
Provides asynchronous operations for creating, modifying, and managing dominion members.

Members are players who have been granted specific access permissions to a dominion. Each member can have individual privilege flags that determine what actions they can perform within the dominion. Members can also be part of groups, inheriting additional privileges from their group membership.

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 MemberProvider instance
      The provider instance initialized by Dominion.
  • Constructor Details

    • MemberProvider

      public MemberProvider()
  • Method Details

    • getInstance

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

      public abstract CompletableFuture<MemberDTO> setMemberFlag(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion, @NotNull @NotNull MemberDTO member, @NotNull @NotNull PriFlag flag, boolean newValue)
      Sets a privilege flag for a specific member within a dominion. Member flags control what actions this individual member can perform within the dominion, independent of any group memberships.
      Parameters:
      operator - the command sender performing this operation (for permission checks and logging)
      dominion - the dominion containing the member
      member - the member 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 member, 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 PlayerDTO player)
      Adds a new member to the specified dominion. The player will be granted basic access to the dominion and can then be assigned specific privileges or added to groups.
      Parameters:
      operator - the command sender performing this operation (for permission checks and logging)
      dominion - the dominion where the player will be added as a member
      player - the player to be added as a member to the dominion
      Returns:
      a future that completes with the created 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 MemberDTO member)
      Removes an existing member from the specified dominion. The member will lose all individual privileges and group memberships within this dominion. This action is irreversible.
      Parameters:
      operator - the command sender performing this operation (for permission checks and logging)
      dominion - the dominion from which the member will be removed
      member - the member to be removed from the dominion
      Returns:
      a future that completes with the removed member, or null if the operation is cancelled or fails