Package org.bukkit.event.player

# Class AsyncPlayerChatEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
org.bukkit.event.player.AsyncPlayerChatEvent

All Implemented Interfaces:
  `Cancellable`

Direct Known Subclasses:
  `AsyncPlayerChatPreviewEvent`

@Deprecated public class AsyncPlayerChatEvent extends PlayerEvent implements Cancellable
Deprecated.
use `AsyncChatEvent` instead
This event will sometimes fire synchronously, depending on how it was triggered.

The constructor provides a boolean to indicate if the event was fired synchronously or asynchronously. When asynchronous, this event can be called from any thread, sans the main thread, and has limited access to the API.

If a player is the direct cause of this event by an incoming packet, this event will be asynchronous. If a plugin triggers this event by compelling a player to chat, this event will be synchronous.

Care should be taken to check `Event.isAsynchronous()` and treat the event appropriately.

## Nested Class Summary

## Nested classes/interfaces inherited from class org.bukkit.event.Event

`Event.Result`

## Field Summary

### Fields inherited from class org.bukkit.event.player.PlayerEvent

`player`

## Constructor Summary

Constructors
Constructor
Description
`AsyncPlayerChatEvent(boolean async, @NotNull Player who, @NotNull String message, @NotNull Set<Player> players)`
Deprecated.

## Method Summary

Modifier and Type
Method
Description
`@NotNull String`
`getFormat()`
Deprecated.
Gets the format to use to display this chat message.
`static @NotNull HandlerList`
`getHandlerList()`
Deprecated.
`@NotNull HandlerList`
`getHandlers()`
Deprecated.
`@NotNull String`
`getMessage()`
Deprecated.
Gets the message that the player is attempting to send.
`@NotNull Set<Player>`
`getRecipients()`
Deprecated.
Gets a set of recipients that this chat message will be displayed to.
`boolean`
`isCancelled()`
Deprecated.
Gets the cancellation state of this event.
`void`
`setCancelled(boolean cancel)`
Deprecated.
Sets the cancellation state of this event.
`void`
`setFormat(@NotNull String format)`
Deprecated.
Sets the format to use to display this chat message.
`void`
`setMessage(@NotNull String message)`
Deprecated.
Sets the message that the player will send.

### Methods inherited from class org.bukkit.event.player.PlayerEvent

`getPlayer`

### 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

### AsyncPlayerChatEvent

public AsyncPlayerChatEvent(boolean async, @NotNull @NotNull Player who, @NotNull @NotNull String message, @NotNull @NotNull Set<Player> players)
Deprecated.

Parameters:
  `async` - This changes the event to a synchronous state.
  `who` - the chat sender
  `message` - the message sent
  `players` - the players to receive the message. This may be a lazy or unmodifiable collection.

## Method Details

### getMessage

@NotNull public @NotNull String getMessage()
Deprecated.
Gets the message that the player is attempting to send. This message will be used with `getFormat()`.

Returns:
  Message the player is attempting to send

### setMessage

public void setMessage(@NotNull @NotNull String message)
Deprecated.
Sets the message that the player will send. This message will be used with `getFormat()`.

Parameters:
  `message` - New message that the player will send

### getFormat

@NotNull public @NotNull String getFormat()
Deprecated.
Gets the format to use to display this chat message.

When this event finishes execution, the first format parameter is the `Player.getDisplayName()` and the second parameter is `getMessage()`

Returns:
  `String.format(String, Object...)` compatible format string

### setFormat

public void setFormat(@NotNull @NotNull String format) throws IllegalFormatException, NullPointerException
Deprecated.
Sets the format to use to display this chat message.

When this event finishes execution, the first format parameter is the `Player.getDisplayName()` and the second parameter is `getMessage()`

Parameters:
  `format` - `String.format(String, Object...)` compatible format string
Throws:
  `IllegalFormatException` - if the underlying API throws the exception
  `NullPointerException` - if format is null
See Also:
  - `String.format(String, Object...)`

### getRecipients

@NotNull public @NotNull Set<Player> getRecipients()
Deprecated.
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 Players who will see this chat message

### isCancelled

public boolean isCancelled()
Deprecated.
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 cancel)
Deprecated.
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:
  `cancel` - true if you wish to cancel this event

### getHandlers

@NotNull public @NotNull HandlerList getHandlers()
Deprecated.

Specified by:
  `getHandlers` in class `Event`

### getHandlerList

@NotNull public static @NotNull HandlerList getHandlerList()
Deprecated.