From 926db7c30bd052a46779f863ee88d314aa3fed45 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Wed, 1 Dec 2021 14:58:04 +1100 Subject: [PATCH] =?UTF-8?q?SPIGOT-6825:=20MapFont#getWidth=20ignores=20?= =?UTF-8?q?=C2=A7,=20but=20not=20the=20color-byte=20and=20semicolon=20foll?= =?UTF-8?q?owing=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By: md_5 --- paper-api/src/main/java/org/bukkit/map/MapFont.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/paper-api/src/main/java/org/bukkit/map/MapFont.java b/paper-api/src/main/java/org/bukkit/map/MapFont.java index 2d599c8f3e..a45ce8198e 100644 --- a/paper-api/src/main/java/org/bukkit/map/MapFont.java +++ b/paper-api/src/main/java/org/bukkit/map/MapFont.java @@ -63,7 +63,14 @@ public class MapFont { int result = 0; for (int i = 0; i < text.length(); ++i) { char ch = text.charAt(i); - if (ch == ChatColor.COLOR_CHAR) continue; + if (ch == ChatColor.COLOR_CHAR) { + int j = text.indexOf(';', i); + if (j >= 0) { + i = j; + continue; + } + throw new IllegalArgumentException("Text contains unterminated color string"); + } result += chars.get(ch).getWidth(); } result += text.length() - 1; // Account for 1px spacing between characters