Class DominionModifyEvent

java.lang.Object
org.bukkit.event.Event
cn.lunadeer.dominion.events.CallableEvent
cn.lunadeer.dominion.events.ResultEvent
cn.lunadeer.dominion.events.dominion.modify.DominionModifyEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable
Direct Known Subclasses:
DominionRenameEvent, DominionReSizeEvent, DominionSetEnvFlagEvent, DominionSetGuestFlagEvent, DominionSetMapColorEvent, DominionSetMessageEvent, DominionSetTpLocationEvent, DominionTransferEvent

public class DominionModifyEvent extends ResultEvent
Event triggered when a Dominion is modified in the Dominion system.
  • Constructor Details

    • DominionModifyEvent

      public DominionModifyEvent(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion)
      Constructs a new DominionModifyEvent.
      Parameters:
      operator - the command sender who initiated the event
      dominion - the dominion being modified
  • Method Details

    • getFutureToComplete

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

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

      Returns:
      the CompletableFuture to be completed
    • afterModified

      public CompletableFuture<Void> afterModified(Consumer<DominionDTO> consumer)
      Call back after the dominion is modified.

      Use this method to perform actions after the dominion has been modified.

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

      @NotNull public @NotNull DominionDTO getDominion()
      Returns the dominion to be modified.

      This method retrieves the dominion that is going to be modified by this event. To get the modified dominion after the event is processed, use the afterModified(Consumer) method to register a callback.

      Returns:
      the dominion
    • setDominion

      public void setDominion(@NotNull @NotNull DominionDTO dominion)
      Sets the dominion to be modified.

      This method can only change which dominion will be modified.

      Parameters:
      dominion - the dominion to set