Class GroupAddMemberEvent

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

public class GroupAddMemberEvent extends ResultEvent
Event triggered when a member is added to a group within a dominion.
  • Constructor Details

    • GroupAddMemberEvent

      public GroupAddMemberEvent(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion, @NotNull @NotNull GroupDTO group, @NotNull @NotNull MemberDTO member)
      Constructs a new GroupAddMemberEvent.
      Parameters:
      operator - the command sender who initiated the event
      dominion - the dominion to which the group belongs
      group - the group to which the member is being added
      member - the member being added to the group
  • Method Details

    • getGroup

      @NotNull public @NotNull GroupDTO getGroup()
      Gets the group to which the member is being added.
      Returns:
      the group
    • getMember

      @NotNull public @NotNull MemberDTO getMember()
      Gets the member being added to the group.

      This method returns the member that will be added to the group. If you want to get the member after it has been added (which may fail), you should use the afterAdded(Consumer) method instead.

      Returns:
      the member
    • setMember

      public void setMember(@NotNull @NotNull MemberDTO member)
      Sets the member being added to the group.
      Parameters:
      member - the member to set
    • getDominion

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

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

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

      Returns:
      the CompletableFuture to be completed
    • afterAdded

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

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

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