Interface MessageDecorator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
MinecraftServer.getMessageDecorator().
For the message 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 Secure Chat" option, they will see the undecorated message. Therefore, message decorator is not recommended for censoring messages.
It is very important that the decorator be pure; i.e. return the same text when given the same text (and sender). Otherwise, the server detects a mismatch between the preview and the actual message, and discards the message as it is now considered improperly signed. 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.
- Mappings:
Namespace Name official rgintermediary net/minecraft/class_7492named net/minecraft/network/message/MessageDecorator
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MessageDecoratorAn empty message decorator that returns the original message. -
Method Summary
Modifier and TypeMethodDescriptiondecorate(@Nullable ServerPlayerEntity sender, Text message) Returns the decoratedmessage.default CompletableFuture<FilteredMessage<SignedMessage>>decorateChat(@Nullable ServerPlayerEntity sender, FilteredMessage<Text> message, MessageSignature signature, boolean previewed) Returns the decorated signed chat message from undecoratedmessage.default CompletableFuture<FilteredMessage<Text>>decorateFiltered(@Nullable ServerPlayerEntity sender, FilteredMessage<Text> message) Returns the decorated filtered message from undecoratedmessage.
-
Field Details
-
NOOP
An empty message decorator that returns the original message.- Mappings:
Namespace Name Mixin selector official aLrg;a:Lrg;intermediary field_39384Lnet/minecraft/class_7492;field_39384:Lnet/minecraft/class_7492;named NOOPLnet/minecraft/network/message/MessageDecorator;NOOP:Lnet/minecraft/network/message/MessageDecorator;
-
-
Method Details
-
decorate
Returns the decoratedmessage.- Parameters:
sender- the player who sent the message, ornullifmessagewas not sent by a player- Returns:
- the decorated
message - Mappings:
Namespace Name Mixin selector official decorateLrg;decorate(Lafp;Lrm;)Ljava/util/concurrent/CompletableFuture;intermediary decorateLnet/minecraft/class_7492;decorate(Lnet/minecraft/class_3222;Lnet/minecraft/class_2561;)Ljava/util/concurrent/CompletableFuture;named decorateLnet/minecraft/network/message/MessageDecorator;decorate(Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/text/Text;)Ljava/util/concurrent/CompletableFuture;
-
decorateFiltered
default CompletableFuture<FilteredMessage<Text>> decorateFiltered(@Nullable @Nullable ServerPlayerEntity sender, FilteredMessage<Text> message) Returns the decorated filtered message from undecoratedmessage.This keeps the filtered status of the original message; i.e. fully censored messages will remain fully censored, and unfiltered messages will remain unfiltered. If the message is partially filtered, both the raw and the filtered message will be decorated.
- Returns:
- the decorated filtered message from undecorated
message - Mappings:
Namespace Name Mixin selector official decorateFilteredLrg;decorateFiltered(Lafp;Lagd;)Ljava/util/concurrent/CompletableFuture;intermediary decorateFilteredLnet/minecraft/class_7492;decorateFiltered(Lnet/minecraft/class_3222;Lnet/minecraft/class_5837;)Ljava/util/concurrent/CompletableFuture;named decorateFilteredLnet/minecraft/network/message/MessageDecorator;decorateFiltered(Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/server/filter/FilteredMessage;)Ljava/util/concurrent/CompletableFuture;
-
decorateChat
default CompletableFuture<FilteredMessage<SignedMessage>> decorateChat(@Nullable @Nullable ServerPlayerEntity sender, FilteredMessage<Text> message, MessageSignature 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.This keeps the filtered status of the original message; i.e. fully censored messages will remain fully censored, and unfiltered messages will remain unfiltered. If the message is partially filtered, both the raw and the filtered message will be decorated.
- 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 decorateChatLrg;decorateChat(Lafp;Lagd;Lrr;Z)Ljava/util/concurrent/CompletableFuture;intermediary decorateChatLnet/minecraft/class_7492;decorateChat(Lnet/minecraft/class_3222;Lnet/minecraft/class_5837;Lnet/minecraft/class_7469;Z)Ljava/util/concurrent/CompletableFuture;named decorateChatLnet/minecraft/network/message/MessageDecorator;decorateChat(Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/server/filter/FilteredMessage;Lnet/minecraft/network/message/MessageSignature;Z)Ljava/util/concurrent/CompletableFuture;
-