Class MemberSetFlagEvent

java.lang.Object
org.bukkit.event.Event
cn.lunadeer.dominion.events.CallableEvent
cn.lunadeer.dominion.events.ResultEvent
cn.lunadeer.dominion.events.member.MemberSetFlagEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class MemberSetFlagEvent extends ResultEvent
Event triggered when a member's flag is set in the Dominion system.
  • Constructor Details

    • MemberSetFlagEvent

      public MemberSetFlagEvent(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion, @NotNull @NotNull MemberDTO member, @NotNull @NotNull PriFlag flag, boolean newValue)
      Constructs a new MemberSetFlagEvent.
      Parameters:
      operator - the command sender who initiated the event
      dominion - the dominion to which the member belongs
      member - the member whose flag is being set
      flag - the flag being set
      newValue - the new value of the flag
  • Method Details

    • getDominion

      @NotNull public @NotNull DominionDTO getDominion()
      Gets the dominion to which the group belongs.
      Returns:
      the dominion
    • getFlag

      public PriFlag getFlag()
      Gets the flag being set.
      Returns:
      the flag being set
    • 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
    • getMember

      public MemberDTO getMember()
      Gets the member whose flag is being set.
      Returns:
      the member whose flag is being set
    • getFutureToComplete

      public CompletableFuture<MemberDTO> getFutureToComplete()
      Gets the CompletableFuture that will be completed with the MemberDTO.

      Under most circumstances, you should not need to use this method directly. If you need to perform actions after the member is set, you should use the afterSet(Consumer) method instead.

      Returns:
      the CompletableFuture to be completed
    • afterSet

      public CompletableFuture<Void> afterSet(Consumer<MemberDTO> consumer)
      Call back after the member is set.

      Use this method to perform actions after the member has been set (may fail), if you need to do something with the set member,

      Parameters:
      consumer - the consumer to handle the set member
      Returns:
      a CompletableFuture that completes when the consumer has been executed