public static AuthenticationResponse checkAccount(String username, String password, String clientToken) {
try {
URL url = new URL("https://authserver.mojang.com/authenticate");
String request;
if (clientToken == null) {
request = Gsons.DEFAULT.toJson(new AuthenticationRequest(username, password));
} else {
request = Gsons.DEFAULT.toJson(new AuthenticationRequest(username, password, clientToken));
}
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setConnectTimeout(15000);
connection.setReadTimeout(15000);
connection.setRequestMethod("POST");