Record Class SignedChatMessage

java.lang.Object
java.lang.Record
net.minecraft.network.encryption.SignedChatMessage
Record Components:
signedContent -
signature -
unsignedContent -

public record SignedChatMessage(Text signedContent, ChatMessageSignature signature, Optional<Text> unsignedContent) extends Record
A signed chat message, consisting of the signature, the signed content, and the optional unsigned content supplied when the chat decorator produced unsigned message due to the chat preview being disabled on either side.

Note that the signature itself might not be valid.

Mappings:
Namespace Name
official ru
intermediary net/minecraft/class_7471
named net/minecraft/network/encryption/SignedChatMessage
official a
intermediary comp_804
named signedContent
official b
intermediary comp_805
named signature
official c
intermediary comp_830
named unsignedContent
  • Field Details

  • Constructor Details

  • Method Details

    • of

      public static SignedChatMessage of(Text signedContent, ChatMessageSignature signature)
      Returns a new signed chat message with signedContent and signature.
      Returns:
      a new signed chat message with signedContent and signature
      Mappings:
      Namespace Name Mixin selector
      official a Lru;a(Lrm;Lrr;)Lru;
      intermediary method_44128 Lnet/minecraft/class_7471;method_44128(Lnet/minecraft/class_2561;Lnet/minecraft/class_7469;)Lnet/minecraft/class_7471;
      named of Lnet/minecraft/network/encryption/SignedChatMessage;of(Lnet/minecraft/text/Text;Lnet/minecraft/network/encryption/ChatMessageSignature;)Lnet/minecraft/network/encryption/SignedChatMessage;
    • of

      public static SignedChatMessage of(String signedContent, ChatMessageSignature signature)
      Returns a new signed chat message with signedContent and signature.
      Returns:
      a new signed chat message with signedContent and signature
      Mappings:
      Namespace Name Mixin selector
      official a Lru;a(Ljava/lang/String;Lrr;)Lru;
      intermediary method_44126 Lnet/minecraft/class_7471;method_44126(Ljava/lang/String;Lnet/minecraft/class_7469;)Lnet/minecraft/class_7471;
      named of Lnet/minecraft/network/encryption/SignedChatMessage;of(Ljava/lang/String;Lnet/minecraft/network/encryption/ChatMessageSignature;)Lnet/minecraft/network/encryption/SignedChatMessage;
    • of

      public static SignedChatMessage of(Text originalContent, Text decoratedContent, ChatMessageSignature signature, boolean previewed)
      Returns a new signed chat message from the content supplied by the chat decorator.
      Returns:
      a new signed chat message from the content supplied by the chat decorator
      Implementation Note:
      If the decorated content is different from the original and is not previewed, this will create a signed chat message with the signed original content and the unsigned decorated content. Otherwise, this will create a signed chat message with the signed decorated content.
      Mappings:
      Namespace Name Mixin selector
      official a Lru;a(Lrm;Lrm;Lrr;Z)Lru;
      intermediary method_44313 Lnet/minecraft/class_7471;method_44313(Lnet/minecraft/class_2561;Lnet/minecraft/class_2561;Lnet/minecraft/class_7469;Z)Lnet/minecraft/class_7471;
      named of Lnet/minecraft/network/encryption/SignedChatMessage;of(Lnet/minecraft/text/Text;Lnet/minecraft/text/Text;Lnet/minecraft/network/encryption/ChatMessageSignature;Z)Lnet/minecraft/network/encryption/SignedChatMessage;
    • toSignedMessage

      public static FilteredMessage<SignedChatMessage> toSignedMessage(FilteredMessage<Text> original, FilteredMessage<Text> decorated, ChatMessageSignature signature, boolean preview)
      Mappings:
      Namespace Name Mixin selector
      official a Lru;a(Lagd;Lagd;Lrr;Z)Lagd;
      intermediary method_44311 Lnet/minecraft/class_7471;method_44311(Lnet/minecraft/class_5837;Lnet/minecraft/class_5837;Lnet/minecraft/class_7469;Z)Lnet/minecraft/class_5837;
      named toSignedMessage Lnet/minecraft/network/encryption/SignedChatMessage;toSignedMessage(Lnet/minecraft/server/filter/FilteredMessage;Lnet/minecraft/server/filter/FilteredMessage;Lnet/minecraft/network/encryption/ChatMessageSignature;Z)Lnet/minecraft/server/filter/FilteredMessage;
    • of

      public static SignedChatMessage of(Text content)
      Returns a new signed chat message with signedContent and "none" signature.
      Returns:
      a new signed chat message with signedContent and "none" signature
      Mappings:
      Namespace Name Mixin selector
      official a Lru;a(Lrm;)Lru;
      intermediary method_44127 Lnet/minecraft/class_7471;method_44127(Lnet/minecraft/class_2561;)Lnet/minecraft/class_7471;
      named of Lnet/minecraft/network/encryption/SignedChatMessage;of(Lnet/minecraft/text/Text;)Lnet/minecraft/network/encryption/SignedChatMessage;
    • withUnsigned

      public SignedChatMessage withUnsigned(Text unsignedContent)
      Returns the new signed chat message with unsignedContent added.
      Returns:
      the new signed chat message with unsignedContent added
      API Note:
      This is used in vanilla when chat decorator decorates the message without the client previewing it. In this case, the undecorated content is signed but the decorated content is unsigned.
      Mappings:
      Namespace Name Mixin selector
      official b Lru;b(Lrm;)Lru;
      intermediary method_44129 Lnet/minecraft/class_7471;method_44129(Lnet/minecraft/class_2561;)Lnet/minecraft/class_7471;
      named withUnsigned Lnet/minecraft/network/encryption/SignedChatMessage;withUnsigned(Lnet/minecraft/text/Text;)Lnet/minecraft/network/encryption/SignedChatMessage;
    • verify

      public boolean verify(PlayerPublicKey key)
      Returns whether the message can be verified using the public key.
      Returns:
      whether the message can be verified using the public key
      Mappings:
      Namespace Name Mixin selector
      official a Lru;a(Lbti;)Z
      intermediary method_43867 Lnet/minecraft/class_7471;method_43867(Lnet/minecraft/class_7428;)Z
      named verify Lnet/minecraft/network/encryption/SignedChatMessage;verify(Lnet/minecraft/network/encryption/PlayerPublicKey;)Z
    • verify

      public boolean verify(ServerPlayerEntity player)
      Returns whether the message can be verified using the public key or if the player does not have the key.
      Returns:
      whether the message can be verified using the public key or if the player does not have the key
      Mappings:
      Namespace Name Mixin selector
      official a Lru;a(Lafp;)Z
      intermediary method_44310 Lnet/minecraft/class_7471;method_44310(Lnet/minecraft/class_3222;)Z
      named verify Lnet/minecraft/network/encryption/SignedChatMessage;verify(Lnet/minecraft/server/network/ServerPlayerEntity;)Z
    • verify

      public boolean verify(ServerCommandSource source)
      Returns whether the message can be verified using the public key of the source or if the source does not have the key.
      Returns:
      whether the message can be verified using the public key of the source or if the source does not have the key
      Mappings:
      Namespace Name Mixin selector
      official a Lru;a(Ldr;)Z
      intermediary method_44312 Lnet/minecraft/class_7471;method_44312(Lnet/minecraft/class_2168;)Z
      named verify Lnet/minecraft/network/encryption/SignedChatMessage;verify(Lnet/minecraft/server/command/ServerCommandSource;)Z
    • getContent

      public Text getContent()
      Returns the content of the message.

      This returns the unsigned content if present, and fallbacks to the signed content.

      Returns:
      the content of the message
      Mappings:
      Namespace Name Mixin selector
      official a Lru;a()Lrm;
      intermediary method_44125 Lnet/minecraft/class_7471;method_44125()Lnet/minecraft/class_2561;
      named getContent Lnet/minecraft/network/encryption/SignedChatMessage;getContent()Lnet/minecraft/text/Text;
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object object)
      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. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      object - the object with which to compare
      Returns:
      true if this object is the same as the object argument; false otherwise.
    • signedContent

      public Text signedContent()
      Returns the value of the signedContent record component.
      Returns:
      the value of the signedContent record component
    • signature

      public ChatMessageSignature signature()
      Returns the value of the signature record component.
      Returns:
      the value of the signature record component
    • unsignedContent

      public Optional<Text> unsignedContent()
      Returns the value of the unsignedContent record component.
      Returns:
      the value of the unsignedContent record component