Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-19 13:00:06 +01:00
SPIGOT-5863: Don't check colour in scoreboard length validation
Dieser Commit ist enthalten in:
Ursprung
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));
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren