Class EndStateChangeEvent

java.lang.Object
org.bukkit.event.Event
net.mathias2246.buildmc.api.event.CustomEvent
net.mathias2246.buildmc.api.event.endevent.EndStateChangeEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class EndStateChangeEvent extends CustomEvent implements org.bukkit.event.Cancellable
Fired when the End state is about to change.

This event is cancellable. Plugins can inspect or modify the changing process, including the announcement key, the cause, and the sender. Listeners can also attach arbitrary metadata to share information across other listeners.

  • Constructor Details

    • EndStateChangeEvent

      public EndStateChangeEvent(@NotNull @NotNull EndState newState, @Nullable @Nullable EndState previousState, @Nullable @Nullable EndChangeCause cause, @Nullable @Nullable org.bukkit.command.CommandSender sender, @NotNull @NotNull String announcementKey)
      Constructs a new EndStateChangeEvent.
      Parameters:
      newState - the new state the End is transitioning to; must not be null
      previousState - the previous state of the End; may be null if there was no prior state
      cause - the reason the End state is changing; defaults to EndChangeCause.OTHER if null
      sender - the CommandSender responsible for the change, or null if not applicable
      announcementKey - the translatable key used for the announcement message
  • Method Details

    • getNewState

      @NotNull public @NotNull EndState getNewState()
      Gets the state that the End is transitioning to.
      Returns:
      the new EndState; never null
    • getPreviousState

      @Nullable public @Nullable EndState getPreviousState()
      Gets the previous state of the End before this event.
      Returns:
      the previous EndState, or null if there was none
    • getCause

      @NotNull public @NotNull EndChangeCause getCause()
      Gets the cause of the End state changing.
      Returns:
      the cause
    • getCommandSender

      @Nullable public @Nullable org.bukkit.command.CommandSender getCommandSender()
      Gets the sender responsible for changing the End state.
      Returns:
      the CommandSender, or null if not applicable
    • getAnnouncementKey

      @NotNull public @NotNull String getAnnouncementKey()
      Gets the translation key for the announcement message.
      Returns:
      the translation key
    • setAnnouncementKey

      public void setAnnouncementKey(@NotNull @NotNull String announcementKey)
      Sets the translation key for the announcement message.
      Parameters:
      announcementKey - the new translation key
    • isCancelled

      public boolean isCancelled()
      Checks whether the event has been cancelled.
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
      Returns:
      true if cancelled, false otherwise
    • setCancelled

      public void setCancelled(boolean cancelled)
      Sets whether the event is cancelled.
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable
      Parameters:
      cancelled - true to cancel the event, false to allow it
    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Description copied from class: CustomEvent
      Returns the HandlerList for this event type.

      Bukkit requires each concrete event class to define its own static HandlerList instance and to return it from this method. This is necessary for Bukkit’s event registration and dispatch system.

      Specified by:
      getHandlers in class CustomEvent
      Returns:
      the handler list for this event (never null)
    • getHandlerList

      public static org.bukkit.event.HandlerList getHandlerList()
      Gets the static list of handlers for this event type. Required by Bukkit for event registration.
      Returns:
      the handler list