From d24844cdd9ed1568412ebc2ad7e6b6157ac2c26a Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 12 May 2015 22:34:21 -0400 Subject: Add ability to add a string to a scoreboard instead of a player --- .../java/org/bukkit/scoreboard/Scoreboard.java | 12 ++++ src/main/java/org/bukkit/scoreboard/Team.java | 66 +++++++++++++++++++--- 2 files changed, 70 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/main/java/org/bukkit/scoreboard/Scoreboard.java b/src/main/java/org/bukkit/scoreboard/Scoreboard.java index d244a7f4..70086109 100644 --- a/src/main/java/org/bukkit/scoreboard/Scoreboard.java +++ b/src/main/java/org/bukkit/scoreboard/Scoreboard.java @@ -103,9 +103,21 @@ public interface Scoreboard { * @param player the player to search for * @return the player's Team or null if the player is not on a team * @throws IllegalArgumentException if player is null + * @deprecated Scoreboards can contain entries that aren't players + * @see #getEntryTeam(String) */ + @Deprecated Team getPlayerTeam(OfflinePlayer player) throws IllegalArgumentException; + /** + * Gets a entries Team on this Scoreboard + * + * @param entry the entry to search for + * @return the entries Team or null if the entry is not on a team + * @throws IllegalArgumentException if entry is null + */ + Team getEntryTeam(String entry) throws IllegalArgumentException; + /** * Gets a Team by name on this Scoreboard * diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java index e6d14428..0fdcebd9 100644 --- a/src/main/java/org/bukkit/scoreboard/Team.java +++ b/src/main/java/org/bukkit/scoreboard/Team.java @@ -21,7 +21,7 @@ public interface Team { String getName() throws IllegalStateException; /** - * Gets the name displayed to players for this team + * Gets the name displayed to entries for this team * * @return Team display name * @throws IllegalStateException if this team has been unregistered @@ -29,7 +29,7 @@ public interface Team { String getDisplayName() throws IllegalStateException; /** - * Sets the name displayed to players for this team + * Sets the name displayed to entries for this team * * @param displayName New display name * @throws IllegalArgumentException if displayName is longer than 32 @@ -39,7 +39,7 @@ public interface Team { void setDisplayName(String displayName) throws IllegalStateException, IllegalArgumentException; /** - * Gets the prefix prepended to the display of players on this team. + * Gets the prefix prepended to the display of entries on this team. * * @return Team prefix * @throws IllegalStateException if this team has been unregistered @@ -47,7 +47,7 @@ public interface Team { String getPrefix() throws IllegalStateException; /** - * Sets the prefix prepended to the display of players on this team. + * Sets the prefix prepended to the display of entries on this team. * * @param prefix New prefix * @throws IllegalArgumentException if prefix is null @@ -58,7 +58,7 @@ public interface Team { void setPrefix(String prefix) throws IllegalStateException, IllegalArgumentException; /** - * Gets the suffix appended to the display of players on this team. + * Gets the suffix appended to the display of entries on this team. * * @return the team's current suffix * @throws IllegalStateException if this team has been unregistered @@ -66,7 +66,7 @@ public interface Team { String getSuffix() throws IllegalStateException; /** - * Sets the suffix appended to the display of players on this team. + * Sets the suffix appended to the display of entries on this team. * * @param suffix the new suffix for this team. * @throws IllegalArgumentException if suffix is null @@ -130,14 +130,25 @@ public interface Team { * Gets the Set of players on the team * * @return players on the team - * @throws IllegalStateException if this team has been unregistered + * @throws IllegalStateException if this team has been unregistered\ + * @deprecated Teams can contain entries that aren't players + * @see #getEntries() */ + @Deprecated Set getPlayers() throws IllegalStateException; + /** + * Gets the Set of entries on the team + * + * @return entries on the team + * @throws IllegalStateException if this entries has been unregistered\ + */ + Set getEntries() throws IllegalStateException; + /** * Gets the size of the team * - * @return number of players on the team + * @return number of entries on the team * @throws IllegalStateException if this team has been unregistered */ int getSize() throws IllegalStateException; @@ -158,9 +169,23 @@ public interface Team { * @param player the player to add * @throws IllegalArgumentException if player is null * @throws IllegalStateException if this team has been unregistered + * @deprecated Teams can contain entries that aren't players + * @see #addEntry(String) */ + @Deprecated void addPlayer(OfflinePlayer player) throws IllegalStateException, IllegalArgumentException; + /** + * This puts the specified entry onto this team for the scoreboard. + *

+ * This will remove the entry from any other team on the scoreboard. + * + * @param entry the entry to add + * @throws IllegalArgumentException if entry is null + * @throws IllegalStateException if this team has been unregistered + */ + void addEntry(String entry) throws IllegalStateException, IllegalArgumentException; + /** * Removes the player from this team. * @@ -168,9 +193,22 @@ public interface Team { * @return if the player was on this team * @throws IllegalArgumentException if player is null * @throws IllegalStateException if this team has been unregistered + * @deprecated Teams can contain entries that aren't players + * @see #removeEntry(String) */ + @Deprecated boolean removePlayer(OfflinePlayer player) throws IllegalStateException, IllegalArgumentException; + /** + * Removes the entry from this team. + * + * @param entry the entry to remove + * @throws IllegalArgumentException if entry is null + * @throws IllegalStateException if this team has been unregistered + * @return if the entry was a part of this team + */ + boolean removeEntry(String entry) throws IllegalStateException, IllegalArgumentException; + /** * Unregisters this team from the Scoreboard * @@ -185,6 +223,18 @@ public interface Team { * @return true if the player is a member of this team * @throws IllegalArgumentException if player is null * @throws IllegalStateException if this team has been unregistered + * @deprecated Teams can contain entries that aren't players + * @see #hasEntry(String) */ + @Deprecated boolean hasPlayer(OfflinePlayer player) throws IllegalArgumentException, IllegalStateException; + /** + * Checks to see if the specified entry is a member of this team. + * + * @param entry the entry to search for + * @return true if the entry is a member of this team + * @throws IllegalArgumentException if entry is null + * @throws IllegalStateException if this team has been unregistered + */ + boolean hasEntry(String entry) throws IllegalArgumentException,IllegalStateException; } -- cgit v1.2.3