9
0
mirror of https://github.com/Xiao-MoMi/Custom-Nameplates.git synced 2026-01-04 15:31:47 +00:00

2.2.0.3-hotfix

This commit is contained in:
Xiao-MoMi
2023-04-04 23:34:40 +08:00
parent c38463fed6
commit 3adb94dc3d
4 changed files with 11 additions and 8 deletions

View File

@@ -110,11 +110,6 @@ public class FontManager extends Function {
return plugin.getFontManager().getShortestNegChars(totalWidth + totalWidth % 2 + 1);
}
// All the characters
public int getCharWidth(char c) {
return Objects.requireNonNullElse(customImageWidth.get(c), ConfigManager.default_width);
}
// Player name
public int getNameCharWidth(char c) {
Integer width = asciiWidth.get(c);
@@ -126,7 +121,13 @@ public class FontManager extends Function {
int length = text.length();
int n = 0;
for (int i = 0; i < length; i++) {
n += getCharWidth(text.charAt(i));
char current = text.charAt(i);
if (current != '\\' || i == length - 1 || text.charAt(i + 1) != '<') {
n += Objects.requireNonNullElse(customImageWidth.get(current), ConfigManager.default_width);
}
else {
n -= 1;
}
}
return n + length;
}