Class GroupRenamedEvent

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

public class GroupRenamedEvent extends ResultEvent
Event triggered when a group is renamed within a dominion.
  • Constructor Details

    • GroupRenamedEvent

      public GroupRenamedEvent(@NotNull @NotNull org.bukkit.command.CommandSender operator, @NotNull @NotNull DominionDTO dominion, @NotNull @NotNull GroupDTO group, @NotNull @NotNull String newName)
      Constructs a new GroupRenamedEvent.
      Parameters:
      operator - the command sender who initiated the event
      dominion - the dominion to which the group belongs
      group - the group being renamed
      newName - the new name of the group
  • Method Details

    • getDominion

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

      @NotNull public @NotNull GroupDTO getGroup()
      Gets the group being renamed.
      Returns:
      the group
    • setGroup

      public void setGroup(@NotNull @NotNull GroupDTO group)
      Sets the group being renamed.
      Parameters:
      group - the group to set
    • setNewName

      public void setNewName(@NotNull @NotNull String newName)
      Sets the new name of the group.
      Parameters:
      newName - the new name to set
    • getNewNameColored

      public String getNewNameColored()
      Gets the new name of the group with color codes.
      Returns:
      the new name of the group with color codes
    • getNewNamePlain

      public String getNewNamePlain()
      Gets the plain text new name of the group without color codes.
      Returns:
      the plain text new name of the group
    • getOldNameColored

      public String getOldNameColored()
      Gets the old name of the group with color codes.
      Returns:
      the old name of the group with color codes
    • getOldNamePlain

      public String getOldNamePlain()
      Gets the plain text old name of the group without color codes.
      Returns:
      the plain text old name of the group
    • getFutureToComplete

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

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

      Returns:
      the CompletableFuture to be completed
    • afterCreated

      public CompletableFuture<Void> afterCreated(Consumer<GroupDTO> consumer)
      Call back after the group is renamed.

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

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