Package net.minestom.server.message
Class Messenger
java.lang.Object
net.minestom.server.message.Messenger
Utility class to handle client chat settings.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Component
The message sent to the client if they send a chat message but it is rejected by the server. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
canReceiveCommand
(@NotNull Player player) Checks if the server should receive commands from a player, given their chat settings.static boolean
canReceiveMessage
(@NotNull Player player) Checks if the server should receive messages from a player, given their chat settings.static @NotNull org.jglrxavpok.hephaistos.nbt.NBTCompound
static void
sendMessage
(@NotNull Collection<Player> players, @NotNull Component message, @NotNull ChatPosition position, @Nullable UUID uuid) Sends a message to some players, respecting their chat settings.static boolean
sendMessage
(@NotNull Player player, @NotNull Component message, @NotNull ChatPosition position, @Nullable UUID uuid) Sends a message to a player, respecting their chat settings.static void
sendRejectionMessage
(@NotNull 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
-
chatRegistry
@NotNull public static @NotNull org.jglrxavpok.hephaistos.nbt.NBTCompound chatRegistry() -
sendMessage
public static boolean sendMessage(@NotNull @NotNull Player player, @NotNull @NotNull Component message, @NotNull @NotNull 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(@NotNull @NotNull Collection<Player> players, @NotNull @NotNull Component message, @NotNull @NotNull 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
-