Class MemberAddedEvent

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

public class MemberAddedEvent extends ResultEvent
Event triggered when a member is added to a Dominion.
  • Constructor Details

    • MemberAddedEvent

      public MemberAddedEvent(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion, @NotNull @NotNull PlayerDTO player)
      Constructs a new MemberAddedEvent.
      Parameters:
      operator - the command sender who initiated the event
      dominion - the dominion to which the member is added
      player - the player who is adding the member
  • Method Details

    • setDominion

      public void setDominion(@NotNull @NotNull DominionDTO dominion)
      Sets the dominion.
      Parameters:
      dominion - the dominion to set
    • getDominion

      @NotNull public @NotNull DominionDTO getDominion()
      Gets the dominion.
      Returns:
      the dominion
    • setPlayer

      public void setPlayer(@NotNull @NotNull PlayerDTO player)
      Sets the player.
      Parameters:
      player - the player to set
    • getPlayer

      @NotNull public @NotNull PlayerDTO getPlayer()
      Gets the player.
      Returns:
      the player
    • 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 created (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
    • setMember

      @Deprecated(since="4.6.0", forRemoval=true) public void setMember(@Nullable @Nullable MemberDTO member)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Sets the newly added member.
      Parameters:
      member - the newly added member
    • getMember

      @Deprecated(since="4.6.0", forRemoval=true) @Nullable public @Nullable MemberDTO getMember()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the newly added member. If there is none, returns null. Only has a value if the addition was successful.
      Returns:
      the newly added member, or null if none