Interface ChatDecorator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
MinecraftServer.getChatDecorator().
For the chat decorator to produce a signed message, both the server and the sender's client need to have chat previews enabled, Otherwise, the decorated content is considered unsigned, and if the clients require chat messages to be signed via the "Only Show Signed Chat" option, they will see the undecorated message. Therefore, chat decorator is not recommended for censoring messages.
It is very important that the decorator return the same text when previewed and sent. If this is not followed correctly, the server detects that the client sent a forged text and discards the message. For example, a decorator that appends the time the decoration was applied would be likely to fail, since there is usually a delay between the previewing and the submission. One way to solve this issue is to make it cache the result on preview, so that when the sent message needs decorating, the cached value can be used.
- Mappings:
Namespace Name official rfintermediary net/minecraft/class_7492named net/minecraft/network/ChatDecorator
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ChatDecoratorAn empty chat decorator that does not decorate anything. -
Method Summary
Modifier and TypeMethodDescriptiondefault SignedChatMessagedecorate(@Nullable ServerPlayerEntity sender, SignedChatMessage message) Returns the signed chat message with unsigned content set as decoratedmessage.decorate(@Nullable ServerPlayerEntity sender, Text message) Returns the decoratedmessage.default SignedChatMessagedecorate(@Nullable ServerPlayerEntity sender, Text message, ChatMessageSignature signature, boolean previewed) Returns the decorated signed chat message from undecoratedmessage.static ChatDecoratorDeprecated.
-
Field Details
-
NOOP
An empty chat decorator that does not decorate anything.- Mappings:
Namespace Name Mixin selector official aLrf;a:Lrf;intermediary field_39384Lnet/minecraft/class_7492;field_39384:Lnet/minecraft/class_7492;named NOOPLnet/minecraft/network/ChatDecorator;NOOP:Lnet/minecraft/network/ChatDecorator;
-
-
Method Details
-
testRainbowChat
Deprecated. -
decorate
Returns the decoratedmessage.- Returns:
- the decorated
message - Mappings:
Namespace Name Mixin selector official decorateLrf;decorate(Lafm;Lrl;)Lrl;intermediary decorateLnet/minecraft/class_7492;decorate(Lnet/minecraft/class_3222;Lnet/minecraft/class_2561;)Lnet/minecraft/class_2561;named decorateLnet/minecraft/network/ChatDecorator;decorate(Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/text/Text;)Lnet/minecraft/text/Text;
-
decorate
default SignedChatMessage decorate(@Nullable @Nullable ServerPlayerEntity sender, Text message, ChatMessageSignature signature, boolean previewed) Returns the decorated signed chat message from undecoratedmessage.If
previewedis false, the returned message will have the original content as signed and the decorated content as unsigned. This means that if the received player requires signed chat message, they will see the original content.- Parameters:
previewed- whether the decoration was previewed by the sender's client- Returns:
- the decorated signed chat message from undecorated
message - Mappings:
Namespace Name Mixin selector official decorateLrf;decorate(Lafm;Lrl;Lrq;Z)Lrt;intermediary decorateLnet/minecraft/class_7492;decorate(Lnet/minecraft/class_3222;Lnet/minecraft/class_2561;Lnet/minecraft/class_7469;Z)Lnet/minecraft/class_7471;named decorateLnet/minecraft/network/ChatDecorator;decorate(Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/text/Text;Lnet/minecraft/network/encryption/ChatMessageSignature;Z)Lnet/minecraft/network/encryption/SignedChatMessage;
-
decorate
default SignedChatMessage decorate(@Nullable @Nullable ServerPlayerEntity sender, SignedChatMessage message) Returns the signed chat message with unsigned content set as decoratedmessage.- Returns:
- the signed chat message with unsigned content set as decorated
message - API Note:
- This is used by various commands that send messages, such as
MeCommand.If the received player requires signed chat message, they will see the original content.
- Mappings:
Namespace Name Mixin selector official decorateLrf;decorate(Lafm;Lrt;)Lrt;intermediary decorateLnet/minecraft/class_7492;decorate(Lnet/minecraft/class_3222;Lnet/minecraft/class_7471;)Lnet/minecraft/class_7471;named decorateLnet/minecraft/network/ChatDecorator;decorate(Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/network/encryption/SignedChatMessage;)Lnet/minecraft/network/encryption/SignedChatMessage;
-