Package cn.lunadeer.dominion.providers
Class GroupProvider
java.lang.Object
cn.lunadeer.dominion.providers.GroupProvider
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract CompletableFuture<MemberDTO>
addMember
(@NotNull org.bukkit.command.CommandSender operator, @NotNull DominionDTO dominion, @NotNull GroupDTO group, @NotNull MemberDTO member) Adds a member to the specified group within a dominion.abstract CompletableFuture<GroupDTO>
createGroup
(@NotNull org.bukkit.command.CommandSender operator, @NotNull DominionDTO dominion, @NotNull String groupName) Creates a new group within the specified dominion.abstract CompletableFuture<GroupDTO>
deleteGroup
(@NotNull org.bukkit.command.CommandSender operator, @NotNull DominionDTO dominion, @NotNull GroupDTO group) Deletes an existing group from the specified dominion.static GroupProvider
Gets the singleton instance of the GroupProvider.abstract CompletableFuture<MemberDTO>
removeMember
(@NotNull org.bukkit.command.CommandSender operator, @NotNull DominionDTO dominion, @NotNull GroupDTO group, @NotNull MemberDTO member) Removes a member from the specified group within a dominion.abstract CompletableFuture<GroupDTO>
renameGroup
(@NotNull org.bukkit.command.CommandSender operator, @NotNull DominionDTO dominion, @NotNull GroupDTO group, @NotNull String newName) Renames an existing group within the specified dominion.abstract CompletableFuture<GroupDTO>
setGroupFlag
(@NotNull org.bukkit.command.CommandSender operator, @NotNull DominionDTO dominion, @NotNull GroupDTO group, @NotNull PriFlag flag, boolean newValue) Sets a privilege flag for a specific group within a dominion.
-
Field Details
-
instance
-
-
Constructor Details
-
GroupProvider
public GroupProvider()
-
-
Method Details
-
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 groupgroup
- the group 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 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 createdgroupName
- 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 deletedgroup
- 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 renamedgroup
- the group to be renamednewName
- 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 groupgroup
- the group to which the member will be addedmember
- 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 groupgroup
- the group from which the member will be removedmember
- 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.
-