3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 02:50:09 +01:00

Fix scoreboard objective name length limit

Dieser Commit ist enthalten in:
Nassim Jahnke 2022-03-06 16:32:33 +01:00
Ursprung a36d7f6427
Commit 7b9c30fb82
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
3 geänderte Dateien mit 8 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -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

Datei anzeigen

@ -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));

Datei anzeigen

@ -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