SPIGOT-7562: Fix Score#getScore and Score#isScoreSet

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2024-01-05 14:18:13 +11:00
parent 5e82782283
commit 71ca5a7bdf

View File

@ -42,11 +42,9 @@ final class CraftScore implements Score {
public int getScore() {
Scoreboard board = objective.checkState().board;
if (board.getTrackedPlayers().contains(entry)) { // Lazy
ReadOnlyScoreInfo score = board.getPlayerScoreInfo(entry, objective.getHandle());
if (score != null) { // Lazy
return score.value();
}
ReadOnlyScoreInfo score = board.getPlayerScoreInfo(entry, objective.getHandle());
if (score != null) { // Lazy
return score.value();
}
return 0; // Lazy
@ -61,7 +59,7 @@ final class CraftScore implements Score {
public boolean isScoreSet() {
Scoreboard board = objective.checkState().board;
return board.getTrackedPlayers().contains(entry) && board.getPlayerScoreInfo(entry, objective.getHandle()) != null;
return board.getPlayerScoreInfo(entry, objective.getHandle()) != null;
}
@Override