diff options
author | booky10 <[email protected]> | 2021-11-16 00:08:50 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-11-15 15:08:50 -0800 |
commit | 51b7b609f108911138de830f2b201adb5a14628c (patch) | |
tree | 0366eaa09f993d301189aa8e49eb06426d6a4c5d | |
parent | 555f99d39035adb25140c12741c6722185de73d3 (diff) | |
download | Paper-51b7b609f108911138de830f2b201adb5a14628c.tar.gz Paper-51b7b609f108911138de830f2b201adb5a14628c.zip |
Add API for resetting a single score (#6873)
-rw-r--r-- | patches/api/0347-Add-API-for-resetting-a-single-score.patch | 26 | ||||
-rw-r--r-- | patches/server/0844-Add-API-for-resetting-a-single-score.patch | 24 |
2 files changed, 50 insertions, 0 deletions
diff --git a/patches/api/0347-Add-API-for-resetting-a-single-score.patch b/patches/api/0347-Add-API-for-resetting-a-single-score.patch new file mode 100644 index 0000000000..997ebf42f6 --- /dev/null +++ b/patches/api/0347-Add-API-for-resetting-a-single-score.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: booky10 <[email protected]> +Date: Fri, 5 Nov 2021 21:01:36 +0100 +Subject: [PATCH] Add API for resetting a single score + +It was only possible to reset all scores for a specific entry, instead of resetting only specific scores. + +diff --git a/src/main/java/org/bukkit/scoreboard/Score.java b/src/main/java/org/bukkit/scoreboard/Score.java +index d25b4d04932da7e7562cd1acf67ebec33af5b6ef..07bfad4a908de26e9aa6291e4ad20006e88ffe87 100644 +--- a/src/main/java/org/bukkit/scoreboard/Score.java ++++ b/src/main/java/org/bukkit/scoreboard/Score.java +@@ -73,4 +73,14 @@ public interface Score { + */ + @Nullable + Scoreboard getScoreboard(); ++ ++ // Paper start ++ /** ++ * Resets this score, if a value has been set. ++ * ++ * @throws IllegalStateException if the associated objective has been ++ * unregistered ++ */ ++ void resetScore() throws IllegalStateException; ++ // Paper end + } diff --git a/patches/server/0844-Add-API-for-resetting-a-single-score.patch b/patches/server/0844-Add-API-for-resetting-a-single-score.patch new file mode 100644 index 0000000000..c2e1fd93b9 --- /dev/null +++ b/patches/server/0844-Add-API-for-resetting-a-single-score.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: booky10 <[email protected]> +Date: Fri, 5 Nov 2021 21:01:36 +0100 +Subject: [PATCH] Add API for resetting a single score + +It was only possible to reset all scores for a specific entry, instead of resetting only specific scores. + +diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java +index 2c4ffed5e828f051c44f494a8ed599a8197d7450..3b26793b67282c3a20c023b9c13a2a9b54d5d932 100644 +--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java ++++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java +@@ -68,4 +68,12 @@ final class CraftScore implements Score { + public CraftScoreboard getScoreboard() { + return this.objective.getScoreboard(); + } ++ ++ // Paper start ++ @Override ++ public void resetScore() { ++ Scoreboard board = this.objective.checkState().board; ++ board.resetPlayerScore(entry, this.objective.getHandle()); ++ } ++ // Paper end + } |