Class ChatMessageC2SPacket
java.lang.Object
net.minecraft.network.packet.c2s.play.ChatMessageC2SPacket
- All Implemented Interfaces:
Packet<ServerPlayPacketListener>
A packet used to send a chat message to the server.
This truncates the message to at most 256 characters before sending to the server on the client. If the server receives the message longer than 256 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 whintermediary net/minecraft/class_2797named net/minecraft/network/packet/c2s/play/ChatMessageC2SPacket
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate static final intprivate final NetworkEncryptionUtils.SignatureDataprivate final Instantstatic final Duration -
Constructor Summary
ConstructorsConstructorDescriptionChatMessageC2SPacket(Instant time, String chatMessage, NetworkEncryptionUtils.SignatureData signature) -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(ServerPlayPacketListener serverPlayPacketListener) private InstantReturns when the message is considered expired and should be discarded.Returns the chat message with spaces normalized.getTime()Returns when the client sent the message to the server.booleanReturns whether the message is considered expired and should be discarded.private static StringtruncateMessage(String message) Returns the message truncated to at most 256 characters.voidwrite(PacketByteBuf buf) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.network.Packet
isWritingErrorSkippable
-
Field Details
-
MAX_LENGTH
private static final int MAX_LENGTH- See Also:
- Mappings:
Namespace Name Mixin selector official bLwh;b:Iintermediary field_33359Lnet/minecraft/class_2797;field_33359:Inamed MAX_LENGTHLnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;MAX_LENGTH:I
-
TIME_TO_LIVE
- Mappings:
Namespace Name Mixin selector official aLwh;a:Ljava/time/Duration;intermediary field_39086Lnet/minecraft/class_2797;field_39086:Ljava/time/Duration;named TIME_TO_LIVELnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;TIME_TO_LIVE:Ljava/time/Duration;
-
time
- Mappings:
Namespace Name Mixin selector official cLwh;c:Ljava/time/Instant;intermediary field_39087Lnet/minecraft/class_2797;field_39087:Ljava/time/Instant;named timeLnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;time:Ljava/time/Instant;
-
chatMessage
- Mappings:
Namespace Name Mixin selector official dLwh;d:Ljava/lang/String;intermediary field_12764Lnet/minecraft/class_2797;field_12764:Ljava/lang/String;named chatMessageLnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;chatMessage:Ljava/lang/String;
-
signature
- Mappings:
Namespace Name Mixin selector official eLwh;e:Lajp$b;intermediary field_39088Lnet/minecraft/class_2797;field_39088:Lnet/minecraft/class_3515$class_7425;named signatureLnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;signature:Lnet/minecraft/network/encryption/NetworkEncryptionUtils$SignatureData;
-
-
Constructor Details
-
ChatMessageC2SPacket
public ChatMessageC2SPacket(Instant time, String chatMessage, NetworkEncryptionUtils.SignatureData signature) - Mappings:
Namespace Name Mixin selector official <init>Lwh;<init>(Ljava/time/Instant;Ljava/lang/String;Lajp$b;)Vintermediary <init>Lnet/minecraft/class_2797;<init>(Ljava/time/Instant;Ljava/lang/String;Lnet/minecraft/class_3515$class_7425;)Vnamed <init>Lnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;<init>(Ljava/time/Instant;Ljava/lang/String;Lnet/minecraft/network/encryption/NetworkEncryptionUtils$SignatureData;)V
-
ChatMessageC2SPacket
- Mappings:
Namespace Name Mixin selector official <init>Lwh;<init>(Lqn;)Vintermediary <init>Lnet/minecraft/class_2797;<init>(Lnet/minecraft/class_2540;)Vnamed <init>Lnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;<init>(Lnet/minecraft/network/PacketByteBuf;)V
-
-
Method Details
-
truncateMessage
Returns the message truncated to at most 256 characters.- Returns:
- the message truncated to at most 256 characters
- Mappings:
Namespace Name Mixin selector official aLwh;a(Ljava/lang/String;)Ljava/lang/String;intermediary method_43632Lnet/minecraft/class_2797;method_43632(Ljava/lang/String;)Ljava/lang/String;named truncateMessageLnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;truncateMessage(Ljava/lang/String;)Ljava/lang/String;
-
write
- Specified by:
writein interfacePacket<ServerPlayPacketListener>- Mappings:
Namespace Name Mixin selector official aLry;a(Lqn;)Vintermediary method_11052Lnet/minecraft/class_2596;method_11052(Lnet/minecraft/class_2540;)Vnamed writeLnet/minecraft/network/Packet;write(Lnet/minecraft/network/PacketByteBuf;)V
-
apply
- Specified by:
applyin interfacePacket<ServerPlayPacketListener>- Mappings:
Namespace Name Mixin selector official aLwh;a(Lwc;)Vintermediary method_12115Lnet/minecraft/class_2797;method_12115(Lnet/minecraft/class_2792;)Vnamed applyLnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;apply(Lnet/minecraft/network/listener/ServerPlayPacketListener;)V
-
getTime
Returns when the client sent the message to the server.- Returns:
- when the client sent the message to the server
- Mappings:
Namespace Name Mixin selector official bLwh;b()Ljava/time/Instant;intermediary method_43634Lnet/minecraft/class_2797;method_43634()Ljava/time/Instant;named getTimeLnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;getTime()Ljava/time/Instant;
-
getChatMessage
- Mappings:
Namespace Name Mixin selector official cLwh;c()Ljava/lang/String;intermediary method_12114Lnet/minecraft/class_2797;method_12114()Ljava/lang/String;named getChatMessageLnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;getChatMessage()Ljava/lang/String;
-
getNormalizedChatMessage
Returns the chat message with spaces normalized.- Returns:
- the chat message with spaces normalized
- Mappings:
Namespace Name Mixin selector official dLwh;d()Ljava/lang/String;intermediary method_43635Lnet/minecraft/class_2797;method_43635()Ljava/lang/String;named getNormalizedChatMessageLnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;getNormalizedChatMessage()Ljava/lang/String;
-
getSignature
- Mappings:
Namespace Name Mixin selector official eLwh;e()Lajp$b;intermediary method_43636Lnet/minecraft/class_2797;method_43636()Lnet/minecraft/class_3515$class_7425;named getSignatureLnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;getSignature()Lnet/minecraft/network/encryption/NetworkEncryptionUtils$SignatureData;
-
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 fLwh;f()Ljava/time/Instant;intermediary method_43637Lnet/minecraft/class_2797;method_43637()Ljava/time/Instant;named getExpiryTimeLnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;getExpiryTime()Ljava/time/Instant;
-
isExpired
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 aLwh;a(Ljava/time/Instant;)Zintermediary method_43633Lnet/minecraft/class_2797;method_43633(Ljava/time/Instant;)Znamed isExpiredLnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;isExpired(Ljava/time/Instant;)Z
-