diff options
author | Nassim Jahnke <[email protected]> | 2022-03-06 16:32:33 +0100 |
---|---|---|
committer | Nassim Jahnke <[email protected]> | 2022-03-06 16:32:33 +0100 |
commit | 7b9c30fb82d79599878543d7877f686678db0792 (patch) | |
tree | 57c25f3afd3e784b48886e08cc01a246bf4a5e8d | |
parent | a36d7f64273674d013d0c0f8adc0f716f174fd86 (diff) | |
download | Paper-7b9c30fb82d79599878543d7877f686678db0792.tar.gz Paper-7b9c30fb82d79599878543d7877f686678db0792.zip |
Fix scoreboard objective name length limit
-rw-r--r-- | patches/api/0005-Adventure.patch | 6 | ||||
-rw-r--r-- | patches/server/0008-Adventure.patch | 4 | ||||
-rw-r--r-- | patches/server/0510-Lazily-track-plugin-scoreboards-by-default.patch | 6 |
3 files changed, 8 insertions, 8 deletions
diff --git a/patches/api/0005-Adventure.patch b/patches/api/0005-Adventure.patch index e926c37b10..be3ca290ca 100644 --- a/patches/api/0005-Adventure.patch +++ b/patches/api/0005-Adventure.patch @@ -3977,7 +3977,7 @@ index ff3fcb2697eb00736238d0efdcaefe43043334d3..75acd6f8f3d774bb79e8e513125e801c /** diff --git a/src/main/java/org/bukkit/scoreboard/Scoreboard.java b/src/main/java/org/bukkit/scoreboard/Scoreboard.java -index 5c855dbd0da895392f7a6e92cdc90782baf614ad..f7754ab421c7b452a53c28d1e2fafdccfbba24bf 100644 +index 5c855dbd0da895392f7a6e92cdc90782baf614ad..1ada91d790abedbc9b3aeb6e96467a0d78560f15 100644 --- a/src/main/java/org/bukkit/scoreboard/Scoreboard.java +++ b/src/main/java/org/bukkit/scoreboard/Scoreboard.java @@ -27,6 +27,48 @@ public interface Scoreboard { @@ -3993,7 +3993,7 @@ index 5c855dbd0da895392f7a6e92cdc90782baf614ad..f7754ab421c7b452a53c28d1e2fafdcc + * @param displayName Name displayed to players for the Objective. + * @return The registered Objective + * @throws IllegalArgumentException if name is null -+ * @throws IllegalArgumentException if name is longer than 16 ++ * @throws IllegalArgumentException if name is longer than 32767 + * characters. + * @throws IllegalArgumentException if criteria is null + * @throws IllegalArgumentException if displayName is null @@ -4013,7 +4013,7 @@ index 5c855dbd0da895392f7a6e92cdc90782baf614ad..f7754ab421c7b452a53c28d1e2fafdcc + * @param renderType Manner of rendering the Objective + * @return The registered Objective + * @throws IllegalArgumentException if name is null -+ * @throws IllegalArgumentException if name is longer than 16 ++ * @throws IllegalArgumentException if name is longer than 32767 + * characters. + * @throws IllegalArgumentException if criteria is null + * @throws IllegalArgumentException if displayName is null diff --git a/patches/server/0008-Adventure.patch b/patches/server/0008-Adventure.patch index eebae688c6..138fe4e94c 100644 --- a/patches/server/0008-Adventure.patch +++ b/patches/server/0008-Adventure.patch @@ -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)); diff --git a/patches/server/0510-Lazily-track-plugin-scoreboards-by-default.patch b/patches/server/0510-Lazily-track-plugin-scoreboards-by-default.patch index 8c331cf394..5875199be4 100644 --- a/patches/server/0510-Lazily-track-plugin-scoreboards-by-default.patch +++ b/patches/server/0510-Lazily-track-plugin-scoreboards-by-default.patch @@ -14,7 +14,7 @@ this breaks your workflow you can always force all scoreboards to be tracked wit settings.track-plugin-scoreboards in paper.yml. diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index b3f872e4920babfe521effb233b13f8e9c85bef1..7a99db37a91edd12ef4a5d8cad690f6e62d31ba0 100644 +index ba2d5e53f39234c8cd5927b6fc7aaf7049a0b4cb..b057fa550b287fe4dcd7c8c0be14dc9fde6eb92b 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -96,6 +96,11 @@ public class PaperConfig { @@ -30,7 +30,7 @@ index b3f872e4920babfe521effb233b13f8e9c85bef1..7a99db37a91edd12ef4a5d8cad690f6e for (Map.Entry<String, Command> entry : commands.entrySet()) { MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "Paper", entry.getValue()); diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java -index 59f60fcadd8767cf8698482547e8c771d970732a..7b61a2be2be0bdf06592b65be9acd4cbbae5bf7f 100644 +index 5f2af880619e01a03e05258ae1f9fa58110f7f2a..944080939ceaf2db8bcd7d3c01f4b97440e35cc1 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java @@ -18,6 +18,7 @@ import org.bukkit.scoreboard.Team; @@ -42,7 +42,7 @@ index 59f60fcadd8767cf8698482547e8c771d970732a..7b61a2be2be0bdf06592b65be9acd4cb CraftScoreboard(Scoreboard board) { this.board = board; @@ -44,6 +45,12 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard { - 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); + // Paper start - the block comment from the old registerNewObjective didnt cause a conflict when rebasing, so this block wasn't added to the adventure registerNewObjective |