diff --git a/patches/org/bukkit/scoreboard/Team.java.patch b/patches/org/bukkit/scoreboard/Team.java.patch new file mode 100644 index 0000000..c279057 --- /dev/null +++ b/patches/org/bukkit/scoreboard/Team.java.patch @@ -0,0 +1,52 @@ +--- ../src-base/minecraft/org/bukkit/scoreboard/Team.java ++++ ../src-work/minecraft/org/bukkit/scoreboard/Team.java +@@ -146,6 +146,17 @@ + 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. + * + * @param player the player to remove +@@ -156,6 +167,16 @@ + 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 +@@ -171,4 +192,14 @@ + * @throws IllegalStateException if this team has been unregistered + */ + 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; + } diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java index 4cee541..072d239 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java @@ -109,28 +109,45 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { public void addPlayer(OfflinePlayer player) throws IllegalStateException, IllegalArgumentException { Validate.notNull(player, "OfflinePlayer cannot be null"); + this.addEntry(player.getName()); + } + + @Override + public void addEntry(String player) throws IllegalStateException,IllegalArgumentException{ + Validate.notNull(player, "PlayerName cannot be null"); CraftScoreboard scoreboard = checkState(); - scoreboard.board.func_151392_a(player.getName(), team.getRegisteredName()); + scoreboard.board.func_151392_a(player, team.getRegisteredName()); } public boolean removePlayer(OfflinePlayer player) throws IllegalStateException, IllegalArgumentException { - Validate.notNull(player, "OfflinePlayer cannot be null"); + return this.removeEntry(player.getName()); + } + + @Override + public boolean removeEntry(String player) throws IllegalStateException,IllegalArgumentException{ + Validate.notNull(player, "PlayerName cannot be null"); CraftScoreboard scoreboard = checkState(); - if (!team.getMembershipCollection().contains(player.getName())) { + if (!team.getMembershipCollection().contains(player)) { return false; } - scoreboard.board.removePlayerFromTeam(player.getName(), team); + scoreboard.board.removePlayerFromTeam(player, team); return true; } public boolean hasPlayer(OfflinePlayer player) throws IllegalArgumentException, IllegalStateException { Validate.notNull(player, "OfflinePlayer cannot be null"); + return this.hasEntry(player.getName()); + } + + @Override + public boolean hasEntry(String entry) throws IllegalArgumentException,IllegalStateException{ + Validate.notNull(entry, "PlayerName cannot be null"); CraftScoreboard scoreboard = checkState(); - return team.getMembershipCollection().contains(player.getName()); + return team.getMembershipCollection().contains(entry); } @Override