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 from `Server.broadcast(String, String)`. This event behaves similarly to `AsyncPlayerChatEvent` in 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, @NotNull String message, @NotNull Set<CommandSender> recipients)`
Deprecated.
`BroadcastMessageEvent(boolean isAsync, Component message, @NotNull Set<CommandSender> recipients)`
`BroadcastMessageEvent(@NotNull String message, @NotNull Set<CommandSender> recipients)`
Deprecated.
`BroadcastMessageEvent(Component message, @NotNull Set<CommandSender> recipients)`
Deprecated.

## Method Summary

Modifier and Type
Method
Description
`static @NotNull HandlerList`
`getHandlerList()`
`@NotNull HandlerList`
`getHandlers()`
`@NotNull String`
`getMessage()`
Deprecated.
in favour of `message()`
`@NotNull Set<CommandSender>`
`getRecipients()`
Gets a set of recipients that this chat message will be displayed to.
`boolean`
`isCancelled()`
Gets the cancellation state of this event.
`Component`
`message()`
Get the broadcast message.
`void`
`message(Component message)`
Set the broadcast message.
`void`
`setCancelled(boolean cancelled)`
Sets the cancellation state of this event.
`void`
`setMessage(@NotNull String message)`
Deprecated.
in favour of `message(net.kyori.adventure.text.Component)`

### Methods inherited from class org.bukkit.event.Event

`callEvent, getEventName, isAsynchronous`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### BroadcastMessageEvent

@Deprecated public BroadcastMessageEvent(@NotNull @NotNull String message, @NotNull @NotNull Set<CommandSender> recipients)
Deprecated.

### BroadcastMessageEvent

@Deprecated public BroadcastMessageEvent(boolean isAsync, @NotNull @NotNull String message, @NotNull @NotNull Set<CommandSender> recipients)
Deprecated.

### BroadcastMessageEvent

@Deprecated public BroadcastMessageEvent(@NotNull Component message, @NotNull @NotNull Set<CommandSender> recipients)
Deprecated.

### BroadcastMessageEvent

public BroadcastMessageEvent(boolean isAsync, @NotNull Component message, @NotNull @NotNull Set<CommandSender> recipients)

## Method Details

### message

@NotNull public Component message()
Get the broadcast message.

Returns:
  Message to broadcast

### message

public void message(@NotNull Component message)
Set the broadcast message.

Parameters:
  `message` - New message to broadcast

### getMessage

@NotNull @Deprecated public @NotNull String getMessage()
Deprecated.
in favour of `message()`
Get the message to broadcast.

Returns:
  Message to broadcast

### setMessage

@Deprecated public void setMessage(@NotNull @NotNull String message)
Deprecated.
in favour of `message(net.kyori.adventure.text.Component)`
Set the message to broadcast.

Parameters:
  `message` - New message to broadcast

### getRecipients

@NotNull public @NotNull 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 `UnsupportedOperationException` if the event caller provides an unmodifiable set.

Returns:
  All CommandSenders who will see this chat message

### isCancelled

public boolean isCancelled()
Description copied from interface: `Cancellable`
Gets 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:
  `isCancelled` in interface `Cancellable`
Returns:
  true if this event is cancelled

### setCancelled

public void setCancelled(boolean cancelled)
Description copied from interface: `Cancellable`
Sets 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:
  `setCancelled` in interface `Cancellable`
Parameters:
  `cancelled` - true if you wish to cancel this event

### getHandlers

@NotNull public @NotNull HandlerList getHandlers()

Specified by:
  `getHandlers` in class `Event`

### getHandlerList

@NotNull public static @NotNull HandlerList getHandlerList()