Class GroupSetFlagEvent
java.lang.Object
org.bukkit.event.Event
cn.lunadeer.dominion.events.CallableEvent
cn.lunadeer.dominion.events.ResultEvent
cn.lunadeer.dominion.events.group.GroupSetFlagEvent
- All Implemented Interfaces:
org.bukkit.event.Cancellable
Event triggered when a group's privilege flag is changed.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionGroupSetFlagEvent(@NotNull org.bukkit.command.CommandSender operator, @NotNull DominionDTO dominion, @NotNull GroupDTO group, @NotNull PriFlag flag, boolean newValue) Constructs a new GroupSetFlagEvent. -
Method Summary
Modifier and TypeMethodDescriptionRegisters a callback to run after the group flag is set.@NotNull DominionDTOGets the dominion to which the group belongs.getFlag()Gets the flag being set.Gets the CompletableFuture that will be completed with the GroupDTO.getGroup()Gets the group for which the flag is being set.booleanGets the new value of the flag.booleanGets the old value of the flag.voidsetNewValue(boolean newValue) Sets the new value of the flag.Methods inherited from class cn.lunadeer.dominion.events.ResultEvent
getOperator, isCancelled, setCancelledMethods inherited from class cn.lunadeer.dominion.events.CallableEvent
call, getHandlerList, getHandlersMethods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
GroupSetFlagEvent
public GroupSetFlagEvent(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion, @NotNull @NotNull GroupDTO group, @NotNull @NotNull PriFlag flag, boolean newValue) Constructs a new GroupSetFlagEvent.- Parameters:
operator- the command sender who initiated the eventdominion- the dominion to which the group belongsgroup- the group for which the flag is being setflag- the flag being setnewValue- the new value of the flag
-
-
Method Details
-
getDominion
Gets the dominion to which the group belongs.- Returns:
- the dominion
-
getFlag
Gets the flag being set.- Returns:
- the flag
-
getOldValue
public boolean getOldValue()Gets the old value of the flag.- Returns:
- the old value of the flag
-
getNewValue
public boolean getNewValue()Gets the new value of the flag.- Returns:
- the new value of the flag
-
setNewValue
public void setNewValue(boolean newValue) Sets the new value of the flag.- Parameters:
newValue- the new value to set
-
getGroup
Gets the group for which the flag is being set.- Returns:
- the group
-
getFutureToComplete
Gets the CompletableFuture that will be completed with the GroupDTO.Under most circumstances, you should not need to use this method directly. If you need to perform actions after the group is set, you should use the
afterSet(Consumer)method instead.- Returns:
- the future; its result is the modified group, or
nullwhen the operation fails
-
afterSet
Registers a callback to run after the group flag is set.The callback receives the updated group, or
nullwhen the operation fails.- Parameters:
consumer- the consumer to handle the set group- Returns:
- a future that completes when the consumer has been executed
-