mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-11-01 12:37:10 +00:00
38 lines
1.5 KiB
Diff
38 lines
1.5 KiB
Diff
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||
|
From: Allink <arclicious@vivaldi.net>
|
||
|
Date: Tue, 16 Aug 2022 17:13:02 +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 0f70be614f8f5350ad558d0ae645cdf0027e1e76..6f036df37609daf33db3884174406e1ccd339735 100644
|
||
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||
|
@@ -3,12 +3,14 @@ package org.bukkit.craftbukkit.util;
|
||
|
import com.google.common.collect.ImmutableMap;
|
||
|
import com.google.common.collect.ImmutableMap.Builder;
|
||
|
import com.google.gson.JsonParseException;
|
||
|
+
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.List;
|
||
|
import java.util.Map;
|
||
|
import java.util.Optional;
|
||
|
import java.util.regex.Matcher;
|
||
|
import java.util.regex.Pattern;
|
||
|
+
|
||
|
import net.minecraft.ChatFormatting;
|
||
|
import net.minecraft.network.chat.ClickEvent;
|
||
|
import net.minecraft.network.chat.ClickEvent.Action;
|
||
|
@@ -199,6 +201,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[]{Component.empty()};
|
||
|
+ }
|
||
|
+ // Scissors end
|
||
|
return new StringMessage(message, keepNewlines, plain).getOutput();
|
||
|
}
|
||
|
|