All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.to2mbn.jmccc.mojangapi.MojangAPI Maven / Gradle / Ivy

The newest version!
package org.to2mbn.jmccc.mojangapi;

import java.util.Map;
import java.util.UUID;
import org.to2mbn.jmccc.auth.AuthenticationException;
import org.to2mbn.jmccc.auth.yggdrasil.SessionCredential;
import org.to2mbn.jmccc.auth.yggdrasil.core.texture.Texture;
import org.to2mbn.jmccc.auth.yggdrasil.core.texture.TextureType;

/**
 * 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: * *
 * {@code 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 {@code https://account.mojang.com/me}), your * ip will be authorized. * * @author yushijinhun */ public interface MojangAPI { /** * Returns status of various Mojang services. * * @return the status of Mojang services * @throws AuthenticationException if an exception occurs during requesting */ Map getServiceStatus() throws 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. * * @param uuid the player's uuid * @return the name history of the specified player * @throws AuthenticationException if an exception occurs during requesting */ FormerName[] getNameHistory(UUID uuid) throws AuthenticationException; /** * Sets the player's texture. *

* If {@code texture} is {@code null}, this method will reset the texture. * * @param credential the account's credential * @param uuid the player's uuid * @param type the type of the texture * @param texture the texture, can be null * @throws AuthenticationException if an exception occurs during requesting */ void setTexture(SessionCredential credential, UUID uuid, TextureType type, Texture texture) throws AuthenticationException; /** * Gets the information of the account. * * @param credential the account's credential * @return the information of the account * @throws AuthenticationException if an exception occurs during requesting */ AccountInfo getAccountInfo(SessionCredential credential) throws AuthenticationException; /** * Gets the blocked server list. *

* For further information, see * Mojang is blocking certain servers as of 1.9.3 r2. - Reddit * * @return the blocked server list * @throws AuthenticationException if an exception occurs during requesting */ BlockedServerList getBlockedServerList() throws AuthenticationException; /** * Queries the statistics on the sales. *

* Valid metric keys are defined in {@link SalesStatistics.MetricKeys}. * * @param metricKeys the metric keys * @return the statistics on the sales * @throws AuthenticationException if an exception occurs during requesting */ SalesStatistics querySales(String... metricKeys) throws AuthenticationException; }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy