Interface PlayerChatEvent.Submit
- All Superinterfaces:
Cancellable, Event, MessageEvent, PlayerChatEvent
- Enclosing interface:
PlayerChatEvent
Fired when a message is sent by a player.
Note that a signed message cannot be modified.
-
Nested Class Summary
Nested classes/interfaces inherited from interface PlayerChatEvent
PlayerChatEvent.Decorate, PlayerChatEvent.Submit -
Method Summary
Modifier and TypeMethodDescriptionchatType()Returns the chat type used.filter()Returns the predicate for filtering the players receiving the message if set.booleanisSigned()Returns true whenMessageEvent.originalMessage()is signed and cannot be modified.sender()Returns the component to use as the sender.voidsetChatType(RegistryReference<ChatType> chatType) Sets the chat type.voidsetFilter(Predicate<ServerPlayer> filter) Sets the predicate for filtering the players receiving the message.voidSets the component to use as the sender.voidSets the component to use as the target.target()Returns the component to use as the target.Methods inherited from interface Cancellable
isCancelled, setCancelledMethods inherited from interface MessageEvent
message, originalMessage, setMessageMethods inherited from interface PlayerChatEvent
player
-
Method Details
-
filter
Optional<Predicate<ServerPlayer>> filter()Returns the predicate for filtering the players receiving the message if set.- Returns:
- the predicate
-
setFilter
Sets the predicate for filtering the players receiving the message.- Parameters:
filter- the predicate
-
sender
Component sender()Returns the component to use as the sender. In Vanilla this defaults to the players display name- Returns:
- The sender component
-
setSender
Sets the component to use as the sender.- Parameters:
sender- The sender component
-
target
-
setTarget
Sets the component to use as the target.- Parameters:
target- The target component
-
chatType
-
setChatType
Sets the chat type. To control the full message format use one ofChatTypes.CUSTOM_CHATorChatTypes.CUSTOM_MESSAGETo modify the chat message itself it is recommended to use
PlayerChatEvent.Decorate.- Parameters:
chatType- the chat type to use.
-
isSigned
boolean isSigned()Returns true whenMessageEvent.originalMessage()is signed and cannot be modified.- Returns:
- True when signed
-