mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-17 23:01:01 +01:00
SPIGOT-6825: MapFont#getWidth ignores §, but not the color-byte and semicolon following it
By: md_5 <git@md-5.net>
This commit is contained in:
parent
62f79aa905
commit
926db7c30b
1 changed files with 8 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue