Paper/patches/server/1049-Fix-scoreboard-entries.patch
2023-12-25 16:47:06 -08:00

37 Zeilen
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sat, 16 Dec 2023 13:06:20 -0800
Subject: [PATCH] Fix scoreboard entries
1.20.3/4 introduced ScoreHolder which broke a lot of existing
logic that just assumed score entries were strings.
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java
index be020d6b686c1ad5bd8b7cee0b6050304d434022..d3d0d71b6fbacc30917682fcc1aace1902a64248 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java
@@ -42,12 +42,12 @@ final class CraftScore implements Score {
public int getScore() {
Scoreboard board = this.objective.checkState().board;
- if (board.getTrackedPlayers().contains(this.entry)) { // Lazy
+ // if (board.getTrackedPlayers().contains(this.entry)) { // Lazy // Paper - just use the null check
ReadOnlyScoreInfo score = board.getPlayerScoreInfo(this.entry, this.objective.getHandle());
if (score != null) { // Lazy
return score.value();
}
- }
+ // } // Paper - just use the null check above
return 0; // Lazy
}
@@ -61,7 +61,7 @@ final class CraftScore implements Score {
public boolean isScoreSet() {
Scoreboard board = this.objective.checkState().board;
- return board.getTrackedPlayers().contains(this.entry) && board.getPlayerScoreInfo(this.entry, this.objective.getHandle()) != null;
+ return /*board.getTrackedPlayers().contains(this.entry) && */board.getPlayerScoreInfo(this.entry, this.objective.getHandle()) != null; // Paper - just check if the player score info exists
}
@Override