Class BroadcastDeliverEvent
java.lang.Object
org.bukkit.event.Event
dev.itsharshxd.zentrix.api.events.ZentrixEvent
dev.itsharshxd.zentrix.api.events.broadcast.BroadcastDeliverEvent
- All Implemented Interfaces:
org.bukkit.event.Cancellable
public final class BroadcastDeliverEvent
extends ZentrixEvent
implements org.bukkit.event.Cancellable
Called just before a broadcast is sent, whether its timer came due or it was triggered through
BroadcastService#triggerBroadcastNow.
Listeners can narrow the audience - getRecipients() allows removing players, never
adding them, so a broadcast cannot leak into a match or lobby it was not meant for - replace the
text, or cancel this delivery. Cancelling does not give the timer back: the broadcast is next due
one interval later, as if it had been sent. Text is in Zentrix's colour format, before formatting.
BroadcastSentEvent follows once it has been sent.
Main thread; only fired while a listener is registered.
- Since:
- 1.8.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumWhere a broadcast comes from and what sent it.Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionBroadcastDeliverEvent(@NotNull String broadcastId, @NotNull BroadcastType type, @NotNull BroadcastDeliverEvent.Origin origin, @NotNull Collection<GameState> states, @NotNull Collection<? extends org.bukkit.entity.Player> recipients, @NotNull List<String> lines, @Nullable String title, @Nullable String subtitle, @Nullable String actionBar) -
Method Summary
Modifier and TypeMethodDescriptionThe text of anBroadcastType.ACTIONBARbroadcast.@NotNull StringThe broadcast's id.static @NotNull org.bukkit.event.HandlerList@NotNull org.bukkit.event.HandlerListGets the handler list for this event.getLines()The chat lines of aBroadcastType.CHATbroadcast; empty for other types.@NotNull BroadcastDeliverEvent.OriginWhere the broadcast comes from and what sent it now.@NotNull Set<org.bukkit.entity.Player> The players it will be sent to.The states whose players it was sent to.The subtitle of aBroadcastType.TITLEbroadcast.getTitle()The title of aBroadcastType.TITLEbroadcast.@NotNull BroadcastTypegetType()How it is shown.booleanvoidsetActionBar(@Nullable String actionBar) Replaces the text of anBroadcastType.ACTIONBARbroadcast;nullfor none.voidsetCancelled(boolean cancelled) voidReplaces the chat lines of aBroadcastType.CHATbroadcast.voidsetSubtitle(@Nullable String subtitle) Replaces the subtitle of aBroadcastType.TITLEbroadcast;nullfor none.voidReplaces the title of aBroadcastType.TITLEbroadcast;nullfor none.Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
BroadcastDeliverEvent
public BroadcastDeliverEvent(@NotNull @NotNull String broadcastId, @NotNull @NotNull BroadcastType type, @NotNull @NotNull BroadcastDeliverEvent.Origin origin, @NotNull @NotNull Collection<GameState> states, @NotNull @NotNull Collection<? extends org.bukkit.entity.Player> recipients, @NotNull @NotNull List<String> lines, @Nullable @Nullable String title, @Nullable @Nullable String subtitle, @Nullable @Nullable String actionBar)
-
-
Method Details
-
getBroadcastId
The broadcast's id. -
getType
How it is shown. -
getOrigin
Where the broadcast comes from and what sent it now. -
getStates
The states whose players it was sent to. -
getRecipients
The players it will be sent to. Remove players to keep it from them; adding is not supported and throwsUnsupportedOperationException. -
getLines
The chat lines of aBroadcastType.CHATbroadcast; empty for other types. -
setLines
Replaces the chat lines of aBroadcastType.CHATbroadcast. -
getTitle
The title of aBroadcastType.TITLEbroadcast. -
setTitle
Replaces the title of aBroadcastType.TITLEbroadcast;nullfor none. -
getSubtitle
The subtitle of aBroadcastType.TITLEbroadcast. -
setSubtitle
Replaces the subtitle of aBroadcastType.TITLEbroadcast;nullfor none. -
getActionBar
The text of anBroadcastType.ACTIONBARbroadcast. -
setActionBar
Replaces the text of anBroadcastType.ACTIONBARbroadcast;nullfor none. -
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceorg.bukkit.event.Cancellable
-
setCancelled
public void setCancelled(boolean cancelled) - Specified by:
setCancelledin interfaceorg.bukkit.event.Cancellable
-
getHandlers
@NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()Description copied from class:ZentrixEventGets the handler list for this event.- Overrides:
getHandlersin classZentrixEvent- Returns:
- The handler list
-
getHandlerList
@NotNull public static @NotNull org.bukkit.event.HandlerList getHandlerList()
-