Class ChatEvent
java.lang.Object
org.bukkit.event.Event
net.essentialsx.api.v2.events.chat.ChatEvent
- All Implemented Interfaces:
Cancellable
- Direct Known Subclasses:
GlobalChatEvent
,LocalChatEvent
,LocalChatSpyEvent
This handles common boilerplate for other ChatEvents
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the type of chat this event is fired forGets the format to use to display this chat message.Gets the message that the player is attempting to send.final Player
Returns the player involved in this eventGets a set of recipients that this chat message will be displayed to.boolean
void
setCancelled
(boolean cancel) void
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.Event
getEventName, getHandlers, isAsynchronous
-
Constructor Details
-
ChatEvent
-
-
Method Details
-
getMessage
Gets the message that the player is attempting to send. This message will be used withgetFormat()
.- Returns:
- Message the player is attempting to send
-
setMessage
Sets the message that the player will send. This message will be used withgetFormat()
.- Parameters:
message
- New message that the player will send
-
getFormat
Gets the format to use to display this chat message. When this event finishes execution, the first format parameter is thePlayer.getDisplayName()
and the second parameter isgetMessage()
- Returns:
String.format(String, Object...)
compatible format string
-
setFormat
Sets the format to use to display this chat message. When this event finishes execution, the first format parameter is thePlayer.getDisplayName()
and the second parameter isgetMessage()
- Parameters:
format
-String.format(String, Object...)
compatible format string- Throws:
IllegalFormatException
- if the underlying API throws the exceptionNullPointerException
- if format is null- See Also:
-
getRecipients
Gets a set of recipients that this chat message will be displayed to.- Returns:
- All Players who will see this chat message
-
getPlayer
Returns the player involved in this event- Returns:
- Player who is involved in this event
-
getChatType
Returns the type of chat this event is fired for- Returns:
- Type of chat this event is fired for
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelled
in interfaceCancellable
-
setCancelled
public void setCancelled(boolean cancel) - Specified by:
setCancelled
in interfaceCancellable
-