Record Class ChatMessageS2CPacket
- Record Components:
signedContent
-unsignedContent
-typeId
-sender
-timestamp
-saltSignature
-
- All Implemented Interfaces:
Packet<ClientPlayPacketListener>
The content is not wrapped in any way (e.g. by chat.type.text
text); the
raw message content is sent to the clients, and they will wrap it. To register
custom wrapping behaviors, check MessageType.register(java.lang.String)
.
Messages that took more than TIME_TO_LIVE
to reach the clients are
considered expired. This is measured from the time the client sent the chat message
to the server. Note that unlike ChatMessageC2SPacket
expired messages are not
discarded by the clients; they instead log a warning.
Chat messages have signatures. It is possible to use a bogus signature - such as
MessageSignature.none()
- to send a chat
message; however if the signature is invalid (e.g. because the text's content differs
from the one sent by the client, or because the passed signature is invalid) the client
will log a warning. See MessageSignature.updateSignature(net.minecraft.network.encryption.SignatureUpdatable.SignatureUpdater, net.minecraft.text.Text, java.util.UUID, java.time.Instant, long)
for how the
message is signed.
- See Also:
-
ServerPlayerEntity.sendChatMessage(net.minecraft.network.message.SignedMessage, net.minecraft.network.message.MessageSender, net.minecraft.util.registry.RegistryKey<net.minecraft.network.message.MessageType>)
ClientPlayNetworkHandler.onChatMessage(net.minecraft.network.packet.s2c.play.ChatMessageS2CPacket)
- Mappings:
Namespace Name official uo
intermediary net/minecraft/class_7438
named net/minecraft/network/packet/s2c/play/ChatMessageS2CPacket
official a
intermediary comp_833
named signedContent
official b
intermediary comp_834
named unsignedContent
official c
intermediary comp_806
named typeId
official d
intermediary comp_760
named sender
official e
intermediary comp_761
named timestamp
official f
intermediary comp_762
named saltSignature
-
Field Summary
Modifier and TypeFieldDescriptionprivate final NetworkEncryptionUtils.SignatureData
The field for thesaltSignature
record component.private final MessageSender
The field for thesender
record component.private final Text
The field for thesignedContent
record component.private static final Duration
private final Instant
The field for thetimestamp
record component.private final int
The field for thetypeId
record component.The field for theunsignedContent
record component. -
Constructor Summary
ConstructorDescriptionChatMessageS2CPacket
(Text text, Optional<Text> optional, int int2, MessageSender messageSender, Instant instant, NetworkEncryptionUtils.SignatureData signatureData) -
Method Summary
Modifier and TypeMethodDescriptionvoid
apply
(ClientPlayPacketListener clientPlayPacketListener) final boolean
Indicates whether some other object is "equal to" this one.private Instant
Returns when the message is considered expired.getMessageType
(Registry<MessageType> registry) Returns the message type of the chat message.final int
hashCode()
Returns a hash code value for this object.boolean
Returns whether the message is considered expired.boolean
Returns whether a throwable in writing of this packet allows the connection to simply skip the packet's sending than disconnecting.Returns the value of thesaltSignature
record component.sender()
Returns the value of thesender
record component.Returns the value of thesignedContent
record component.Returns the value of thetimestamp
record component.final String
toString()
Returns a string representation of this record class.int
typeId()
Returns the value of thetypeId
record component.Returns the value of theunsignedContent
record component.void
write
(PacketByteBuf buf)
-
Field Details
-
signedContent
The field for thesignedContent
record component. -
unsignedContent
The field for theunsignedContent
record component. -
typeId
private final int typeIdThe field for thetypeId
record component. -
sender
The field for thesender
record component. -
timestamp
The field for thetimestamp
record component. -
saltSignature
The field for thesaltSignature
record component. -
TIME_TO_LIVE
- Mappings:
Namespace Name Mixin selector official g
Luo;g:Ljava/time/Duration;
intermediary field_39085
Lnet/minecraft/class_7438;field_39085:Ljava/time/Duration;
named TIME_TO_LIVE
Lnet/minecraft/network/packet/s2c/play/ChatMessageS2CPacket;TIME_TO_LIVE:Ljava/time/Duration;
-
-
Constructor Details
-
ChatMessageS2CPacket
- Mappings:
Namespace Name Mixin selector official <init>
Luo;<init>(Lqx;)V
intermediary <init>
Lnet/minecraft/class_7438;<init>(Lnet/minecraft/class_2540;)V
named <init>
Lnet/minecraft/network/packet/s2c/play/ChatMessageS2CPacket;<init>(Lnet/minecraft/network/PacketByteBuf;)V
-
ChatMessageS2CPacket
public ChatMessageS2CPacket(Text text, Optional<Text> optional, int int2, MessageSender messageSender, Instant instant, NetworkEncryptionUtils.SignatureData signatureData)
-
-
Method Details
-
write
- Specified by:
write
in interfacePacket<ClientPlayPacketListener>
- Mappings:
Namespace Name Mixin selector official a
Lso;a(Lqx;)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
- Specified by:
apply
in interfacePacket<ClientPlayPacketListener>
- Mappings:
Namespace Name Mixin selector official a
Luo;a(Lsr;)V
intermediary method_43629
Lnet/minecraft/class_7438;method_43629(Lnet/minecraft/class_2602;)V
named apply
Lnet/minecraft/network/packet/s2c/play/ChatMessageS2CPacket;apply(Lnet/minecraft/network/listener/ClientPlayPacketListener;)V
-
isWritingErrorSkippable
public boolean isWritingErrorSkippable()Returns whether a throwable in writing of this packet allows the connection to simply skip the packet's sending than disconnecting.- Specified by:
isWritingErrorSkippable
in interfacePacket<ClientPlayPacketListener>
- Mappings:
Namespace Name Mixin selector official a
Lso;a()Z
intermediary method_11051
Lnet/minecraft/class_2596;method_11051()Z
named isWritingErrorSkippable
Lnet/minecraft/network/Packet;isWritingErrorSkippable()Z
-
getSignedMessage
- Mappings:
Namespace Name Mixin selector official b
Luo;b()Lru;
intermediary method_43885
Lnet/minecraft/class_7438;method_43885()Lnet/minecraft/class_7471;
named getSignedMessage
Lnet/minecraft/network/packet/s2c/play/ChatMessageS2CPacket;getSignedMessage()Lnet/minecraft/network/message/SignedMessage;
-
getExpiryTime
Returns when the message is considered expired.- Returns:
- when the message is considered expired
- Mappings:
Namespace Name Mixin selector official i
Luo;i()Ljava/time/Instant;
intermediary method_43630
Lnet/minecraft/class_7438;method_43630()Ljava/time/Instant;
named getExpiryTime
Lnet/minecraft/network/packet/s2c/play/ChatMessageS2CPacket;getExpiryTime()Ljava/time/Instant;
-
isExpired
Returns whether the message is considered expired.- Returns:
- whether the message is considered expired
- Mappings:
Namespace Name Mixin selector official a
Luo;a(Ljava/time/Instant;)Z
intermediary method_43628
Lnet/minecraft/class_7438;method_43628(Ljava/time/Instant;)Z
named isExpired
Lnet/minecraft/network/packet/s2c/play/ChatMessageS2CPacket;isExpired(Ljava/time/Instant;)Z
-
getMessageType
Returns the message type of the chat message.- Returns:
- the message type of the chat message
- Throws:
NullPointerException
- when the type ID is invalid (due to unsynced registry, etc)- Mappings:
Namespace Name Mixin selector official a
Luo;a(Lhm;)Lrj;
intermediary method_43884
Lnet/minecraft/class_7438;method_43884(Lnet/minecraft/class_2378;)Lnet/minecraft/class_2556;
named getMessageType
Lnet/minecraft/network/packet/s2c/play/ChatMessageS2CPacket;getMessageType(Lnet/minecraft/util/registry/Registry;)Lnet/minecraft/network/message/MessageType;
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
signedContent
Returns the value of thesignedContent
record component.- Returns:
- the value of the
signedContent
record component
-
unsignedContent
Returns the value of theunsignedContent
record component.- Returns:
- the value of the
unsignedContent
record component
-
typeId
public int typeId()Returns the value of thetypeId
record component.- Returns:
- the value of the
typeId
record component
-
sender
Returns the value of thesender
record component.- Returns:
- the value of the
sender
record component
-
timestamp
Returns the value of thetimestamp
record component.- Returns:
- the value of the
timestamp
record component
-
saltSignature
Returns the value of thesaltSignature
record component.- Returns:
- the value of the
saltSignature
record component
-