summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt <mattbdev@outlook.com>2015-05-12 22:34:21 -0400
committermd_5 <git@md-5.net>2015-05-29 19:33:47 +1000
commitd24844cdd9ed1568412ebc2ad7e6b6157ac2c26a (patch)
tree6afa788a637c731fd87ef7cf403fd20afa19ec85
parent7a6eedb7b3f3f90f2c7797c6107e7f72119872a1 (diff)
downloadbukkit-d24844cdd9ed1568412ebc2ad7e6b6157ac2c26a.tar
bukkit-d24844cdd9ed1568412ebc2ad7e6b6157ac2c26a.tar.gz
bukkit-d24844cdd9ed1568412ebc2ad7e6b6157ac2c26a.tar.lz
bukkit-d24844cdd9ed1568412ebc2ad7e6b6157ac2c26a.tar.xz
bukkit-d24844cdd9ed1568412ebc2ad7e6b6157ac2c26a.zip
Add ability to add a string to a scoreboard instead of a player
-rw-r--r--src/main/java/org/bukkit/scoreboard/Scoreboard.java12
-rw-r--r--src/main/java/org/bukkit/scoreboard/Team.java66
2 files changed, 70 insertions, 8 deletions
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,10 +103,22 @@ 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
*
* @param teamName Team name
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<OfflinePlayer> 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<String> 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,20 +169,47 @@ 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.
+ * <p>
+ * 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.
*
* @param player the player to remove
* @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
*
* @throws IllegalStateException if this team has been unregistered
@@ -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;
}