convert every color in the name

This commit is contained in:
Plancke 2018-10-21 23:19:54 +02:00
parent 7d5c59aa34
commit 81514e4192

View File

@ -932,11 +932,17 @@ public class Protocol1_13To1_12_2 extends Protocol {
// It also overwrites for ANY colour in name but most plugins // It also overwrites for ANY colour in name but most plugins
// will just send colour as 'invisible' character // will just send colour as 'invisible' character
if (ChatColor.stripColor(name).length() == 0) { if (ChatColor.stripColor(name).length() == 0) {
ChatColor color = ChatColor.getByChar(name.charAt(1)); StringBuilder newName = new StringBuilder();
String newName = SCOREBOARD_TEAM_NAME_REWRITE.get(color); for (int i = 0; i < name.length() / 2; i++) {
if (newName != null) { // just in case ChatColor color = ChatColor.getByChar(name.charAt(i * 2 + 1));
name = newName; String rewrite = SCOREBOARD_TEAM_NAME_REWRITE.get(color);
if (rewrite != null) { // just in case, should never happen
newName.append(rewrite);
} else {
newName.append(name);
}
} }
name = newName.toString();
} }
return name; return name;
} }