Package org.bukkit.event.server
Class BroadcastMessageEvent
- java.lang.Object
-
- org.bukkit.event.Event
-
- org.bukkit.event.server.ServerEvent
-
- org.bukkit.event.server.BroadcastMessageEvent
-
- All Implemented Interfaces:
Cancellable
public class BroadcastMessageEvent extends ServerEvent implements Cancellable
Event triggered for server broadcast messages such as fromServer.broadcast(String, String). This event behaves similarly toAsyncPlayerChatEventin that it should be async if fired from an async thread. Please see that event for further information.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
-
Constructor Summary
Constructors Constructor Description BroadcastMessageEvent(boolean isAsync, String message, Set<CommandSender> recipients)BroadcastMessageEvent(String message, Set<CommandSender> recipients)Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static HandlerListgetHandlerList()HandlerListgetHandlers()StringgetMessage()Get the message to broadcast.Set<CommandSender>getRecipients()Gets a set of recipients that this chat message will be displayed to.booleanisCancelled()Gets the cancellation state of this event.voidsetCancelled(boolean cancelled)Sets the cancellation state of this event.voidsetMessage(String message)Set the message to broadcast.-
Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
-
-
-
Constructor Detail
-
BroadcastMessageEvent
@Deprecated public BroadcastMessageEvent(@NotNull String message, @NotNull Set<CommandSender> recipients)
Deprecated.
-
BroadcastMessageEvent
public BroadcastMessageEvent(boolean isAsync, @NotNull String message, @NotNull Set<CommandSender> recipients)
-
-
Method Detail
-
getMessage
@NotNull public String getMessage()
Get the message to broadcast.- Returns:
- Message to broadcast
-
setMessage
public void setMessage(@NotNull String message)Set the message to broadcast.- Parameters:
message- New message to broadcast
-
getRecipients
@NotNull public Set<CommandSender> getRecipients()
Gets a set of recipients that this chat message will be displayed to.The set returned is not guaranteed to be mutable and may auto-populate on access. Any listener accessing the returned set should be aware that it may reduce performance for a lazy set implementation.
Listeners should be aware that modifying the list may throw
UnsupportedOperationExceptionif the event caller provides an unmodifiable set.- Returns:
- All CommandSenders who will see this chat message
-
isCancelled
public boolean isCancelled()
Description copied from interface:CancellableGets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins- Specified by:
isCancelledin interfaceCancellable- Returns:
- true if this event is cancelled
-
setCancelled
public void setCancelled(boolean cancelled)
Description copied from interface:CancellableSets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.- Specified by:
setCancelledin interfaceCancellable- Parameters:
cancelled- true if you wish to cancel this event
-
getHandlers
@NotNull public HandlerList getHandlers()
- Specified by:
getHandlersin classEvent
-
getHandlerList
@NotNull public static HandlerList getHandlerList()
-
-