Class ChatMessageC2SPacket

java.lang.Object
net.minecraft.network.packet.c2s.play.ChatMessageC2SPacket
All Implemented Interfaces:
Packet<ServerPlayPacketListener>

public class ChatMessageC2SPacket extends Object implements Packet<ServerPlayPacketListener>
A packet used to send a chat message to the server.

This truncates the message to at most characters before sending to the server on the client. If the server receives the message longer than characters, it will reject the message and disconnect the client.

If the message contains an invalid character (see isValidChar), the server will reject the message and disconnect the client.

Messages that took more than TIME_TO_LIVE to reach the server are considered expired and will be discarded.

See Also:
Mappings:
Namespace Name
official wr
intermediary net/minecraft/class_2797
named net/minecraft/network/packet/c2s/play/ChatMessageC2SPacket
  • Field Details

    • TIME_TO_LIVE

      public static final Duration TIME_TO_LIVE
      Mappings:
      Namespace Name Mixin selector
      official a Lwr;a:Ljava/time/Duration;
      intermediary field_39086 Lnet/minecraft/class_2797;field_39086:Ljava/time/Duration;
      named TIME_TO_LIVE Lnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;TIME_TO_LIVE:Ljava/time/Duration;
    • chatMessage

      private final String chatMessage
      Mappings:
      Namespace Name Mixin selector
      official b Lwr;b:Ljava/lang/String;
      intermediary field_12764 Lnet/minecraft/class_2797;field_12764:Ljava/lang/String;
      named chatMessage Lnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;chatMessage:Ljava/lang/String;
    • time

      private final Instant time
      Mappings:
      Namespace Name Mixin selector
      official c Lwr;c:Ljava/time/Instant;
      intermediary field_39087 Lnet/minecraft/class_2797;field_39087:Ljava/time/Instant;
      named time Lnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;time:Ljava/time/Instant;
    • signature

      private final NetworkEncryptionUtils.SignatureData signature
      Mappings:
      Namespace Name Mixin selector
      official d Lwr;d:Lakb$b;
      intermediary field_39088 Lnet/minecraft/class_2797;field_39088:Lnet/minecraft/class_3515$class_7425;
      named signature Lnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;signature:Lnet/minecraft/network/encryption/NetworkEncryptionUtils$SignatureData;
  • Constructor Details

    • ChatMessageC2SPacket

      public ChatMessageC2SPacket(String string, class_7469 class_7469)
    • ChatMessageC2SPacket

      public ChatMessageC2SPacket(PacketByteBuf buf)
      Mappings:
      Namespace Name Mixin selector
      official <init> Lwr;<init>(Lqs;)V
      intermediary <init> Lnet/minecraft/class_2797;<init>(Lnet/minecraft/class_2540;)V
      named <init> Lnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;<init>(Lnet/minecraft/network/PacketByteBuf;)V
  • Method Details

    • write

      public void write(PacketByteBuf buf)
      Specified by:
      write in interface Packet<ServerPlayPacketListener>
      Mappings:
      Namespace Name Mixin selector
      official a Lsh;a(Lqs;)V
      intermediary method_11052 Lnet/minecraft/class_2596;method_11052(Lnet/minecraft/class_2540;)V
      named write Lnet/minecraft/network/Packet;write(Lnet/minecraft/network/PacketByteBuf;)V
    • apply

      public void apply(ServerPlayPacketListener serverPlayPacketListener)
      Specified by:
      apply in interface Packet<ServerPlayPacketListener>
      Mappings:
      Namespace Name Mixin selector
      official a Lwr;a(Lwl;)V
      intermediary method_12115 Lnet/minecraft/class_2797;method_12115(Lnet/minecraft/class_2792;)V
      named apply Lnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;apply(Lnet/minecraft/network/listener/ServerPlayPacketListener;)V
    • getChatMessage

      public String getChatMessage()
      Mappings:
      Namespace Name Mixin selector
      official b Lwr;b()Ljava/lang/String;
      intermediary method_12114 Lnet/minecraft/class_2797;method_12114()Ljava/lang/String;
      named getChatMessage Lnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;getChatMessage()Ljava/lang/String;
    • method_43899

      public class_7469 method_43899(UUID uUID)
      Mappings:
      Namespace Name Mixin selector
      official a Lwr;a(Ljava/util/UUID;)Lrk;
      intermediary method_43899 Lnet/minecraft/class_2797;method_43899(Ljava/util/UUID;)Lnet/minecraft/class_7469;
      named method_43899 Lnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;method_43899(Ljava/util/UUID;)Lnet/minecraft/class_7469;
    • getExpiryTime

      private Instant getExpiryTime()
      Returns when the message is considered expired and should be discarded.
      Returns:
      when the message is considered expired and should be discarded
      Mappings:
      Namespace Name Mixin selector
      official c Lwr;c()Ljava/time/Instant;
      intermediary method_43637 Lnet/minecraft/class_2797;method_43637()Ljava/time/Instant;
      named getExpiryTime Lnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;getExpiryTime()Ljava/time/Instant;
    • isExpired

      public boolean isExpired(Instant currentTime)
      Returns whether the message is considered expired and should be discarded.
      Returns:
      whether the message is considered expired and should be discarded
      Mappings:
      Namespace Name Mixin selector
      official a Lwr;a(Ljava/time/Instant;)Z
      intermediary method_43633 Lnet/minecraft/class_2797;method_43633(Ljava/time/Instant;)Z
      named isExpired Lnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;isExpired(Ljava/time/Instant;)Z