Fix and add new scoreboard API (#10037)
This commit is contained in:
36
patches/server/Fix-scoreboard-entries.patch
Normal file
36
patches/server/Fix-scoreboard-entries.patch
Normal file
@@ -0,0 +1,36 @@
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java
|
||||
@@ -0,0 +0,0 @@ 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
|
||||
}
|
||||
@@ -0,0 +0,0 @@ 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
|
||||
Reference in New Issue
Block a user