001 package org.bukkit.scoreboard; 002 003 import java.util.Set; 004 005 import org.bukkit.OfflinePlayer; 006 007 /** 008 * A scoreboard 009 */ 010 public interface Scoreboard { 011 012 /** 013 * Registers an Objective on this Scoreboard 014 * 015 * @param name Name of the Objective 016 * @param criteria Criteria for the Objective 017 * @return The registered Objective 018 * @throws IllegalArgumentException if name is null 019 * @throws IllegalArgumentException if criteria is null 020 * @throws IllegalArgumentException if an objective by that name already 021 * exists 022 */ 023 Objective registerNewObjective(String name, String criteria) throws IllegalArgumentException; 024 025 /** 026 * Gets an Objective on this Scoreboard by name 027 * 028 * @param name Name of the Objective 029 * @return the Objective or null if it does not exist 030 * @throws IllegalArgumentException if name is null 031 */ 032 Objective getObjective(String name) throws IllegalArgumentException; 033 034 /** 035 * Gets all Objectives of a Criteria on the Scoreboard 036 * 037 * @param criteria Criteria to search by 038 * @return an immutable set of Objectives using the specified Criteria 039 */ 040 Set<Objective> getObjectivesByCriteria(String criteria) throws IllegalArgumentException; 041 042 /** 043 * Gets all Objectives on this Scoreboard 044 * 045 * @return An immutable set of all Objectives on this Scoreboard 046 */ 047 Set<Objective> getObjectives(); 048 049 /** 050 * Gets the Objective currently displayed in a DisplaySlot on this 051 * Scoreboard 052 * 053 * @param slot The DisplaySlot 054 * @return the Objective currently displayed or null if nothing is 055 * displayed in that DisplaySlot 056 * @throws IllegalArgumentException if slot is null 057 */ 058 Objective getObjective(DisplaySlot slot) throws IllegalArgumentException; 059 060 /** 061 * Gets all scores for a player on this Scoreboard 062 * 063 * @param player the player whose scores are being retrieved 064 * @return immutable set of all scores tracked for the player 065 * @throws IllegalArgumentException if player is null 066 * @deprecated Scoreboards can contain entries that aren't players 067 * @see #getScores(String) 068 */ 069 @Deprecated 070 Set<Score> getScores(OfflinePlayer player) throws IllegalArgumentException; 071 072 /** 073 * Gets all scores for an entry on this Scoreboard 074 * 075 * @param entry the entry whose scores are being retrieved 076 * @return immutable set of all scores tracked for the entry 077 * @throws IllegalArgumentException if entry is null 078 */ 079 Set<Score> getScores(String entry) throws IllegalArgumentException; 080 081 /** 082 * Removes all scores for a player on this Scoreboard 083 * 084 * @param player the player to drop all current scores for 085 * @throws IllegalArgumentException if player is null 086 * @deprecated Scoreboards can contain entries that aren't players 087 * @see #resetScores(String) 088 */ 089 @Deprecated 090 void resetScores(OfflinePlayer player) throws IllegalArgumentException; 091 092 /** 093 * Removes all scores for an entry on this Scoreboard 094 * 095 * @param entry the entry to drop all current scores for 096 * @throws IllegalArgumentException if entry is null 097 */ 098 void resetScores(String entry) throws IllegalArgumentException; 099 100 /** 101 * Gets a player's Team on this Scoreboard 102 * 103 * @param player the player to search for 104 * @return the player's Team or null if the player is not on a team 105 * @throws IllegalArgumentException if player is null 106 */ 107 Team getPlayerTeam(OfflinePlayer player) throws IllegalArgumentException; 108 109 /** 110 * Gets a Team by name on this Scoreboard 111 * 112 * @param teamName Team name 113 * @return the matching Team or null if no matches 114 * @throws IllegalArgumentException if teamName is null 115 */ 116 Team getTeam(String teamName) throws IllegalArgumentException; 117 118 /** 119 * Gets all teams on this Scoreboard 120 * 121 * @return an immutable set of Teams 122 */ 123 Set<Team> getTeams(); 124 125 /** 126 * Registers a Team on this Scoreboard 127 * 128 * @param name Team name 129 * @return registered Team 130 * @throws IllegalArgumentException if name is null 131 * @throws IllegalArgumentException if team by that name already exists 132 */ 133 Team registerNewTeam(String name) throws IllegalArgumentException; 134 135 /** 136 * Gets all players tracked by this Scoreboard 137 * 138 * @return immutable set of all tracked players 139 * @deprecated Scoreboards can contain entries that aren't players 140 * @see #getEntries() 141 */ 142 @Deprecated 143 Set<OfflinePlayer> getPlayers(); 144 145 /** 146 * Gets all entries tracked by this Scoreboard 147 * 148 * @return immutable set of all tracked entries 149 */ 150 Set<String> getEntries(); 151 152 /** 153 * Clears any objective in the specified slot. 154 * 155 * @param slot the slot to remove objectives 156 * @throws IllegalArgumentException if slot is null 157 */ 158 void clearSlot(DisplaySlot slot) throws IllegalArgumentException; 159 }