2014-11-29 00:06:26 +00:00
|
|
|
From f169f48d58863f32f7e4236646171e26cec4eec3 Mon Sep 17 00:00:00 2001
|
2014-07-21 20:46:54 +00: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
|
2014-11-28 01:17:45 +00:00
|
|
|
index c7d3657..05f72df 100644
|
2014-07-21 20:46:54 +00:00
|
|
|
--- 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();
|
2014-11-28 01:17:45 +00:00
|
|
|
@@ -60,9 +60,11 @@ final class CraftScore implements Score {
|
2014-07-21 20:46:54 +00:00
|
|
|
}
|
|
|
|
|
2014-11-28 01:17:45 +00:00
|
|
|
// Spigot start
|
|
|
|
- @Override
|
2014-07-21 20:46:54 +00:00
|
|
|
+ @Override
|
2014-11-28 01:17:45 +00:00
|
|
|
public boolean isScoreSet() throws IllegalStateException {
|
|
|
|
- throw new UnsupportedOperationException("Not supported yet.");
|
2014-07-21 20:46:54 +00:00
|
|
|
+ Scoreboard board = objective.checkState().board;
|
|
|
|
+
|
|
|
|
+ return board.getPlayers().contains(entry) && board.getPlayerObjectives(entry).containsKey(objective.getHandle());
|
|
|
|
}
|
2014-11-28 01:17:45 +00:00
|
|
|
// Spigot end
|
|
|
|
}
|
2014-07-21 20:46:54 +00:00
|
|
|
--
|
2014-11-28 01:17:45 +00:00
|
|
|
2.1.0
|
2014-07-21 20:46:54 +00:00
|
|
|
|