001 package org.bukkit.scoreboard;
002
003 import org.bukkit.OfflinePlayer;
004
005 /**
006 * A score entry for an {@link #getEntry() entry} on an {@link
007 * #getObjective() objective}. Changing this will not affect any other
008 * objective or scoreboard.
009 */
010 public interface Score {
011
012 /**
013 * Gets the OfflinePlayer being tracked by this Score
014 *
015 * @return this Score's tracked player
016 * @deprecated Scoreboards can contain entries that aren't players
017 * @see #getEntry()
018 */
019 @Deprecated
020 OfflinePlayer getPlayer();
021
022 /**
023 * Gets the entry being tracked by this Score
024 *
025 * @return this Score's tracked entry
026 */
027 String getEntry();
028
029 /**
030 * Gets the Objective being tracked by this Score
031 *
032 * @return this Score's tracked objective
033 */
034 Objective getObjective();
035
036 /**
037 * Gets the current score
038 *
039 * @return the current score
040 * @throws IllegalStateException if the associated objective has been
041 * unregistered
042 */
043 int getScore() throws IllegalStateException;
044
045 /**
046 * Sets the current score.
047 *
048 * @param score New score
049 * @throws IllegalStateException if the associated objective has been
050 * unregistered
051 */
052 void setScore(int score) throws IllegalStateException;
053
054 /**
055 * Gets the scoreboard for the associated objective.
056 *
057 * @return the owning objective's scoreboard, or null if it has been
058 * {@link Objective#unregister() unregistered}
059 */
060 Scoreboard getScoreboard();
061 }