Interface PlayerChatEvent
-
- All Superinterfaces:
AudienceMessageEvent
,Cancellable
,Event
,MessageEvent
public interface PlayerChatEvent extends AudienceMessageEvent, Cancellable
Fired when theComponent
being sent to aPlayerChatFormatter
was due to chatting.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Optional<PlayerChatFormatter>
chatFormatter()
Gets the current formatter that this message will be sent through.Component
message()
Gets the chat message.PlayerChatFormatter
originalChatFormatter()
Gets the original formatter that this message will be sent through.Component
originalMessage()
Gets the original chat message.void
setChatFormatter(@Nullable PlayerChatFormatter router)
Sets the formatter for this message to go trough.void
setMessage(Component message)
Sets the chat message.-
Methods inherited from interface org.spongepowered.api.event.message.AudienceMessageEvent
audience, filterAudience, originalAudience, setAudience
-
Methods inherited from interface org.spongepowered.api.event.Cancellable
isCancelled, setCancelled
-
-
-
-
Method Detail
-
originalChatFormatter
PlayerChatFormatter originalChatFormatter()
Gets the original formatter that this message will be sent through.- Returns:
- The original formatter used
-
chatFormatter
java.util.Optional<PlayerChatFormatter> chatFormatter()
Gets the current formatter that this message will be sent through.- Returns:
- The formatter the message in this event will be sent through
-
setChatFormatter
void setChatFormatter(@Nullable PlayerChatFormatter router)
Sets the formatter for this message to go trough.If the target audience is a
ForwardingAudience
thePlayerChatFormatter
will be applied to each of itsForwardingAudience.audiences()
- Parameters:
router
- The router to set
-
originalMessage
Component originalMessage()
Gets the original chat message.This message is the original chat message, without any formatting whatsoever.
In Vanilla, this is equivalent to what a player typed into the chat box (no name prefix or other elements).
- Specified by:
originalMessage
in interfaceMessageEvent
- Returns:
- The original chat message
-
message
Component message()
Gets the chat message.- Specified by:
message
in interfaceMessageEvent
- Returns:
- The chat message
-
setMessage
void setMessage(Component message)
Sets the chat message.- Specified by:
setMessage
in interfaceMessageEvent
- Parameters:
message
- The chat message
-
-