Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
Objective.java
1 package org.bukkit.scoreboard;
2 
4 
5 /**
6  * An objective on a scoreboard that can show scores specific to entries. This
7  * objective is only relevant to the display of the associated {@link
8  * #getScoreboard() scoreboard}.
9  */
10 public interface Objective {
11 
12  /**
13  * Gets the name of this Objective
14  *
15  * @return this objective'ss name
16  * @throws IllegalStateException if this objective has been unregistered
17  */
18  String getName() throws IllegalStateException;
19 
20  /**
21  * Gets the name displayed to players for this objective
22  *
23  * @return this objective's display name
24  * @throws IllegalStateException if this objective has been unregistered
25  */
26  String getDisplayName() throws IllegalStateException;
27 
28  /**
29  * Sets the name displayed to players for this objective.
30  *
31  * @param displayName Display name to set
32  * @throws IllegalStateException if this objective has been unregistered
33  * @throws IllegalArgumentException if displayName is null
34  * @throws IllegalArgumentException if displayName is longer than 32
35  * characters.
36  */
37  void setDisplayName(String displayName) throws IllegalStateException, IllegalArgumentException;
38 
39  /**
40  * Gets the criteria this objective tracks.
41  *
42  * @return this objective's criteria
43  * @throws IllegalStateException if this objective has been unregistered
44  */
45  String getCriteria() throws IllegalStateException;
46 
47  /**
48  * Gets if the objective's scores can be modified directly by a plugin.
49  *
50  * @return true if scores are modifiable
51  * @throws IllegalStateException if this objective has been unregistered
52  * @see Criterias#HEALTH
53  */
54  boolean isModifiable() throws IllegalStateException;
55 
56  /**
57  * Gets the scoreboard to which this objective is attached.
58  *
59  * @return Owning scoreboard, or null if it has been {@link #unregister()
60  * unregistered}
61  */
63 
64  /**
65  * Unregisters this objective from the {@link Scoreboard scoreboard.}
66  *
67  * @throws IllegalStateException if this objective has been unregistered
68  */
69  void unregister() throws IllegalStateException;
70 
71  /**
72  * Sets this objective to display on the specified slot for the
73  * scoreboard, removing it from any other display slot.
74  *
75  * @param slot display slot to change, or null to not display
76  * @throws IllegalStateException if this objective has been unregistered
77  */
78  void setDisplaySlot(DisplaySlot slot) throws IllegalStateException;
79 
80  /**
81  * Gets the display slot this objective is displayed at.
82  *
83  * @return the display slot for this objective, or null if not displayed
84  * @throws IllegalStateException if this objective has been unregistered
85  */
86  DisplaySlot getDisplaySlot() throws IllegalStateException;
87 
88  /**
89  * Gets a player's Score for an Objective on this Scoreboard
90  *
91  * @param player Player for the Score
92  * @return Score tracking the Objective and player specified
93  * @throws IllegalArgumentException if player is null
94  * @throws IllegalStateException if this objective has been unregistered
95  * @deprecated Scoreboards can contain entries that aren't players
96  * @see #getScore(String)
97  */
98  @Deprecated
99  Score getScore(OfflinePlayer player) throws IllegalArgumentException, IllegalStateException;
100 
101  /**
102  * Gets an entry's Score for an Objective on this Scoreboard.
103  *
104  * @param entry Entry for the Score
105  * @return Score tracking the Objective and entry specified
106  * @throws IllegalArgumentException if entry is null
107  * @throws IllegalStateException if this objective has been unregistered
108  */
109  Score getScore(String entry) throws IllegalArgumentException, IllegalStateException;
110 }
Score getScore(OfflinePlayer player)
void setDisplayName(String displayName)
void setDisplaySlot(DisplaySlot slot)