diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Accounts.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Accounts.java index 5d2b3fb1b..0febd3369 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Accounts.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Accounts.java @@ -42,6 +42,7 @@ import org.jackhuang.hmcl.util.Lang; import org.jackhuang.hmcl.util.io.FileUtils; import org.jackhuang.hmcl.util.skin.InvalidSkinException; +import javax.net.ssl.SSLException; import java.io.IOException; import java.io.Reader; import java.nio.file.Files; @@ -427,7 +428,11 @@ public final class Accounts { if (exception instanceof NoCharacterException) { return i18n("account.failed.no_character"); } else if (exception instanceof ServerDisconnectException) { - return i18n("account.failed.connect_authentication_server"); + if (exception.getCause() instanceof SSLException) { + return i18n("account.failed.ssl"); + } else { + return i18n("account.failed.connect_authentication_server"); + } } else if (exception instanceof ServerResponseMalformedException) { return i18n("account.failed.server_response_malformed"); } else if (exception instanceof RemoteAuthenticationException) { diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AddAuthlibInjectorServerPane.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AddAuthlibInjectorServerPane.java index 3f77a8349..0f3063b56 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AddAuthlibInjectorServerPane.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AddAuthlibInjectorServerPane.java @@ -33,6 +33,7 @@ import org.jackhuang.hmcl.ui.construct.SpinnerPane; import org.jackhuang.hmcl.util.Lang; import org.jackhuang.hmcl.util.io.NetworkUtils; +import javax.net.ssl.SSLException; import java.io.IOException; import java.util.logging.Level; @@ -162,7 +163,9 @@ public final class AddAuthlibInjectorServerPane extends TransitionPane implement } private String resolveFetchExceptionMessage(Throwable exception) { - if (exception instanceof IOException) { + if (exception instanceof SSLException) { + return i18n("account.failed.ssl"); + } else if (exception instanceof IOException) { return i18n("account.failed.connect_injector_server"); } else { return exception.getClass().getName() + ": " + exception.getLocalizedMessage(); diff --git a/HMCL/src/main/resources/assets/lang/I18N.properties b/HMCL/src/main/resources/assets/lang/I18N.properties index 4affbfcde..78f404f03 100644 --- a/HMCL/src/main/resources/assets/lang/I18N.properties +++ b/HMCL/src/main/resources/assets/lang/I18N.properties @@ -67,6 +67,7 @@ account.failed.migration=Your account needs to be migrated to a Microsoft accoun account.failed.no_character=There are no characters linked to this account. account.failed.server_disconnected=Cannot access authentication server. You can log in offline or try to re-login. account.failed.server_response_malformed=Invalid server response, the authentication server may not be working. +account.failed.ssl=An SSL error occurred while connecting to the server. Please try updating your Java. account.failed.wrong_account=You have logged in to the wrong account. account.hmcl.hint=You need to click on "Login" and complete the process in the opened tab in your browser. # avoid too long sequence. diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh.properties b/HMCL/src/main/resources/assets/lang/I18N_zh.properties index 37c6c60f5..6f16e0735 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh.properties @@ -69,6 +69,7 @@ account.failed.server_disconnected=無法訪問登錄伺服器,賬戶信息刷 若最近沒有刷新賬戶信息,則可能導致賬戶信息過期失效,\n\ 若為 微軟賬戶 啟動遊戲,賬戶信息過期失效可能將無法進入需賬戶驗證的伺服器。 account.failed.server_response_malformed=無法解析認證伺服器回應,可能是伺服器故障 +account.failed.ssl=連接服務器時發生了 SSL 錯誤,可能網站證書已過期或你使用的 Java 版本過低,請嘗試更新 Java account.failed.wrong_account=登錄了錯誤的帳號 account.hmcl.hint=你需要點擊“登入”按鈕,並在打開的網頁中完成登入 account.injector.add=新增認證伺服器 diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties index f23c5abab..cfd408a3b 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties @@ -69,6 +69,7 @@ account.failed.server_disconnected=无法访问登录服务器,账户信息刷 若最近没有刷新账户信息,则可能导致账户信息过期失效,\n\ 若为 微软账户 启动游戏,账户信息过期失效可能将无法进入需账户验证的服务器。 account.failed.server_response_malformed=无法解析认证服务器响应,可能是服务器故障 +account.failed.ssl=连接服务器时发生了 SSL 错误,可能网站证书已过期或你使用的 Java 版本过低,请尝试更新 Java account.failed.wrong_account=登录了错误的帐号 account.hmcl.hint=你需要点击“登录”按钮,并在打开的网页中完成登录 account.injector.add=添加认证服务器