PaperMC/paper-server/patches/sources/net/minecraft/network/chat/OutgoingChatMessage.java.patch
Riley Park 66779f5c86 Adventure
== AT ==
public net.minecraft.network.chat.HoverEvent$ItemStackInfo item
public net.minecraft.network.chat.HoverEvent$ItemStackInfo count
public net.minecraft.network.chat.HoverEvent$ItemStackInfo components
public net.minecraft.network.chat.contents.TranslatableContents filterAllowedArguments(Ljava/lang/Object;)Lcom/mojang/serialization/DataResult;

Co-authored-by: zml <zml@stellardrift.ca>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2021-01-29 17:54:03 +01:00

44 lines
2.3 KiB
Diff

--- a/net/minecraft/network/chat/OutgoingChatMessage.java
+++ b/net/minecraft/network/chat/OutgoingChatMessage.java
@@ -7,6 +7,12 @@
void sendToPlayer(ServerPlayer sender, boolean filterMaskEnabled, ChatType.Bound params);
+ // Paper start
+ default void sendToPlayer(ServerPlayer sender, boolean filterMaskEnabled, ChatType.Bound params, @javax.annotation.Nullable Component unsigned) {
+ this.sendToPlayer(sender, filterMaskEnabled, params);
+ }
+ // Paper end
+
static OutgoingChatMessage create(PlayerChatMessage message) {
return (OutgoingChatMessage)(message.isSystem()
? new OutgoingChatMessage.Disguised(message.decoratedContent())
@@ -16,8 +22,13 @@
public static record Disguised(@Override Component content) implements OutgoingChatMessage {
@Override
public void sendToPlayer(ServerPlayer sender, boolean filterMaskEnabled, ChatType.Bound params) {
- sender.connection.sendDisguisedChatMessage(this.content, params);
+ // Paper start
+ this.sendToPlayer(sender, filterMaskEnabled, params, null);
}
+ public void sendToPlayer(ServerPlayer sender, boolean filterMaskEnabled, ChatType.Bound params, @javax.annotation.Nullable Component unsigned) {
+ sender.connection.sendDisguisedChatMessage(unsigned != null ? unsigned : this.content, params);
+ // Paper end
+ }
}
public static record Player(PlayerChatMessage message) implements OutgoingChatMessage {
@@ -28,7 +39,13 @@
@Override
public void sendToPlayer(ServerPlayer sender, boolean filterMaskEnabled, ChatType.Bound params) {
+ // Paper start
+ this.sendToPlayer(sender, filterMaskEnabled, params, null);
+ }
+ public void sendToPlayer(ServerPlayer sender, boolean filterMaskEnabled, ChatType.Bound params, @javax.annotation.Nullable Component unsigned) {
+ // Paper end
PlayerChatMessage playerChatMessage = this.message.filter(filterMaskEnabled);
+ playerChatMessage = unsigned != null ? playerChatMessage.withUnsignedContent(unsigned) : playerChatMessage; // Paper
if (!playerChatMessage.isFullyFiltered()) {
sender.connection.sendPlayerChatMessage(playerChatMessage, params);
}