public class Mojang
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Mojang.ServiceStatus
This enum represents the possible Mojang API servers availability statuses.
|
static class |
Mojang.ServiceType
This enum represents the various portions of the Mojang API.
|
static class |
Mojang.SkinType
This enum represents the skin types "Alex" and "Steve".
|
Constructor and Description |
---|
Mojang()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Mojang |
connect()
Opens the connection with the Mojang API.
|
java.util.Map<java.lang.String,java.lang.Long> |
getNameHistoryOfPlayer(java.lang.String uuid)
Retrieves all the username a certain UUID has had in the past, including the current one.
|
PlayerProfile |
getPlayerProfile(java.lang.String uuid)
Returns the
PlayerProfile object which holds and represents the metadata for a certain account. |
SalesStats |
getSaleStatistics(SalesStats.Options... options)
Returns the official mojang's product sales statistics.
|
java.util.List<java.lang.String> |
getServerBlacklist()
Returns a list of blacklisted hostnames, belonging to servers that were blocked due to Mojang's EULA infringement.
|
Mojang.ServiceStatus |
getStatus(Mojang.ServiceType service)
Retrieves the
status of a portion of the API. |
java.lang.String |
getUUIDOfUsername(java.lang.String username)
Retrieves the current UUID linked to a username.
|
java.lang.String |
getUUIDOfUsername(java.lang.String username,
java.lang.String timestamp)
Retrieves the UUID linked to a username at a certain moment in time.
|
void |
resetSkin(java.lang.String uuid,
java.lang.String token)
Resets the skin to the default.
|
void |
updateAndUpload(java.lang.String uuid,
java.lang.String token,
Mojang.SkinType skinType,
java.lang.String file)
Updates the skin of a player using a URI.
|
void |
updateSkin(java.lang.String uuid,
java.lang.String token,
Mojang.SkinType skinType,
java.lang.String skinUrl)
Updates the skin of a player using a URI.
|
public Mojang connect()
Opens the connection with the Mojang API. Should always be called after creating the API object.
Example:
Mojang api = new Mojang().connect();
public Mojang.ServiceStatus getStatus(Mojang.ServiceType service)
status
of a portion of the API.
Check the enum entries for Mojang.ServiceStatus
for possible response types.service
- the service typepublic java.lang.String getUUIDOfUsername(java.lang.String username)
username
- the usernameString
public java.lang.String getUUIDOfUsername(java.lang.String username, java.lang.String timestamp)
username
- the usernametimestamp
- the Java Timestamp that represents the timeString
public java.util.Map<java.lang.String,java.lang.Long> getNameHistoryOfPlayer(java.lang.String uuid)
uuid
- the UUIDLong
public PlayerProfile getPlayerProfile(java.lang.String uuid)
PlayerProfile
object which holds and represents the metadata for a certain account.uuid
- the UUID of the playerPlayerProfile
object}public void updateSkin(java.lang.String uuid, java.lang.String token, Mojang.SkinType skinType, java.lang.String skinUrl)
uuid
- the UUID of said playertoken
- the token used for API authenticationskinType
- the type
of the skinskinUrl
- a direct URL to the skin@Untested public void updateAndUpload(java.lang.String uuid, java.lang.String token, Mojang.SkinType skinType, java.lang.String file)
uuid
- the UUID of said playertoken
- the token used for API authenticationskinType
- the type
of the skinfile
- the raw image datapublic void resetSkin(java.lang.String uuid, java.lang.String token)
uuid
- the UUID of the playertoken
- the token used for API authenticationpublic java.util.List<java.lang.String> getServerBlacklist()
Returns a list of blacklisted hostnames, belonging to servers that were blocked due to Mojang's EULA infringement.
N.B.: These may not be in human friendly form as they were hashed. You may want to use third-party services to obtain an (unofficial) list.
List
of all the blocked hostnames@Untested public SalesStats getSaleStatistics(SalesStats.Options... options)
options
- the query options