Class Messenger

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

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

    Fields
    Modifier and Type
    Field
    Description
    static final net.kyori.adventure.text.Component
    The message sent to the client if they send a chat message but it is rejected by the server.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static 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 net.kyori.adventure.text.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 net.kyori.adventure.text.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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CANNOT_SEND_MESSAGE

      public static final net.kyori.adventure.text.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 net.kyori.adventure.text.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 net.kyori.adventure.text.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