001 package org.bukkit.scoreboard;
002
003 import java.util.Set;
004
005 import org.bukkit.OfflinePlayer;
006 import org.bukkit.potion.PotionEffectType;
007
008 /**
009 * A team on a scoreboard that has a common display theme and other
010 * properties. This team is only relevant to the display of the associated
011 * {@link #getScoreboard() scoreboard}.
012 */
013 public interface Team {
014
015 /**
016 * Gets the name of this Team
017 *
018 * @return Objective name
019 * @throws IllegalStateException if this team has been unregistered
020 */
021 String getName() throws IllegalStateException;
022
023 /**
024 * Gets the name displayed to players for this team
025 *
026 * @return Team display name
027 * @throws IllegalStateException if this team has been unregistered
028 */
029 String getDisplayName() throws IllegalStateException;
030
031 /**
032 * Sets the name displayed to players for this team
033 *
034 * @param displayName New display name
035 * @throws IllegalArgumentException if displayName is longer than 32
036 * characters.
037 * @throws IllegalStateException if this team has been unregistered
038 */
039 void setDisplayName(String displayName) throws IllegalStateException, IllegalArgumentException;
040
041 /**
042 * Gets the prefix prepended to the display of players on this team.
043 *
044 * @return Team prefix
045 * @throws IllegalStateException if this team has been unregistered
046 */
047 String getPrefix() throws IllegalStateException;
048
049 /**
050 * Sets the prefix prepended to the display of players on this team.
051 *
052 * @param prefix New prefix
053 * @throws IllegalArgumentException if prefix is null
054 * @throws IllegalArgumentException if prefix is longer than 16
055 * characters
056 * @throws IllegalStateException if this team has been unregistered
057 */
058 void setPrefix(String prefix) throws IllegalStateException, IllegalArgumentException;
059
060 /**
061 * Gets the suffix appended to the display of players on this team.
062 *
063 * @return the team's current suffix
064 * @throws IllegalStateException if this team has been unregistered
065 */
066 String getSuffix() throws IllegalStateException;
067
068 /**
069 * Sets the suffix appended to the display of players on this team.
070 *
071 * @param suffix the new suffix for this team.
072 * @throws IllegalArgumentException if suffix is null
073 * @throws IllegalArgumentException if suffix is longer than 16
074 * characters
075 * @throws IllegalStateException if this team has been unregistered
076 */
077 void setSuffix(String suffix) throws IllegalStateException, IllegalArgumentException;
078
079 /**
080 * Gets the team friendly fire state
081 *
082 * @return true if friendly fire is enabled
083 * @throws IllegalStateException if this team has been unregistered
084 */
085 boolean allowFriendlyFire() throws IllegalStateException;
086
087 /**
088 * Sets the team friendly fire state
089 *
090 * @param enabled true if friendly fire is to be allowed
091 * @throws IllegalStateException if this team has been unregistered
092 */
093 void setAllowFriendlyFire(boolean enabled) throws IllegalStateException;
094
095 /**
096 * Gets the team's ability to see {@link PotionEffectType#INVISIBILITY
097 * invisible} teammates.
098 *
099 * @return true if team members can see invisible members
100 * @throws IllegalStateException if this team has been unregistered
101 */
102 boolean canSeeFriendlyInvisibles() throws IllegalStateException;
103
104 /**
105 * Sets the team's ability to see {@link PotionEffectType#INVISIBILITY
106 * invisible} teammates.
107 *
108 * @param enabled true if invisible teammates are to be visible
109 * @throws IllegalStateException if this team has been unregistered
110 */
111 void setCanSeeFriendlyInvisibles(boolean enabled) throws IllegalStateException;
112
113 /**
114 * Gets the Set of players on the team
115 *
116 * @return players on the team
117 * @throws IllegalStateException if this team has been unregistered
118 */
119 Set<OfflinePlayer> getPlayers() throws IllegalStateException;
120
121 /**
122 * Gets the size of the team
123 *
124 * @return number of players on the team
125 * @throws IllegalStateException if this team has been unregistered
126 */
127 int getSize() throws IllegalStateException;
128
129 /**
130 * Gets the Scoreboard to which this team is attached
131 *
132 * @return Owning scoreboard, or null if this team has been {@link
133 * #unregister() unregistered}
134 */
135 Scoreboard getScoreboard();
136
137 /**
138 * This puts the specified player onto this team for the scoreboard.
139 * <p>
140 * This will remove the player from any other team on the scoreboard.
141 *
142 * @param player the player to add
143 * @throws IllegalArgumentException if player is null
144 * @throws IllegalStateException if this team has been unregistered
145 */
146 void addPlayer(OfflinePlayer player) throws IllegalStateException, IllegalArgumentException;
147
148 /**
149 * Removes the player from this team.
150 *
151 * @param player the player to remove
152 * @return if the player was on this team
153 * @throws IllegalArgumentException if player is null
154 * @throws IllegalStateException if this team has been unregistered
155 */
156 boolean removePlayer(OfflinePlayer player) throws IllegalStateException, IllegalArgumentException;
157
158 /**
159 * Unregisters this team from the Scoreboard
160 *
161 * @throws IllegalStateException if this team has been unregistered
162 */
163 void unregister() throws IllegalStateException;
164
165 /**
166 * Checks to see if the specified player is a member of this team.
167 *
168 * @param player the player to search for
169 * @return true if the player is a member of this team
170 * @throws IllegalArgumentException if player is null
171 * @throws IllegalStateException if this team has been unregistered
172 */
173 boolean hasPlayer(OfflinePlayer player) throws IllegalArgumentException, IllegalStateException;
174 }