|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.bukkit.event.Event org.bukkit.event.player.PlayerEvent org.bukkit.event.player.AsyncPlayerChatEvent
public class AsyncPlayerChatEvent
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, but the main thread, and has limited access to the API.
If a player is the direct cause of this event by 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 | |
---|---|
AsyncPlayerChatEvent(boolean async,
Player who,
String message,
Set<Player> players)
|
Method Summary | |
---|---|
String |
getFormat()
Gets the format to use to display this chat message. |
static HandlerList |
getHandlerList()
|
HandlerList |
getHandlers()
|
String |
getMessage()
Gets the message that the player is attempting to send. |
Set<Player> |
getRecipients()
Gets a set of recipients that this chat message will be displayed to. |
boolean |
isCancelled()
Gets the cancellation state of this event. |
void |
setCancelled(boolean cancel)
Sets the cancellation state of this event. |
void |
setFormat(String format)
Sets the format to use to display this chat message. |
void |
setMessage(String message)
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 |
---|
getEventName, isAsynchronous |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AsyncPlayerChatEvent(boolean async, Player who, String message, Set<Player> players)
async
- This changes the event to a synchronous state.who
- the chat sendermessage
- the message sentplayers
- the players to receive the message. This may be a lazy or unmodifiable collection.Method Detail |
---|
public String getMessage()
getFormat()
.
public void setMessage(String message)
getFormat()
.
message
- New message that the player will sendpublic String getFormat()
Player.getDisplayName()
and the second parameter is getMessage()
String.format(String, Object...)
compatible format stringpublic void setFormat(String format) throws IllegalFormatException, NullPointerException
Player.getDisplayName()
and the second parameter is getMessage()
format
- String.format(String, Object...)
compatible format string
IllegalFormatException
- if the underlying API throws the exception
NullPointerException
- if format is nullString.format(String, Object...)
public Set<Player> getRecipients()
UnsupportedOperationException
if the event caller provides an unmodifiable set.
public boolean isCancelled()
Cancellable
isCancelled
in interface Cancellable
public void setCancelled(boolean cancel)
Cancellable
setCancelled
in interface Cancellable
cancel
- true if you wish to cancel this eventpublic HandlerList getHandlers()
getHandlers
in class Event
public static HandlerList getHandlerList()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |