Skip to content

Commit 66cf650

Browse files
authored
Limit legacy string trimming (#605)
1 parent 1426631 commit 66cf650

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

common/src/main/java/com/viaversion/viarewind/utils/ChatUtil.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ public static String jsonToLegacy(JsonElement component) {
6666
try {
6767
LEGACY_REWRITER.processText(null, component);
6868
String legacy = ComponentUtil.jsonToLegacy(component);
69-
while (legacy.startsWith("§f")) legacy = legacy.substring(2);
69+
int attempts = 0;
70+
while (legacy.startsWith("§f") && attempts++ < 10) {
71+
legacy = legacy.substring(2);
72+
}
7073
return legacy;
7174
} catch (Exception ex) {
7275
if (!Via.getConfig().isSuppressConversionWarnings()) {

0 commit comments

Comments
 (0)