From 8c0deddbe13e6b6cacf35d3f52c94500c7d7ddd5 Mon Sep 17 00:00:00 2001 From: Allink <44676012+allinkdev@users.noreply.github.com> Date: Thu, 18 Aug 2022 03:45:51 +0100 Subject: [PATCH] Refuse to convert legacy messages over 1k characters (#61) --- ...t-legacy-messages-over-1k-characters.patch | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 patches/server/0041-Refuse-to-convert-legacy-messages-over-1k-characters.patch diff --git a/patches/server/0041-Refuse-to-convert-legacy-messages-over-1k-characters.patch b/patches/server/0041-Refuse-to-convert-legacy-messages-over-1k-characters.patch new file mode 100644 index 0000000..b883c46 --- /dev/null +++ b/patches/server/0041-Refuse-to-convert-legacy-messages-over-1k-characters.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Allink +Date: Tue, 16 Aug 2022 17:25:37 +0100 +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 26d43c229caf9f8504af7071c3a61ec6da7e27ec..ecceb3fc7f822d826b4a789fe72a8cd08e90d60e 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java +@@ -198,6 +198,11 @@ public final class CraftChatMessage { + } + + public static Component[] fromString(String message, boolean keepNewlines, boolean plain) { ++ // Scissors start - Refuse to convert legacy messages over 1k characters ++ if (message.length() > 1_000) { ++ return new Component[]{TextComponent.EMPTY}; ++ } ++ // Scissors end + return new StringMessage(message, keepNewlines, plain).getOutput(); + } +