Interface ServerMessageEvents.AllowCommandMessage
- 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 TypeMethodDescriptionboolean
allowCommandMessage
(SignedMessage message, ServerCommandSource source, MessageType.Parameters params) Called when the server broadcasts a command message to all players, such as one from/me
and/say
(but not ones that specify the recipients like/msg
).
-
Method Details
-
allowCommandMessage
boolean allowCommandMessage(SignedMessage message, ServerCommandSource source, MessageType.Parameters params) Called when the server broadcasts a command message to all players, such as one from/me
and/say
(but not ones that specify the recipients like/msg
). Returningfalse
prevents the message body from being broadcast and theServerMessageEvents.COMMAND_MESSAGE
event from triggering. However, the header (which includes the sender profile) will always be sent.If the command is executed by a player and the message body is not blocked,
ServerMessageEvents.ALLOW_CHAT_MESSAGE
andServerMessageEvents.CHAT_MESSAGE
events will also be triggered after triggeringServerMessageEvents.COMMAND_MESSAGE
.- Parameters:
message
- the broadcast message with message decorators applied if applicable; usemessage.getContent()
to get the textsource
- the command source that sent the messageparams
- theMessageType.Parameters
- Returns:
true
if the message body should be broadcast, otherwisefalse
-