Interface ServerMessageEvents.AllowChatMessage
- Enclosing class:
ServerMessageEvents
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanallowChatMessage(net.minecraft.network.chat.PlayerChatMessage message, net.minecraft.server.level.ServerPlayer sender, net.minecraft.network.chat.ChatType.Bound boundChatType) Called when the server broadcasts a chat message sent by a player, typically from a client GUI or a player-executed command.
-
Method Details
-
allowChatMessage
boolean allowChatMessage(net.minecraft.network.chat.PlayerChatMessage message, net.minecraft.server.level.ServerPlayer sender, net.minecraft.network.chat.ChatType.Bound boundChatType) Called when the server broadcasts a chat message sent by a player, typically from a client GUI or a player-executed command. Returningfalseprevents the message from being broadcast and theServerMessageEvents.CHAT_MESSAGEevent from triggering.If the message is from a player-executed command, this will be called only if
ServerMessageEvents.ALLOW_COMMAND_MESSAGEevent did not block the message, and after triggeringServerMessageEvents.COMMAND_MESSAGEevent.- Parameters:
message- the broadcast message with chat decorators applied; usemessage.decoratedContent()to get the componentsender- the player that sent the messageboundChatType- theChatType.Bound- Returns:
trueif the message should be broadcast, otherwisefalse
-