diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/AuthlibInjectorServersPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/AuthlibInjectorServersPage.java index 937391866..74126b1bc 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/AuthlibInjectorServersPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/AuthlibInjectorServersPage.java @@ -35,7 +35,7 @@ import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; public class AuthlibInjectorServersPage extends StackPane implements DecoratorPage { - private final StringProperty title = new SimpleStringProperty(this, "title", i18n("account.injector.server")); + private final StringProperty title = new SimpleStringProperty(this, "title", i18n("account.injector.manage.title")); @FXML private ScrollPane scrollPane; @FXML private VBox listPane; diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/Decorator.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/Decorator.java index 236e858eb..41695e1cb 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/Decorator.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/Decorator.java @@ -96,13 +96,14 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza private final boolean max, min; private final WizardController wizardController = new WizardController(this); private final Queue cancelQueue = new ConcurrentLinkedQueue<>(); - private final JFXDialog dialog; private double xOffset, yOffset, newX, newY, initX, initY; private boolean allowMove, isDragging, maximized; private BoundingBox originalBox, maximizedBox; private final TransitionHandler animationHandler; - private final StackContainerPane dialogPane = new StackContainerPane(); + + private JFXDialog dialog; + private StackContainerPane dialogPane; @FXML private StackPane contentPlaceHolder; @@ -181,12 +182,6 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza btnMax.fire(); }); - dialog = new JFXDialog(); - dialog.setOverlayClose(false); - drawerWrapper.getChildren().add(0, dialog); - dialog.setDialogContainer(drawerWrapper); - dialog.setContent(dialogPane); - welcomeView.setCursor(Cursor.HAND); welcomeView.setOnMouseClicked(e -> { Timeline nowAnimation = new Timeline(); @@ -572,13 +567,21 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza public void showDialog(Node node) { FXUtils.checkFxUserThread(); + if (dialog == null) { + dialog = new JFXDialog(); + dialogPane = new StackContainerPane(); + + dialog.setContent(dialogPane); + dialog.setDialogContainer(drawerWrapper); + dialog.setOverlayClose(false); + dialog.show(); + } + + dialogPane.push(node); + EventHandler handler = event -> closeDialog(node); node.getProperties().put(PROPERTY_DIALOG_CLOSE_HANDLER, handler); node.addEventHandler(DialogCloseEvent.CLOSE, handler); - - if (dialogPane.isEmpty()) - dialog.show(); - dialogPane.push(node); } @SuppressWarnings("unchecked") @@ -589,8 +592,11 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza .ifPresent(handler -> node.removeEventHandler(DialogCloseEvent.CLOSE, (EventHandler) handler)); dialogPane.pop(node); + if (dialogPane.getChildren().isEmpty()) { dialog.close(); + dialog = null; + dialogPane = null; } } diff --git a/HMCL/src/main/resources/assets/lang/I18N.properties b/HMCL/src/main/resources/assets/lang/I18N.properties index 6e8ff7559..389c3b3ff 100644 --- a/HMCL/src/main/resources/assets/lang/I18N.properties +++ b/HMCL/src/main/resources/assets/lang/I18N.properties @@ -41,8 +41,9 @@ account.failed.invalid_token=Please log out and re-input your password to login. account.failed.no_character=No character in this account. account.failed.no_selected_server=No authentication server is selected. account.failed.connect_injector_server=Cannot connect to the authentication server. Check your network and ensure the URL is correct. -account.injector.add=Add authentication server +account.injector.add=Add an authentication server account.injector.manage=Manage authentication servers +account.injector.manage.title=Authentication servers account.injector.http=Warning: This server is using HTTP, which will cause your password be transmitted in clear text. account.injector.server=Auth Server account.injector.server_url=Server URL @@ -52,7 +53,7 @@ account.methods.authlib_injector=authlib-injector account.methods.no_method=No login method account.methods.offline=Offline account.methods.yggdrasil=Mojang -account.missing=Missing account +account.missing=None account.password=Password account.username=Name @@ -127,7 +128,7 @@ install.select=Select an operation install.success=Installed successfully lang=English -lang.default=Belong to OS language. +lang.default=Use system language launch.advice.different_platform=Your OS is 64-Bit but your Java is 32-Bit. The 64-Bit Java is recommended. launch.advice.java8_1_13=Minecraft 1.13 and later versions can only run on Java 8 or later. @@ -306,8 +307,8 @@ settings.type.special=Specialized version settings(will not affect other version update=Update update.failed=Failed to check for updates. -update.found=Found Update! -update.newest_version=Newest version: %s +update.found=Update Available! +update.newest_version=Latest version: %s update.latest=This is latest Version. update.no_browser=Cannot open any browser. The link has been copied to the clipboard. Paste it to a browser address bar to update. update.tooltip=Update diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh.properties b/HMCL/src/main/resources/assets/lang/I18N_zh.properties index a484135ae..6c39171ab 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh.properties @@ -43,6 +43,7 @@ account.failed.no_selected_server=未選擇認證服務器 account.failed.connect_injector_server=無法連接認證服務器,可能是網絡故障或 URL 輸入錯誤 account.injector.add=添加認證服務器 account.injector.manage=管理認證服務器 +account.injector.manage.title=認證服務器 account.injector.http=警告:此服務器使用不安全的 HTTP 協議,您的密碼在登錄時會被明文傳輸。 account.injector.server=認證服務器 account.injector.server_url=服務器地址 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 c5c0007ae..f11cc0f41 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties @@ -43,6 +43,7 @@ account.failed.no_selected_server=未选择认证服务器 account.failed.connect_injector_server=无法连接认证服务器,可能是网络故障或 URL 输入错误 account.injector.add=添加认证服务器 account.injector.manage=管理认证服务器 +account.injector.manage.title=认证服务器 account.injector.http=警告:此服务器使用不安全的 HTTP 协议,您的密码在登录时会被明文传输。 account.injector.server=认证服务器 account.injector.server_url=服务器地址 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/authlibinjector/AuthlibInjectorServer.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/authlibinjector/AuthlibInjectorServer.java index 7fc50a786..d48a71ed9 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/authlibinjector/AuthlibInjectorServer.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/authlibinjector/AuthlibInjectorServer.java @@ -26,8 +26,8 @@ import org.jackhuang.hmcl.util.JsonUtils; import org.jackhuang.hmcl.util.NetworkUtils; import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSyntaxException; public class AuthlibInjectorServer { @@ -36,7 +36,7 @@ public class AuthlibInjectorServer { JsonObject response = JsonUtils.fromNonNullJson(NetworkUtils.doGet(NetworkUtils.toURL(url)), JsonObject.class); String name = extractServerName(response).orElse(url); return new AuthlibInjectorServer(url, name); - } catch (JsonSyntaxException e) { + } catch (JsonParseException e) { throw new IOException("Malformed response", e); } }