account for empty strings

This commit is contained in:
extendedclip 2020-08-06 14:08:48 -04:00
parent b73d00e169
commit 2d72e274e3
1 changed files with 3 additions and 0 deletions

View File

@ -168,6 +168,9 @@ public final class CharsReplacer implements Replacer {
builder.append(ChatColor.translateAlternateColorCodes('&', replacement));
}
if (builder.length() == 0) {
return "";
}
char c = builder.charAt(builder.length() - 1);
if (c == ' ') {
return builder.substring(0, builder.length() - 1);