接口 MojangAPI


public interface MojangAPI
The Mojang API client.

For further information, see Mojang API - wiki.vg

If secured questions are enabled, there may be some problems. The following exception may be thrown:

 org.to2mbn.jmccc.auth.yggdrasil.core.RemoteAuthenticationException: Forbidden: Current IP not secured
 

This means you haven't answered the questions, so you are not authorized to access the api. To resolve this problem, you need to answer these questions on the current computer, then your ip will be authorized.
You can do the following in a web view:

 POST https://account.mojang.com/login
 

With the form data:

 authenticityToken=[an random 40-characters hex string]
 username=[email]
 password=[password]
 

Then Mojang will ask you some questions. Once the questions are correctly answered (the web view jumps to https://account.mojang.com/me), your ip will be authorized.

  • 方法详细资料

    • getServiceStatus

      Map<String,ServiceStatus> getServiceStatus() throws org.to2mbn.jmccc.auth.AuthenticationException
      Returns status of various Mojang services.
      返回:
      the status of Mojang services
      抛出:
      org.to2mbn.jmccc.auth.AuthenticationException - if an exception occurs during requesting
    • getNameHistory

      FormerName[] getNameHistory(UUID uuid) throws org.to2mbn.jmccc.auth.AuthenticationException
      Returns the name history of the specified player.

      The array is sorted by time. The first element is the player's first username. And the last element is the current username.

      参数:
      uuid - the player's uuid
      返回:
      the name history of the specified player
      抛出:
      org.to2mbn.jmccc.auth.AuthenticationException - if an exception occurs during requesting
    • setTexture

      void setTexture(org.to2mbn.jmccc.auth.yggdrasil.SessionCredential credential, UUID uuid, org.to2mbn.jmccc.auth.yggdrasil.core.texture.TextureType type, org.to2mbn.jmccc.auth.yggdrasil.core.texture.Texture texture) throws org.to2mbn.jmccc.auth.AuthenticationException
      Sets the player's texture.

      If texture is null, this method will reset the texture.

      参数:
      credential - the account's credential
      uuid - the player's uuid
      type - the type of the texture
      texture - the texture, can be null
      抛出:
      org.to2mbn.jmccc.auth.AuthenticationException - if an exception occurs during requesting
    • getAccountInfo

      AccountInfo getAccountInfo(org.to2mbn.jmccc.auth.yggdrasil.SessionCredential credential) throws org.to2mbn.jmccc.auth.AuthenticationException
      Gets the information of the account.
      参数:
      credential - the account's credential
      返回:
      the information of the account
      抛出:
      org.to2mbn.jmccc.auth.AuthenticationException - if an exception occurs during requesting
    • getBlockedServerList

      BlockedServerList getBlockedServerList() throws org.to2mbn.jmccc.auth.AuthenticationException
      Gets the blocked server list.

      For further information, see Mojang is blocking certain servers as of 1.9.3 r2. - Reddit

      返回:
      the blocked server list
      抛出:
      org.to2mbn.jmccc.auth.AuthenticationException - if an exception occurs during requesting
    • querySales

      SalesStatistics querySales(String... metricKeys) throws org.to2mbn.jmccc.auth.AuthenticationException
      Queries the statistics on the sales.

      Valid metric keys are defined in SalesStatistics.MetricKeys.

      参数:
      metricKeys - the metric keys
      返回:
      the statistics on the sales
      抛出:
      org.to2mbn.jmccc.auth.AuthenticationException - if an exception occurs during requesting