From d2d5c84ca761dbda5fcc51fc7f390240d6e50c3e Mon Sep 17 00:00:00 2001 From: ToobLac Date: Wed, 1 Jul 2026 17:55:28 +0800 Subject: [PATCH 1/6] tip --- .../org/jackhuang/hmcl/ui/main/SettingsPage.java | 12 +++++++----- HMCL/src/main/resources/assets/lang/I18N.properties | 1 + .../main/resources/assets/lang/I18N_zh.properties | 1 + .../main/resources/assets/lang/I18N_zh_CN.properties | 1 + 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java index 4fcc43ac506..4d2f188aca9 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java @@ -37,10 +37,7 @@ import org.jackhuang.hmcl.ui.SVG; import org.jackhuang.hmcl.ui.construct.*; import org.jackhuang.hmcl.ui.construct.MessageDialogPane.MessageType; -import org.jackhuang.hmcl.upgrade.RemoteVersion; -import org.jackhuang.hmcl.upgrade.UpdateChannel; -import org.jackhuang.hmcl.upgrade.UpdateChecker; -import org.jackhuang.hmcl.upgrade.UpdateHandler; +import org.jackhuang.hmcl.upgrade.*; import org.jackhuang.hmcl.util.AprilFools; import org.jackhuang.hmcl.util.Lang; import org.jackhuang.hmcl.util.StringUtils; @@ -114,7 +111,7 @@ protected int getTrailingTextIndex() { final StringProperty lblUpdateSubProperty = updatePane.subtitleProperty(); - { + if (IntegrityChecker.DISABLE_SELF_INTEGRITY_CHECK || IntegrityChecker.isSelfVerified()) { updateListener = any -> { boolean outdated = UpdateChecker.isOutdated(); @@ -134,6 +131,11 @@ protected int getTrailingTextIndex() { UpdateChecker.outdatedProperty().addListener(new WeakInvalidationListener(updateListener)); UpdateChecker.checkingUpdateProperty().addListener(new WeakInvalidationListener(updateListener)); updateListener.invalidated(null); + } else { + updateButton.setVisible(false); + updateButton.setManaged(false); + lblUpdateSubProperty.set(i18n("update.unverified")); + updateListener = null; } updatePaneList.getContent().add(updatePane); diff --git a/HMCL/src/main/resources/assets/lang/I18N.properties b/HMCL/src/main/resources/assets/lang/I18N.properties index 26cd9a47e72..229064a2f53 100644 --- a/HMCL/src/main/resources/assets/lang/I18N.properties +++ b/HMCL/src/main/resources/assets/lang/I18N.properties @@ -1797,6 +1797,7 @@ update.no_browser=Cannot open in system browser. But we copied the link to your update.tooltip=Update update.preview=Preview HMCL releases early update.preview.subtitle=Enable this option to receive new versions of HMCL early for testing before their official release. +update.unverified=Update unavailable due to this launcher instance not verified version=Games version.name=Instance Name diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh.properties b/HMCL/src/main/resources/assets/lang/I18N_zh.properties index 56f6f492bb5..1a283a75a5f 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh.properties @@ -1584,6 +1584,7 @@ update.no_browser=無法開啟瀏覽器。網址已經複製到剪貼簿了, update.tooltip=更新 update.preview=提前測試 HMCL 預覽版本 update.preview.subtitle=啟用此選項,你將可以提前取得 HMCL 的新版本,以便在正式發布前進行測試。 +update.unverified=更新不可用,因為無法驗證此啟動器例項完整性 version=遊戲 version.name=遊戲實例名稱 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 6c7cd849bb3..c71e2f61de2 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties @@ -1589,6 +1589,7 @@ update.no_browser=无法打开浏览器。网址已经复制到剪贴板,你 update.tooltip=更新 update.preview=提前预览 HMCL 版本 update.preview.subtitle=启用此选项,你将可以提前获取 HMCL 的新版本,以便在正式发布前进行测试。 +update.unverified=更新不可用,因为无法验证此启动器实例完整性 version=游戏 version.name=游戏实例名称 From 40b41fae145765d0ec323d6dd13c704f26a158cf Mon Sep 17 00:00:00 2001 From: ToobLac Date: Thu, 2 Jul 2026 16:57:48 +0800 Subject: [PATCH 2/6] throwable --- .../org/jackhuang/hmcl/ui/main/SettingsPage.java | 5 +++++ .../org/jackhuang/hmcl/upgrade/UpdateChecker.java | 13 ++++++++++++- HMCL/src/main/resources/assets/lang/I18N.properties | 1 + .../main/resources/assets/lang/I18N_zh.properties | 1 + .../resources/assets/lang/I18N_zh_CN.properties | 1 + 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java index 4d2f188aca9..ce0711d9106 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java @@ -123,6 +123,10 @@ protected int getTrailingTextIndex() { lblUpdateSubProperty.set(i18n("update.newest_version", UpdateChecker.getLatestVersion().version())); } else if (UpdateChecker.isCheckingUpdate()) { lblUpdateSubProperty.set(i18n("update.checking")); + } else if (UpdateChecker.errorProperty().get() != null) { + Throwable t = UpdateChecker.errorProperty().get(); + String msg = t.getClass().getSimpleName() + ": " + t.getLocalizedMessage(); + lblUpdateSubProperty.set(i18n("update.check_failed", msg)); } else { lblUpdateSubProperty.set(i18n("update.latest")); } @@ -130,6 +134,7 @@ protected int getTrailingTextIndex() { UpdateChecker.latestVersionProperty().addListener(new WeakInvalidationListener(updateListener)); UpdateChecker.outdatedProperty().addListener(new WeakInvalidationListener(updateListener)); UpdateChecker.checkingUpdateProperty().addListener(new WeakInvalidationListener(updateListener)); + UpdateChecker.errorProperty().addListener(new WeakInvalidationListener(updateListener)); updateListener.invalidated(null); } else { updateButton.setVisible(false); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateChecker.java b/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateChecker.java index 3db51606969..a603170def6 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateChecker.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateChecker.java @@ -54,6 +54,7 @@ private UpdateChecker() { }, latestVersion); private static final ReadOnlyBooleanWrapper checkingUpdate = new ReadOnlyBooleanWrapper(false); + private static final ReadOnlyObjectWrapper error = new ReadOnlyObjectWrapper<>(); public static void init() { requestCheckUpdate(UpdateChannel.getChannel(), settings().acceptPreviewUpdateProperty().get()); @@ -83,6 +84,10 @@ public static ReadOnlyBooleanProperty checkingUpdateProperty() { return checkingUpdate.getReadOnlyProperty(); } + public static ReadOnlyObjectProperty errorProperty() { + return error.getReadOnlyProperty(); + } + private static RemoteVersion checkUpdate(UpdateChannel channel, boolean preview) throws IOException { if (!IntegrityChecker.DISABLE_SELF_INTEGRITY_CHECK && !IntegrityChecker.isSelfVerified()) { throw new IOException("Self verification failed"); @@ -109,16 +114,22 @@ public static void requestCheckUpdate(UpdateChannel channel, boolean preview) { thread(() -> { RemoteVersion result = null; + Throwable t = null; try { result = checkUpdate(channel, preview); LOG.info("Latest version (" + channel + ", preview=" + preview + ") is " + result); } catch (Throwable e) { + t = e; LOG.warning("Failed to check for update", e); } + Throwable throwable = t; RemoteVersion finalResult = result; Platform.runLater(() -> { - if (finalResult != null) { + if (throwable != null) { + error.set(throwable); + } else { + error.set(null); latestVersion.set(finalResult); } checkingUpdate.set(false); diff --git a/HMCL/src/main/resources/assets/lang/I18N.properties b/HMCL/src/main/resources/assets/lang/I18N.properties index 229064a2f53..58c9c106c08 100644 --- a/HMCL/src/main/resources/assets/lang/I18N.properties +++ b/HMCL/src/main/resources/assets/lang/I18N.properties @@ -1783,6 +1783,7 @@ update.channel.nightly.hint=You are currently using a Nightly channel build of t update.channel.nightly.title=Nightly Channel Notice update.channel.stable=Stable update.checking=Checking for updates +update.check_failed=Failed to check for update. %s update.disable_auto_show_update_dialog=Do not show update dialog automatically update.disable_auto_show_update_dialog.subtitle=Enable this option to prevent HMCL from automatically showing the update dialog. update.failed=Failed to update diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh.properties b/HMCL/src/main/resources/assets/lang/I18N_zh.properties index 1a283a75a5f..5096ca8f472 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh.properties @@ -1570,6 +1570,7 @@ update.channel.nightly.hint=你正在使用 HMCL 預覽版。預覽版更新較 update.channel.nightly.title=預覽版提示 update.channel.stable=穩定版 update.checking=正在檢查更新 +update.check_failed=檢查更新失敗 %s update.disable_auto_show_update_dialog=不自動顯示更新彈窗 update.disable_auto_show_update_dialog.subtitle=啟用此選項,HMCL 將不會自動彈出更新彈窗。 update.failed=更新失敗 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 c71e2f61de2..fc9240500c2 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties @@ -1575,6 +1575,7 @@ update.channel.nightly.hint=你正在使用 HMCL 预览版。预览版更新较 update.channel.nightly.title=预览版提示 update.channel.stable=稳定版 update.checking=正在检查更新 +update.check_failed=检查更新失败 %s update.disable_auto_show_update_dialog=不自动显示更新弹窗 update.disable_auto_show_update_dialog.subtitle=启用此选项,HMCL 将不会自动弹出更新弹窗。 update.failed=更新失败 From e8d17a8ed0c61b214fae2747fddd9b6fe99085ba Mon Sep 17 00:00:00 2001 From: ToobLac Date: Sat, 25 Jul 2026 19:07:23 +0800 Subject: [PATCH 3/6] update --- .../jackhuang/hmcl/ui/main/SettingsPage.java | 53 +++++++++---------- .../upgrade/SelfVerificationException.java | 28 ++++++++++ .../jackhuang/hmcl/upgrade/UpdateChecker.java | 2 +- .../jackhuang/hmcl/upgrade/UpdateHandler.java | 2 +- 4 files changed, 55 insertions(+), 30 deletions(-) create mode 100644 HMCL/src/main/java/org/jackhuang/hmcl/upgrade/SelfVerificationException.java diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java index a357415ad4a..92b28ae5fb1 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java @@ -110,37 +110,34 @@ protected int getTrailingTextIndex() { final StringProperty lblUpdateSubProperty = updatePane.subtitleProperty(); - if (IntegrityChecker.DISABLE_SELF_INTEGRITY_CHECK || IntegrityChecker.isSelfVerified()) { - updateListener = any -> { - boolean outdated = UpdateChecker.isOutdated(); - - updateButton.setVisible(outdated); - updateButton.setManaged(outdated); - updatePane.pseudoClassStateChanged(PseudoClass.getPseudoClass("active"), outdated); - - if (UpdateChecker.isOutdated()) { - lblUpdateSubProperty.set(i18n("update.newest_version", UpdateChecker.getLatestVersion().version())); - } else if (UpdateChecker.isCheckingUpdate()) { - lblUpdateSubProperty.set(i18n("update.checking")); - } else if (UpdateChecker.errorProperty().get() != null) { - Throwable t = UpdateChecker.errorProperty().get(); + updateListener = any -> { + boolean outdated = UpdateChecker.isOutdated(); + + updateButton.setVisible(outdated); + updateButton.setManaged(outdated); + updatePane.pseudoClassStateChanged(PseudoClass.getPseudoClass("active"), outdated); + + if (outdated) { + lblUpdateSubProperty.set(i18n("update.newest_version", UpdateChecker.getLatestVersion().version())); + } else if (UpdateChecker.isCheckingUpdate()) { + lblUpdateSubProperty.set(i18n("update.checking")); + } else if (UpdateChecker.errorProperty().get() != null) { + Throwable t = UpdateChecker.errorProperty().get(); + if (t instanceof SelfVerificationException) { + lblUpdateSubProperty.set(i18n("update.unverified")); + } else { String msg = t.getClass().getSimpleName() + ": " + t.getLocalizedMessage(); lblUpdateSubProperty.set(i18n("update.check_failed", msg)); - } else { - lblUpdateSubProperty.set(i18n("update.latest")); } - }; - UpdateChecker.latestVersionProperty().addListener(new WeakInvalidationListener(updateListener)); - UpdateChecker.outdatedProperty().addListener(new WeakInvalidationListener(updateListener)); - UpdateChecker.checkingUpdateProperty().addListener(new WeakInvalidationListener(updateListener)); - UpdateChecker.errorProperty().addListener(new WeakInvalidationListener(updateListener)); - updateListener.invalidated(null); - } else { - updateButton.setVisible(false); - updateButton.setManaged(false); - lblUpdateSubProperty.set(i18n("update.unverified")); - updateListener = null; - } + } else { + lblUpdateSubProperty.set(i18n("update.latest")); + } + }; + UpdateChecker.latestVersionProperty().addListener(new WeakInvalidationListener(updateListener)); + UpdateChecker.outdatedProperty().addListener(new WeakInvalidationListener(updateListener)); + UpdateChecker.checkingUpdateProperty().addListener(new WeakInvalidationListener(updateListener)); + UpdateChecker.errorProperty().addListener(new WeakInvalidationListener(updateListener)); + updateListener.invalidated(null); updatePaneList.getContent().add(updatePane); } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/SelfVerificationException.java b/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/SelfVerificationException.java new file mode 100644 index 00000000000..1986329dd13 --- /dev/null +++ b/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/SelfVerificationException.java @@ -0,0 +1,28 @@ +/* + * Hello Minecraft! Launcher + * Copyright (C) 2026 huangyuhui and contributors + * + * 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 + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.jackhuang.hmcl.upgrade; + +import java.io.IOException; + +public class SelfVerificationException extends IOException { + + public SelfVerificationException() { + super("Self verification failed"); + } + +} diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateChecker.java b/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateChecker.java index a603170def6..d4d7f10251a 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateChecker.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateChecker.java @@ -90,7 +90,7 @@ public static ReadOnlyObjectProperty errorProperty() { private static RemoteVersion checkUpdate(UpdateChannel channel, boolean preview) throws IOException { if (!IntegrityChecker.DISABLE_SELF_INTEGRITY_CHECK && !IntegrityChecker.isSelfVerified()) { - throw new IOException("Self verification failed"); + throw new SelfVerificationException(); } var query = new LinkedHashMap(); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateHandler.java b/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateHandler.java index ec28b67daff..d1dafae0236 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateHandler.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateHandler.java @@ -175,7 +175,7 @@ private static void applyUpdate(Path target) throws IOException { Path self = getCurrentLocation(); if (!IntegrityChecker.DISABLE_SELF_INTEGRITY_CHECK && !IntegrityChecker.isSelfVerified()) { - throw new IOException("Self verification failed"); + throw new SelfVerificationException(); } ExecutableHeaderHelper.copyWithHeader(self, target); From 2f43830dda93fad8e0b12528c7163a6409efc85a Mon Sep 17 00:00:00 2001 From: ToobLac Date: Sat, 25 Jul 2026 19:11:58 +0800 Subject: [PATCH 4/6] update --- .../jackhuang/hmcl/ui/main/SettingsPage.java | 54 ++++++++++--------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java index 92b28ae5fb1..77456919537 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/SettingsPage.java @@ -110,34 +110,36 @@ protected int getTrailingTextIndex() { final StringProperty lblUpdateSubProperty = updatePane.subtitleProperty(); - updateListener = any -> { - boolean outdated = UpdateChecker.isOutdated(); - - updateButton.setVisible(outdated); - updateButton.setManaged(outdated); - updatePane.pseudoClassStateChanged(PseudoClass.getPseudoClass("active"), outdated); - - if (outdated) { - lblUpdateSubProperty.set(i18n("update.newest_version", UpdateChecker.getLatestVersion().version())); - } else if (UpdateChecker.isCheckingUpdate()) { - lblUpdateSubProperty.set(i18n("update.checking")); - } else if (UpdateChecker.errorProperty().get() != null) { - Throwable t = UpdateChecker.errorProperty().get(); - if (t instanceof SelfVerificationException) { - lblUpdateSubProperty.set(i18n("update.unverified")); + { + updateListener = any -> { + boolean outdated = UpdateChecker.isOutdated(); + + updateButton.setVisible(outdated); + updateButton.setManaged(outdated); + updatePane.pseudoClassStateChanged(PseudoClass.getPseudoClass("active"), outdated); + + if (outdated) { + lblUpdateSubProperty.set(i18n("update.newest_version", UpdateChecker.getLatestVersion().version())); + } else if (UpdateChecker.isCheckingUpdate()) { + lblUpdateSubProperty.set(i18n("update.checking")); + } else if (UpdateChecker.errorProperty().get() != null) { + Throwable t = UpdateChecker.errorProperty().get(); + if (t instanceof SelfVerificationException) { + lblUpdateSubProperty.set(i18n("update.unverified")); + } else { + String msg = t.getClass().getSimpleName() + ": " + t.getLocalizedMessage(); + lblUpdateSubProperty.set(i18n("update.check_failed", msg)); + } } else { - String msg = t.getClass().getSimpleName() + ": " + t.getLocalizedMessage(); - lblUpdateSubProperty.set(i18n("update.check_failed", msg)); + lblUpdateSubProperty.set(i18n("update.latest")); } - } else { - lblUpdateSubProperty.set(i18n("update.latest")); - } - }; - UpdateChecker.latestVersionProperty().addListener(new WeakInvalidationListener(updateListener)); - UpdateChecker.outdatedProperty().addListener(new WeakInvalidationListener(updateListener)); - UpdateChecker.checkingUpdateProperty().addListener(new WeakInvalidationListener(updateListener)); - UpdateChecker.errorProperty().addListener(new WeakInvalidationListener(updateListener)); - updateListener.invalidated(null); + }; + UpdateChecker.latestVersionProperty().addListener(new WeakInvalidationListener(updateListener)); + UpdateChecker.outdatedProperty().addListener(new WeakInvalidationListener(updateListener)); + UpdateChecker.checkingUpdateProperty().addListener(new WeakInvalidationListener(updateListener)); + UpdateChecker.errorProperty().addListener(new WeakInvalidationListener(updateListener)); + updateListener.invalidated(null); + } updatePaneList.getContent().add(updatePane); } From 3e573265e50b7891b0f5bf7dd2eb266fe95bfb22 Mon Sep 17 00:00:00 2001 From: ToobLac Date: Sat, 25 Jul 2026 19:53:21 +0800 Subject: [PATCH 5/6] update --- HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateChecker.java | 1 + 1 file changed, 1 insertion(+) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateChecker.java b/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateChecker.java index d4d7f10251a..930ebb06ef4 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateChecker.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateChecker.java @@ -127,6 +127,7 @@ public static void requestCheckUpdate(UpdateChannel channel, boolean preview) { RemoteVersion finalResult = result; Platform.runLater(() -> { if (throwable != null) { + latestVersion.set(null); error.set(throwable); } else { error.set(null); From 3bccfb19e376a5abc45ccfda3c34fd22c88e29ab Mon Sep 17 00:00:00 2001 From: ToobLac Date: Sat, 25 Jul 2026 19:54:15 +0800 Subject: [PATCH 6/6] update --- .../main/java/org/jackhuang/hmcl/upgrade/UpdateChecker.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateChecker.java b/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateChecker.java index 930ebb06ef4..81f9c17bce7 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateChecker.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateChecker.java @@ -25,6 +25,7 @@ import org.jackhuang.hmcl.Metadata; import org.jackhuang.hmcl.util.io.NetworkUtils; import org.jackhuang.hmcl.util.versioning.VersionNumber; +import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.util.LinkedHashMap; @@ -54,7 +55,7 @@ private UpdateChecker() { }, latestVersion); private static final ReadOnlyBooleanWrapper checkingUpdate = new ReadOnlyBooleanWrapper(false); - private static final ReadOnlyObjectWrapper error = new ReadOnlyObjectWrapper<>(); + private static final ReadOnlyObjectWrapper<@Nullable Throwable> error = new ReadOnlyObjectWrapper<>(); public static void init() { requestCheckUpdate(UpdateChannel.getChannel(), settings().acceptPreviewUpdateProperty().get()); @@ -84,7 +85,7 @@ public static ReadOnlyBooleanProperty checkingUpdateProperty() { return checkingUpdate.getReadOnlyProperty(); } - public static ReadOnlyObjectProperty errorProperty() { + public static ReadOnlyObjectProperty<@Nullable Throwable> errorProperty() { return error.getReadOnlyProperty(); }