Class Messenger

java.lang.Object
net.minestom.server.message.Messenger

public final class Messenger extends Object
Utility class to handle client chat settings.
  • Field Details

    • CANNOT_SEND_MESSAGE

      public static final Component 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 player
      message - the message
      position - the position
      uuid - 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 players
      message - the message
      position - the position
      uuid - the UUID of the sender, if any
    • canReceiveMessage

      public static boolean canReceiveMessage(@NotNull @NotNull Player player)
      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

      public static boolean canReceiveCommand(@NotNull @NotNull Player player)
      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

      public static void sendRejectionMessage(@NotNull @NotNull Player player)
      Sends a message to the player informing them we are rejecting their message or command.
      Parameters:
      player - the player