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
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result -
Field Summary
Fields inherited from class net.mathias2246.buildmc.api.event.CustomEvent
metadataHolder -
Constructor Summary
ConstructorsConstructorDescriptionEndStateChangeEvent(@NotNull EndState newState, @Nullable EndState previousState, @Nullable EndChangeCause cause, @Nullable org.bukkit.command.CommandSender sender, @NotNull String announcementKey) Constructs a new EndStateChangeEvent. -
Method Summary
Modifier and TypeMethodDescription@NotNull StringGets the translation key for the announcement message.@NotNull EndChangeCausegetCause()Gets the cause of the End state changing.@Nullable org.bukkit.command.CommandSenderGets the sender responsible for changing the End state.static org.bukkit.event.HandlerListGets the static list of handlers for this event type.@NotNull org.bukkit.event.HandlerListReturns theHandlerListfor this event type.@NotNull EndStateGets the state that the End is transitioning to.@Nullable EndStateGets the previous state of the End before this event.booleanChecks whether the event has been cancelled.voidsetAnnouncementKey(@NotNull String announcementKey) Sets the translation key for the announcement message.voidsetCancelled(boolean cancelled) Sets whether the event is cancelled.Methods inherited from class net.mathias2246.buildmc.api.event.CustomEvent
getMetadata, putMetadata, removeMetadataMethods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
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 nullpreviousState- the previous state of the End; may be null if there was no prior statecause- the reason the End state is changing; defaults toEndChangeCause.OTHERif nullsender- the CommandSender responsible for the change, or null if not applicableannouncementKey- the translatable key used for the announcement message
-
-
Method Details
-
getNewState
Gets the state that the End is transitioning to.- Returns:
- the new EndState; never null
-
getPreviousState
Gets the previous state of the End before this event.- Returns:
- the previous EndState, or null if there was none
-
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
Gets the translation key for the announcement message.- Returns:
- the translation key
-
setAnnouncementKey
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:
isCancelledin interfaceorg.bukkit.event.Cancellable- Returns:
- true if cancelled, false otherwise
-
setCancelled
public void setCancelled(boolean cancelled) Sets whether the event is cancelled.- Specified by:
setCancelledin interfaceorg.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:CustomEventReturns theHandlerListfor this event type.Bukkit requires each concrete event class to define its own static
HandlerListinstance and to return it from this method. This is necessary for Bukkitâs event registration and dispatch system.- Specified by:
getHandlersin classCustomEvent- 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
-