public class HiscorePlayer
extends java.lang.Object
HiscorePlayer
object represents
a single player on the high scores.
Example use: Retrieving a player from the standard high scores and printing the results to the console.
new HiscorePlayer("Zezima").lookup(GameMode.STANDARD, new LookupCallback() { public void done(HiscorePlayer player) { // If the lookup was successful, iterate through the levels if(player != null){ for(Level level : player.getLevels()){ // Do something. } } else{ // The lookup failed. } } });
Modifier and Type | Class | Description |
---|---|---|
static class |
HiscorePlayer.Level |
Class representing a single level.
|
static interface |
HiscorePlayer.LookupCallback |
Callback interface for methods to be invoked when retrieving a player from the high scores.
|
Constructor | Description |
---|---|
HiscorePlayer() |
Default constructor.
|
HiscorePlayer(java.lang.String playerName) |
Constructs a new HiscorePlayer with a specified name.
|
Modifier and Type | Method | Description |
---|---|---|
GameMode |
getLastRetrievedGameMode() |
Which game mode this player's high scores were last retrieved from.
|
HiscorePlayer.Level |
getLevel(Skill skill) |
Gets this player's level for a specific skill.
|
java.util.Collection<HiscorePlayer.Level> |
getLevels() |
Returns a collection of this player's levels.
|
java.util.LinkedHashMap<Skill,HiscorePlayer.Level> |
getLevelsMap() |
Returns a mapping of skills to levels.
|
java.lang.String |
getName() |
Returns this player's name.
|
boolean |
isBusy() |
Returns whether or not this player is currently being retrieved.
|
boolean |
isRetrieved() |
Returns whether or not this player has been retrieved.
|
void |
lookup(GameMode gameMode,
HiscorePlayer.LookupCallback callback) |
Asynchronously looks up the player on the high scores.
|
HiscorePlayer |
setName(java.lang.String playerName) |
Changes this player's name.
|
public HiscorePlayer(java.lang.String playerName)
playerName
- The player's namepublic HiscorePlayer()
public void lookup(GameMode gameMode, HiscorePlayer.LookupCallback callback)
gameMode
- The game mode to use. If null, defaults to standard.callback
- The callback to invoke upon completion.public java.util.LinkedHashMap<Skill,HiscorePlayer.Level> getLevelsMap()
public java.util.Collection<HiscorePlayer.Level> getLevels()
public HiscorePlayer.Level getLevel(Skill skill)
skill
- The skill to get the level forpublic boolean isRetrieved()
public GameMode getLastRetrievedGameMode()
public boolean isBusy()
public HiscorePlayer setName(java.lang.String playerName)
playerName
- The player's new name.public java.lang.String getName()