2021-12-22 01:45:18 +01:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
|
|
Date: Thu, 4 Nov 2021 12:31:45 -0700
|
|
|
|
Subject: [PATCH] Improve scoreboard entries
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/scoreboard/Objective.java b/src/main/java/org/bukkit/scoreboard/Objective.java
|
2024-12-03 15:47:48 +01:00
|
|
|
index 35755c9165c1b48eaacfff86a50a7973476fe04b..d6d52bc9185e8a1581ccfa57df3550bc12d9872a 100644
|
2021-12-22 01:45:18 +01:00
|
|
|
--- a/src/main/java/org/bukkit/scoreboard/Objective.java
|
|
|
|
+++ b/src/main/java/org/bukkit/scoreboard/Objective.java
|
2023-08-06 02:21:59 +02:00
|
|
|
@@ -148,9 +148,8 @@ public interface Objective {
|
|
|
|
* @return Score tracking the Objective and player specified
|
2021-12-22 01:45:18 +01:00
|
|
|
* @throws IllegalStateException if this objective has been unregistered
|
|
|
|
* @see #getScore(String)
|
|
|
|
- * @deprecated Scoreboards can contain entries that aren't players
|
|
|
|
*/
|
2024-12-03 15:47:48 +01:00
|
|
|
- @Deprecated(since = "1.7.8")
|
|
|
|
+ // @Deprecated(since = "1.7.8") // Paper
|
2021-12-22 01:45:18 +01:00
|
|
|
@NotNull
|
2023-08-06 02:21:59 +02:00
|
|
|
Score getScore(@NotNull OfflinePlayer player);
|
2021-12-22 01:45:18 +01:00
|
|
|
|
2023-08-06 02:21:59 +02:00
|
|
|
@@ -164,4 +163,16 @@ public interface Objective {
|
2021-12-22 01:45:18 +01:00
|
|
|
*/
|
|
|
|
@NotNull
|
2023-08-06 02:21:59 +02:00
|
|
|
Score getScore(@NotNull String entry);
|
2021-12-22 01:45:18 +01:00
|
|
|
+
|
2023-08-06 02:21:59 +02:00
|
|
|
+ // Paper start - improve scoreboard entries
|
2021-12-22 01:45:18 +01:00
|
|
|
+ /**
|
|
|
|
+ * Gets an entity's Score for an Objective on this Scoreboard.
|
|
|
|
+ *
|
|
|
|
+ * @param entity Entity for the Score
|
|
|
|
+ * @return Score tracking the Objective and entity specified
|
|
|
|
+ * @throws IllegalArgumentException if entity is null
|
|
|
|
+ * @throws IllegalStateException if this objective has been unregistered
|
|
|
|
+ */
|
|
|
|
+ @NotNull Score getScoreFor(@NotNull org.bukkit.entity.Entity entity) throws IllegalArgumentException, IllegalStateException;
|
2023-08-06 02:21:59 +02:00
|
|
|
+ // Paper end - improve scoreboard entries
|
2021-12-22 01:45:18 +01:00
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/scoreboard/Scoreboard.java b/src/main/java/org/bukkit/scoreboard/Scoreboard.java
|
2024-12-03 15:47:48 +01:00
|
|
|
index 1cba9a96cc7efce2a4394add33e4c0369f94be31..81ca0c62ce32204681fcb8fd751d12b4fb0aeb97 100644
|
2021-12-22 01:45:18 +01:00
|
|
|
--- a/src/main/java/org/bukkit/scoreboard/Scoreboard.java
|
|
|
|
+++ b/src/main/java/org/bukkit/scoreboard/Scoreboard.java
|
2024-04-26 02:46:17 +02:00
|
|
|
@@ -215,9 +215,8 @@ public interface Scoreboard {
|
2023-08-06 02:21:59 +02:00
|
|
|
* @param player the player whose scores are being retrieved
|
2021-12-22 01:45:18 +01:00
|
|
|
* @return immutable set of all scores tracked for the player
|
|
|
|
* @see #getScores(String)
|
|
|
|
- * @deprecated Scoreboards can contain entries that aren't players
|
|
|
|
*/
|
2024-12-03 15:47:48 +01:00
|
|
|
- @Deprecated(since = "1.7.8")
|
|
|
|
+ // @Deprecated(since = "1.7.8") // Paper
|
2021-12-22 01:45:18 +01:00
|
|
|
@NotNull
|
2023-08-06 02:21:59 +02:00
|
|
|
Set<Score> getScores(@NotNull OfflinePlayer player);
|
2021-12-22 01:45:18 +01:00
|
|
|
|
2024-04-26 02:46:17 +02:00
|
|
|
@@ -235,9 +234,8 @@ public interface Scoreboard {
|
2023-08-06 02:21:59 +02:00
|
|
|
*
|
2021-12-22 01:45:18 +01:00
|
|
|
* @param player the player to drop all current scores for
|
|
|
|
* @see #resetScores(String)
|
|
|
|
- * @deprecated Scoreboards can contain entries that aren't players
|
|
|
|
*/
|
2024-12-03 15:47:48 +01:00
|
|
|
- @Deprecated(since = "1.7.8")
|
|
|
|
+ // @Deprecated(since = "1.7.8") // Paper
|
2023-08-06 02:21:59 +02:00
|
|
|
void resetScores(@NotNull OfflinePlayer player);
|
2021-12-22 01:45:18 +01:00
|
|
|
|
|
|
|
/**
|
2024-04-26 02:46:17 +02:00
|
|
|
@@ -253,9 +251,8 @@ public interface Scoreboard {
|
2023-08-06 02:21:59 +02:00
|
|
|
* @param player the player to search for
|
2021-12-22 01:45:18 +01:00
|
|
|
* @return the player's Team or null if the player is not on a team
|
|
|
|
* @see #getEntryTeam(String)
|
|
|
|
- * @deprecated Scoreboards can contain entries that aren't players
|
|
|
|
*/
|
2024-12-03 15:47:48 +01:00
|
|
|
- @Deprecated(since = "1.8.6")
|
|
|
|
+ // @Deprecated(since = "1.8.6") // Paper
|
2021-12-22 01:45:18 +01:00
|
|
|
@Nullable
|
2023-08-06 02:21:59 +02:00
|
|
|
Team getPlayerTeam(@NotNull OfflinePlayer player);
|
2021-12-22 01:45:18 +01:00
|
|
|
|
2024-04-26 02:46:17 +02:00
|
|
|
@@ -320,4 +317,35 @@ public interface Scoreboard {
|
2023-08-06 02:21:59 +02:00
|
|
|
* @param slot the slot to remove objectives
|
2021-12-22 01:45:18 +01:00
|
|
|
*/
|
2023-08-06 02:21:59 +02:00
|
|
|
void clearSlot(@NotNull DisplaySlot slot);
|
2021-12-22 01:45:18 +01:00
|
|
|
+
|
2023-08-06 02:21:59 +02:00
|
|
|
+ // Paper start - improve scoreboard entries
|
2021-12-22 01:45:18 +01:00
|
|
|
+ /**
|
2023-03-31 06:09:13 +02:00
|
|
|
+ * Gets all scores for an entity on this Scoreboard
|
2021-12-22 01:45:18 +01:00
|
|
|
+ *
|
|
|
|
+ * @param entity the entity whose scores are being retrieved
|
|
|
|
+ * @return immutable set of all scores tracked for the entity
|
|
|
|
+ * @throws IllegalArgumentException if entity is null
|
|
|
|
+ * @see #getScores(String)
|
|
|
|
+ */
|
|
|
|
+ @NotNull Set<Score> getScoresFor(@NotNull org.bukkit.entity.Entity entity) throws IllegalArgumentException;
|
|
|
|
+
|
|
|
|
+ /**
|
2023-03-31 06:09:13 +02:00
|
|
|
+ * Removes all scores for an entity on this Scoreboard
|
2021-12-22 01:45:18 +01:00
|
|
|
+ *
|
|
|
|
+ * @param entity the entity to drop all current scores for
|
|
|
|
+ * @throws IllegalArgumentException if entity is null
|
|
|
|
+ * @see #resetScores(String)
|
|
|
|
+ */
|
|
|
|
+ void resetScoresFor(@NotNull org.bukkit.entity.Entity entity) throws IllegalArgumentException;
|
|
|
|
+
|
|
|
|
+ /**
|
2023-03-31 06:09:13 +02:00
|
|
|
+ * Gets an entity's Team on this Scoreboard
|
2021-12-22 01:45:18 +01:00
|
|
|
+ *
|
|
|
|
+ * @param entity the entity to search for
|
|
|
|
+ * @return the entity's Team or null if the entity is not on a team
|
|
|
|
+ * @throws IllegalArgumentException if entity is null
|
|
|
|
+ * @see #getEntryTeam(String)
|
|
|
|
+ */
|
|
|
|
+ @Nullable Team getEntityTeam(@NotNull org.bukkit.entity.Entity entity) throws IllegalArgumentException;
|
2023-08-06 02:21:59 +02:00
|
|
|
+ // Paper end - improve scoreboard entries
|
2021-12-22 01:45:18 +01:00
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java
|
2024-12-03 15:47:48 +01:00
|
|
|
index 38deee00cfe2f6803070e98cd9ded95d859bf8e1..c500de6ed19bdf732f7bedbedb19a4b37ca343f8 100644
|
2021-12-22 01:45:18 +01:00
|
|
|
--- a/src/main/java/org/bukkit/scoreboard/Team.java
|
|
|
|
+++ b/src/main/java/org/bukkit/scoreboard/Team.java
|
2023-11-04 21:50:56 +01:00
|
|
|
@@ -295,9 +295,8 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience {
|
2023-08-06 02:21:59 +02:00
|
|
|
* @param player the player to add
|
2021-12-22 01:45:18 +01:00
|
|
|
* @throws IllegalStateException if this team has been unregistered
|
|
|
|
* @see #addEntry(String)
|
|
|
|
- * @deprecated Teams can contain entries that aren't players
|
|
|
|
*/
|
2024-12-03 15:47:48 +01:00
|
|
|
- @Deprecated(since = "1.8.6")
|
|
|
|
+ // @Deprecated(since = "1.8.6") // Paper
|
2023-08-06 02:21:59 +02:00
|
|
|
void addPlayer(@NotNull OfflinePlayer player);
|
2021-12-22 01:45:18 +01:00
|
|
|
|
|
|
|
/**
|
2023-11-04 21:50:56 +01:00
|
|
|
@@ -317,9 +316,8 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience {
|
2023-08-06 02:21:59 +02:00
|
|
|
* @return if the player was on this team
|
2021-12-22 01:45:18 +01:00
|
|
|
* @throws IllegalStateException if this team has been unregistered
|
|
|
|
* @see #removeEntry(String)
|
|
|
|
- * @deprecated Teams can contain entries that aren't players
|
|
|
|
*/
|
2024-12-03 15:47:48 +01:00
|
|
|
- @Deprecated(since = "1.8.6")
|
|
|
|
+ // @Deprecated(since = "1.8.6") // Paper
|
2023-08-06 02:21:59 +02:00
|
|
|
boolean removePlayer(@NotNull OfflinePlayer player);
|
2021-12-22 01:45:18 +01:00
|
|
|
|
|
|
|
/**
|
2023-11-04 21:50:56 +01:00
|
|
|
@@ -345,9 +343,8 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience {
|
2023-08-06 02:21:59 +02:00
|
|
|
* @return true if the player is a member of this team
|
2021-12-22 01:45:18 +01:00
|
|
|
* @throws IllegalStateException if this team has been unregistered
|
|
|
|
* @see #hasEntry(String)
|
|
|
|
- * @deprecated Teams can contain entries that aren't players
|
|
|
|
*/
|
2024-12-03 15:47:48 +01:00
|
|
|
- @Deprecated(since = "1.8.6")
|
|
|
|
+ // @Deprecated(since = "1.8.6") // Paper
|
2023-08-06 02:21:59 +02:00
|
|
|
boolean hasPlayer(@NotNull OfflinePlayer player);
|
2021-12-22 01:45:18 +01:00
|
|
|
/**
|
|
|
|
* Checks to see if the specified entry is a member of this team.
|
2023-11-04 21:50:56 +01:00
|
|
|
@@ -377,6 +374,42 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience {
|
2021-12-22 01:45:18 +01:00
|
|
|
*/
|
2023-08-06 02:21:59 +02:00
|
|
|
void setOption(@NotNull Option option, @NotNull OptionStatus status);
|
2021-12-22 01:45:18 +01:00
|
|
|
|
2023-08-06 02:21:59 +02:00
|
|
|
+ // Paper start - improve scoreboard entries
|
2021-12-22 01:45:18 +01:00
|
|
|
+ /**
|
|
|
|
+ * This puts the specified entity onto this team for the scoreboard.
|
|
|
|
+ * <p>
|
|
|
|
+ * This will remove the entity from any other team on the scoreboard.
|
|
|
|
+ *
|
|
|
|
+ * @param entity the entity to add
|
|
|
|
+ * @throws IllegalArgumentException if entity is null
|
|
|
|
+ * @throws IllegalStateException if this team has been unregistered
|
|
|
|
+ * @see #addEntry(String)
|
|
|
|
+ */
|
|
|
|
+ void addEntity(@NotNull org.bukkit.entity.Entity entity) throws IllegalStateException, IllegalArgumentException;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Removes the entity from this team.
|
|
|
|
+ *
|
|
|
|
+ * @param entity the entity to remove
|
|
|
|
+ * @return if the entity was on this team
|
|
|
|
+ * @throws IllegalArgumentException if entity is null
|
|
|
|
+ * @throws IllegalStateException if this team has been unregistered
|
|
|
|
+ * @see #removeEntry(String)
|
|
|
|
+ */
|
|
|
|
+ boolean removeEntity(@NotNull org.bukkit.entity.Entity entity) throws IllegalStateException, IllegalArgumentException;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Checks to see if the specified entity is a member of this team.
|
|
|
|
+ *
|
|
|
|
+ * @param entity the entity to search for
|
|
|
|
+ * @return true if the entity is a member of this team
|
|
|
|
+ * @throws IllegalArgumentException if entity is null
|
|
|
|
+ * @throws IllegalStateException if this team has been unregistered
|
|
|
|
+ * @see #hasEntry(String)
|
|
|
|
+ */
|
|
|
|
+ boolean hasEntity(@NotNull org.bukkit.entity.Entity entity) throws IllegalStateException, IllegalArgumentException;
|
2023-08-06 02:21:59 +02:00
|
|
|
+ // Paper end - improve scoreboard entries
|
2021-12-22 01:45:18 +01:00
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Represents an option which may be applied to this team.
|
|
|
|
*/
|