public static String[] doLogin(String user, String pass, JProgressBar progress) throws BadLoginException, MCNetworkException, OutdatedMCLauncherException, UnsupportedEncodingException, MinecraftUserNotPremiumException, PermissionDeniedException {
String parameters = "user=" + URLEncoder.encode(user, "UTF-8") + "&password=" + URLEncoder.encode(pass, "UTF-8") + "&version=" + 13;
String result = executePost("https://login.minecraft.net/", parameters, progress);
if (result == null) {
throw new MCNetworkException();
}
if (!result.contains(":")) {
if (result.toLowerCase().contains("bad login")) {
throw new BadLoginException();
} else if (result.toLowerCase().contains("not premium")) {
throw new MinecraftUserNotPremiumException();
} else if (result.toLowerCase().contains("old version")) {
throw new OutdatedMCLauncherException();
} else if (result.toLowerCase().contains("migrated")) {
throw new AccountMigratedException();
} else {
System.err.print("Unknown login result: " + result);
}
throw new MCNetworkException();
}
return result.split(":");
}