aboutsummaryrefslogtreecommitdiffhomepage
path: root/paper-server/patches/sources/net/minecraft/network/chat/OutgoingChatMessage.java.patch
blob: 3192e18db3fa4fbf27f03387a27ff703012aa51b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--- 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);
             }