2014-06-22 11:25:10 +02:00
|
|
|
From d16db3773d3d36c120f90515d325648d1786e6dc Mon Sep 17 00:00:00 2001
|
2014-04-17 11:36:09 +02:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
--
|
2014-04-19 01:15:23 +02:00
|
|
|
1.9.1
|
2014-04-17 11:36:09 +02:00
|
|
|
|