mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Add API for resetting a single score (#6873)
This commit is contained in:
parent
023b612f62
commit
63c3c76ad0
2 changed files with 50 additions and 0 deletions
26
patches/api/Add-API-for-resetting-a-single-score.patch
Normal file
26
patches/api/Add-API-for-resetting-a-single-score.patch
Normal file
|
@ -0,0 +1,26 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: booky10 <boooky10@gmail.com>
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/scoreboard/Score.java
|
||||
+++ b/src/main/java/org/bukkit/scoreboard/Score.java
|
||||
@@ -0,0 +0,0 @@ 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
|
||||
}
|
24
patches/server/Add-API-for-resetting-a-single-score.patch
Normal file
24
patches/server/Add-API-for-resetting-a-single-score.patch
Normal file
|
@ -0,0 +1,24 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: booky10 <boooky10@gmail.com>
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java
|
||||
@@ -0,0 +0,0 @@ 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
|
||||
}
|
Loading…
Reference in a new issue