mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 10:35:38 +01:00
SPIGOT-5863: Don't check colour in scoreboard length validation
This commit is contained in:
parent
f2cbce30d9
commit
2a8482869d
@ -38,7 +38,7 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
|
|||||||
@Override
|
@Override
|
||||||
public void setDisplayName(String displayName) throws IllegalStateException {
|
public void setDisplayName(String displayName) throws IllegalStateException {
|
||||||
Validate.notNull(displayName, "Display name cannot be null");
|
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();
|
CraftScoreboard scoreboard = checkState();
|
||||||
|
|
||||||
team.setDisplayName(CraftChatMessage.fromString(displayName)[0]); // SPIGOT-4112: not nullable
|
team.setDisplayName(CraftChatMessage.fromString(displayName)[0]); // SPIGOT-4112: not nullable
|
||||||
@ -54,7 +54,7 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
|
|||||||
@Override
|
@Override
|
||||||
public void setPrefix(String prefix) throws IllegalStateException, IllegalArgumentException {
|
public void setPrefix(String prefix) throws IllegalStateException, IllegalArgumentException {
|
||||||
Validate.notNull(prefix, "Prefix cannot be null");
|
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();
|
CraftScoreboard scoreboard = checkState();
|
||||||
|
|
||||||
team.setPrefix(CraftChatMessage.fromStringOrNull(prefix));
|
team.setPrefix(CraftChatMessage.fromStringOrNull(prefix));
|
||||||
@ -70,7 +70,7 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
|
|||||||
@Override
|
@Override
|
||||||
public void setSuffix(String suffix) throws IllegalStateException, IllegalArgumentException {
|
public void setSuffix(String suffix) throws IllegalStateException, IllegalArgumentException {
|
||||||
Validate.notNull(suffix, "Suffix cannot be null");
|
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();
|
CraftScoreboard scoreboard = checkState();
|
||||||
|
|
||||||
team.setSuffix(CraftChatMessage.fromStringOrNull(suffix));
|
team.setSuffix(CraftChatMessage.fromStringOrNull(suffix));
|
||||||
|
Loading…
Reference in New Issue
Block a user