diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/utils/auth/SkinmeAuthenticator.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/utils/auth/SkinmeAuthenticator.java index 1a20d6fe6..7ada3b176 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/utils/auth/SkinmeAuthenticator.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/utils/auth/SkinmeAuthenticator.java @@ -1,7 +1,7 @@ /* * Hello Minecraft! Launcher. * Copyright (C) 2013 huangyuhui - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or @@ -18,7 +18,6 @@ package org.jackhuang.hellominecraft.launcher.utils.auth; import org.jackhuang.hellominecraft.C; -import org.jackhuang.hellominecraft.HMCLog; import org.jackhuang.hellominecraft.utils.code.DigestUtils; import org.jackhuang.hellominecraft.utils.NetUtils; import org.jackhuang.hellominecraft.views.Selector; @@ -39,15 +38,14 @@ public final class SkinmeAuthenticator extends IAuthenticator { public String getCharacter(String user, String hash, String $char) throws Exception { return NetUtils.get( - "http://www.skinme.cc/api/login.php?user=" + user + "&hash=" + hash + (($char == null) ? "" : ("&char=" + $char))); + "http://www.skinme.cc/api/login.php?user=" + user + "&hash=" + hash + (($char == null) ? "" : ("&char=" + $char))); } @Override public UserProfileProvider login(LoginInfo info) throws AuthenticationException { UserProfileProvider req = new UserProfileProvider(); - if (info.username == null || !info.username.contains("@")) { + if (info.username == null || !info.username.contains("@")) throw new AuthenticationException(C.i18n("login.not_email")); - } try { String usr = info.username.toLowerCase(); String pwd = info.password; @@ -58,45 +56,45 @@ public final class SkinmeAuthenticator extends IAuthenticator { String[] sl = data.split(":"); if (null != sl[0]) switch (sl[0]) { - case "0": - if (sl[1].contains("No Valid Character")) - sl[1] = C.i18n("login.no_valid_character"); - throw new AuthenticationException(sl[1]); - case "1": { - String[] s = parseType1(sl[1]); - req.setUserName(s[0]); - req.setSession(s[1]); - req.setUserId(s[1]); - req.setAccessToken(s[1]); - break; + case "0": + if (sl[1].contains("No Valid Character")) + sl[1] = C.i18n("login.no_valid_character"); + throw new AuthenticationException(sl[1]); + case "1": { + String[] s = parseType1(sl[1]); + req.setUserName(s[0]); + req.setSession(s[1]); + req.setUserId(s[1]); + req.setAccessToken(s[1]); + break; + } + case "2": { + String[] charators = sl[1].split(";"); + int len = charators.length; + String[] $char = new String[len]; + String[] user = new String[len]; + System.out.println(sl[1]); + for (int i = 0; i < len; i++) { + String[] charator = charators[i].split(","); + $char[i] = charator[0]; + user[i] = charator[1]; } - case "2": { - String[] charators = sl[1].split(";"); - int len = charators.length; - String[] $char = new String[len]; - String[] user = new String[len]; - System.out.println(sl[1]); - for (int i = 0; i < len; i++) { - String[] charator = charators[i].split(","); - $char[i] = charator[0]; - user[i] = charator[1]; - } - Selector s = new Selector(null, user, C.i18n("login.choose_charactor")); - s.setVisible(true); - if (s.sel == Selector.failedToSel) { - throw new AuthenticationException(C.i18n("message.cancelled")); - } else { - int index = s.sel; - String character = $char[index]; - sl = getCharacter(usr, hashCode, character).split(":"); - String[] s2 = parseType1(sl[1]); - req.setUserName(s2[0]); - req.setSession(s2[1]); - req.setUserId(s2[1]); - req.setAccessToken(s2[1]); - } - break; + Selector s = new Selector(null, user, C.i18n("login.choose_charactor")); + s.setVisible(true); + if (s.sel == Selector.FAILED_TO_SELECT) + throw new AuthenticationException(C.i18n("message.cancelled")); + else { + int index = s.sel; + String character = $char[index]; + sl = getCharacter(usr, hashCode, character).split(":"); + String[] s2 = parseType1(sl[1]); + req.setUserName(s2[0]); + req.setSession(s2[1]); + req.setUserId(s2[1]); + req.setAccessToken(s2[1]); } + break; + } } req.setUserType("Legacy"); diff --git a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N.properties b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N.properties index 72688e97f..a5fa42d81 100644 --- a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N.properties +++ b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N.properties @@ -1,3 +1,4 @@ +<<<<<<< HEAD # Hello Minecraft! Launcher. # Copyright (C) 2013 huangyuhui # @@ -331,4 +332,4 @@ color.blue=\u84dd\u8272 color.green=\u7eff\u8272 color.orange=\u6a59\u8272 color.dark_blue=\u6df1\u84dd\u8272 -color.purple=\u7d2b\u8272 +color.purple=\u7d2b\u8272 \ No newline at end of file diff --git a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N_zh_CN.properties b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N_zh_CN.properties index 2b23cd902..04ed0a0a0 100644 --- a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N_zh_CN.properties +++ b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N_zh_CN.properties @@ -328,4 +328,4 @@ color.blue=\u84dd\u8272 color.green=\u7eff\u8272 color.orange=\u6a59\u8272 color.dark_blue=\u6df1\u84dd\u8272 -color.purple=\u7d2b\u8272 +color.purple=\u7d2b\u8272 \ No newline at end of file diff --git a/README.md b/README.md index b8b93fd1d..559a1dd30 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# Hello Minecraft! Launcher -Hello Minecraft! Launcher is a Minecraft launcher. -License is GPL v3, see http://www.gnu.org/licenses/. - -### Joining -If you really want to join the development, here's some requests. -* The Development Environment is Netbeans 8.0.2 with Gradle Support plugin. -* The project is built on Java 1.8, using the retrolambda backported to Java 1.7. So DO NOT use the libraries of Java 8 like Stream APIs. -* DO NOT modify *.gradle. +# Hello Minecraft! Launcher +Hello Minecraft! Launcher is a Minecraft launcher. +License is GPL v3, see http://www.gnu.org/licenses/gpl.html + +### Joining +If you really want to join the development, here's some requests. +* The Development Environment is Netbeans 8.0.2 with Gradle Support plugin. +* The project is built on Java 1.8, using the retrolambda backported to Java 1.7. So DO NOT use the libraries of Java 8 like Stream APIs. +* DO NOT modify *.gradle.