Class Messenger
java.lang.Object
net.minestom.server.message.Messenger
Utility class to handle client chat settings.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ComponentThe message sent to the client if they send a chat message but it is rejected by the server. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancanReceiveCommand(Player player) Checks if the server should receive commands from a player, given their chat settings.static booleancanReceiveMessage(Player player) Checks if the server should receive messages from a player, given their chat settings.static voidsendMessage(Collection<Player> players, Component message, ChatPosition position, @Nullable UUID uuid) Sends a message to some players, respecting their chat settings.static booleansendMessage(Player player, Component message, ChatPosition position, @Nullable UUID uuid) Sends a message to a player, respecting their chat settings.static voidsendRejectionMessage(Player player) Sends a message to the player informing them we are rejecting their message or command.
-
Field Details
-
CANNOT_SEND_MESSAGE
The message sent to the client if they send a chat message but it is rejected by the server.
-
-
Constructor Details
-
Messenger
public Messenger()
-
-
Method Details
-
sendMessage
public static boolean sendMessage(Player player, Component message, ChatPosition position, @Nullable @Nullable UUID uuid) Sends a message to a player, respecting their chat settings.- Parameters:
player- the playermessage- the messageposition- the positionuuid- the UUID of the sender, if any- Returns:
- if the message was sent
-
sendMessage
public static void sendMessage(Collection<Player> players, Component message, ChatPosition position, @Nullable @Nullable UUID uuid) Sends a message to some players, respecting their chat settings.- Parameters:
players- the playersmessage- the messageposition- the positionuuid- the UUID of the sender, if any
-
canReceiveMessage
Checks if the server should receive messages from a player, given their chat settings.- Parameters:
player- the player- Returns:
- if the server should receive messages from them
-
canReceiveCommand
Checks if the server should receive commands from a player, given their chat settings.- Parameters:
player- the player- Returns:
- if the server should receive commands from them
-
sendRejectionMessage
Sends a message to the player informing them we are rejecting their message or command.- Parameters:
player- the player
-