Scissors/patches/server/0023-Refuse-to-convert-legacy-messages-over-1k-characters.patch
2024-06-14 19:09:16 -05:00

19 lines
997 B
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Telesphoreo <me@telesphoreo.me>
Date: Sat, 11 May 2024 13:09:44 -0500
Subject: [PATCH] Refuse to convert legacy messages over 1k characters
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
index 70f207f016959402ff3cba9de924f906fea28110..f4751469d925f350a7eda9ae6a1f340d41636b2c 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
@@ -216,6 +216,7 @@ public final class CraftChatMessage {
}
public static Component[] fromString(String message, boolean keepNewlines, boolean plain) {
+ if (message.length() > 1_000) return new Component[]{Component.empty()}; // Scissors - Refuse to convert legacy messages over 1k characters
return new StringMessage(message, keepNewlines, plain).getOutput();
}