Paper/CraftBukkit-Patches/0128-Add-Score.isScoreSet-Z-API.patch
Zach Brown cab333b217 Rebase (Update) from upstream SpigotMC
Don't send requests of every player was found in the global api cache SpigotMC/Spigot@841270ff1e
Correctly set the response code for the cached lookups and return the ... SpigotMC/Spigot@f170b7899c
Don't try and re-set the global api cache on reload SpigotMC/Spigot@b410a00a66
Use a compile time sneaky throw hack. SpigotMC/Spigot@508462b96b
Fix a missed rename in WorldGenGroundBush SpigotMC/Spigot@0614d8fae9
2014-11-28 14:19:07 -06:00

40 lines
1.7 KiB
Diff

From 303d0d3c7ae9f5c287311ae30d370f42f1c0c7f2 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Thu, 17 Apr 2014 19:35:53 +1000
Subject: [PATCH] Add Score.isScoreSet()Z API.
Also fix generics on CraftScore.getScore()I.
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java
index 7095f6d..b265616 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java
@@ -41,7 +41,7 @@ final class CraftScore implements Score {
Scoreboard board = objective.checkState().board;
if (board.getPlayers().contains(entry)) { // Lazy
- Map<String, ScoreboardScore> scores = board.getPlayerObjectives(entry);
+ Map<net.minecraft.server.ScoreboardObjective, ScoreboardScore> scores = board.getPlayerObjectives(entry); // Spigot
ScoreboardScore score = scores.get(objective.getHandle());
if (score != null) { // Lazy
return score.getScore();
@@ -55,6 +55,15 @@ final class CraftScore implements Score {
objective.checkState().board.getPlayerScoreForObjective(entry, objective.getHandle()).setScore(score);
}
+ // Spigot start
+ @Override
+ public boolean isScoreSet() throws IllegalStateException {
+ Scoreboard board = objective.checkState().board;
+
+ return board.getPlayers().contains(entry) && board.getPlayerObjectives(entry).containsKey(objective.getHandle());
+ }
+ // Spigot end
+
public CraftScoreboard getScoreboard() {
return objective.getScoreboard();
}
--
1.9.1