diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java index 67178e1387..0fba3d2a8d 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java @@ -38,7 +38,7 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { @Override public void setDisplayName(String displayName) throws IllegalStateException { Validate.notNull(displayName, "Display name cannot be null"); - Validate.isTrue(displayName.length() <= 128, "Display name '" + displayName + "' is longer than the limit of 128 characters"); + Validate.isTrue(ChatColor.stripColor(displayName).length() <= 128, "Display name '" + displayName + "' is longer than the limit of 128 characters"); CraftScoreboard scoreboard = checkState(); team.setDisplayName(CraftChatMessage.fromString(displayName)[0]); // SPIGOT-4112: not nullable @@ -54,7 +54,7 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { @Override public void setPrefix(String prefix) throws IllegalStateException, IllegalArgumentException { Validate.notNull(prefix, "Prefix cannot be null"); - Validate.isTrue(prefix.length() <= 64, "Prefix '" + prefix + "' is longer than the limit of 64 characters"); + Validate.isTrue(ChatColor.stripColor(prefix).length() <= 64, "Prefix '" + prefix + "' is longer than the limit of 64 characters"); CraftScoreboard scoreboard = checkState(); team.setPrefix(CraftChatMessage.fromStringOrNull(prefix)); @@ -70,7 +70,7 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { @Override public void setSuffix(String suffix) throws IllegalStateException, IllegalArgumentException { Validate.notNull(suffix, "Suffix cannot be null"); - Validate.isTrue(suffix.length() <= 64, "Suffix '" + suffix + "' is longer than the limit of 64 characters"); + Validate.isTrue(ChatColor.stripColor(suffix).length() <= 64, "Suffix '" + suffix + "' is longer than the limit of 64 characters"); CraftScoreboard scoreboard = checkState(); team.setSuffix(CraftChatMessage.fromStringOrNull(suffix));