PaperMC/CraftBukkit-Patches/0112-Add-Score.isScoreSet-Z-API.patch
Zach Brown 19972e09b8 Update SpigotMC's patches
5a0150f586ed3eb15fe6f1f596d1a5a7d806f0f9 Fix ITEM_BREAK
e6a3911057bd94d8bd7021cbb4923fb84fb106d1 Upstream merge
d1cdcf8d4c3639f956474f02ed662517cffbe23e Remove old patch
068df64aeee368377e1673667bffc7a6dcf90554 Rebuild all patches
2014-11-30 16:16:48 -06:00

37 lines
1.5 KiB
Diff

From 127d0ce6119ec93e148c623942ce97fb3bafa33e 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 c7d3657..05f72df 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();
@@ -60,9 +60,11 @@ final class CraftScore implements Score {
}
// Spigot start
- @Override
+ @Override
public boolean isScoreSet() throws IllegalStateException {
- throw new UnsupportedOperationException("Not supported yet.");
+ Scoreboard board = objective.checkState().board;
+
+ return board.getPlayers().contains(entry) && board.getPlayerObjectives(entry).containsKey(objective.getHandle());
}
// Spigot end
}
--
2.1.0