Fix scoreboard objective name length limit
This commit is contained in:
parent
a36d7f6427
commit
7b9c30fb82
3 changed files with 8 additions and 8 deletions
|
@ -3331,7 +3331,7 @@ index e9bb0728ae5c16aad4acc106d332db5095db4033..6752cd9b3bc246fc2a7764df0d2b40d3
|
|||
public String getDisplayName() throws IllegalStateException {
|
||||
CraftScoreboard scoreboard = this.checkState();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java
|
||||
index afc059755ae3e7b1c0a4cf3c6b8f32ce13cc458d..59f60fcadd8767cf8698482547e8c771d970732a 100644
|
||||
index afc059755ae3e7b1c0a4cf3c6b8f32ce13cc458d..5f2af880619e01a03e05258ae1f9fa58110f7f2a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java
|
||||
@@ -27,6 +27,27 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard {
|
||||
|
@ -3352,7 +3352,7 @@ index afc059755ae3e7b1c0a4cf3c6b8f32ce13cc458d..59f60fcadd8767cf8698482547e8c771
|
|||
+ Validate.notNull(criteria, "Criteria cannot be null");
|
||||
+ Validate.notNull(displayName, "Display name cannot be null");
|
||||
+ Validate.notNull(renderType, "RenderType cannot be null");
|
||||
+ Validate.isTrue(name.length() <= 16, "The name '" + name + "' is longer than the limit of 16 characters");
|
||||
+ Validate.isTrue(name.length() <= Short.MAX_VALUE, "The name '" + name + "' is longer than the limit of 32767 characters");
|
||||
+ Validate.isTrue(board.getObjective(name) == null, "An objective of name '" + name + "' already exists");
|
||||
+ CraftCriteria craftCriteria = CraftCriteria.getFromBukkit(criteria);
|
||||
+ net.minecraft.world.scores.Objective objective = board.addObjective(name, craftCriteria.criteria, io.papermc.paper.adventure.PaperAdventure.asVanilla(displayName), CraftScoreboardTranslations.fromBukkitRender(renderType));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue