Package cn.lunadeer.dominion.providers
Class MemberProvider
java.lang.Object
cn.lunadeer.dominion.providers.MemberProvider
This class provides the API interface for creating, modifying, and managing members within dominions.
All operations are asynchronous and return CompletableFuture objects for non-blocking execution.
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 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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract CompletableFuture<MemberDTO>
addMember
(@NotNull org.bukkit.command.CommandSender operator, @NotNull DominionDTO dominion, @NotNull PlayerDTO player) Adds a new member to the specified dominion.static MemberProvider
Gets the singleton instance of the MemberProvider.abstract CompletableFuture<MemberDTO>
removeMember
(@NotNull org.bukkit.command.CommandSender operator, @NotNull DominionDTO dominion, @NotNull MemberDTO member) Removes an existing member from the specified dominion.abstract CompletableFuture<MemberDTO>
setMemberFlag
(@NotNull org.bukkit.command.CommandSender operator, @NotNull DominionDTO dominion, @NotNull MemberDTO member, @NotNull PriFlag flag, boolean newValue) Sets a privilege flag for a specific member within a dominion.
-
Field Details
-
instance
-
-
Constructor Details
-
MemberProvider
public MemberProvider()
-
-
Method Details
-
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 membermember
- the member whose flag will be updatedflag
- the specific privilege flag to modifynewValue
- the new value for the flag (true to allow, false to deny)- Returns:
- a CompletableFuture that resolves to the updated MemberDTO.
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 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 memberplayer
- the player to be added as a member to the dominion- Returns:
- a CompletableFuture that resolves to the created 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 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 removedmember
- the member to be removed from the dominion- Returns:
- a CompletableFuture that resolves to the removed MemberDTO.
Use
CompletableFuture.get()
to get the result if null meaning the operation failed.
-