Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
*/
package org.jackhuang.hmcl;

import org.jackhuang.hmcl.java.JavaRuntime;
import org.jackhuang.hmcl.util.FileSaver;
import org.jackhuang.hmcl.util.SelfDependencyPatcher;
import org.jackhuang.hmcl.util.SwingUtils;
import org.jackhuang.hmcl.java.JavaRuntime;
import org.jackhuang.hmcl.util.io.FileUtils;
import org.jackhuang.hmcl.util.io.JarUtils;
import org.jackhuang.hmcl.util.platform.OperatingSystem;

import javax.swing.JOptionPane;
import javax.swing.*;
import java.io.IOException;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
Expand All @@ -34,8 +34,8 @@
import java.nio.file.Path;
import java.util.concurrent.CancellationException;

import static org.jackhuang.hmcl.util.logging.Logger.LOG;
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
import static org.jackhuang.hmcl.util.logging.Logger.LOG;

public final class EntryPoint {

Expand Down
25 changes: 25 additions & 0 deletions HMCL/src/main/java/org/jackhuang/hmcl/setting/EnumUpdateMode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Hello Minecraft! Launcher
* Copyright (C) 2026 huangyuhui <huanghongxun2008@126.com> 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 <https://www.gnu.org/licenses/>.
*/
package org.jackhuang.hmcl.setting;

public enum EnumUpdateMode {
NOTIFY,
DOWNLOAD,
SILENT,
AUTO
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
import org.jetbrains.annotations.Nullable;

import java.nio.file.Path;
import java.util.*;
import java.util.Objects;
import java.util.UUID;

/// Stores the current workspace's main launcher settings.
///
Expand Down Expand Up @@ -197,13 +198,13 @@ public BooleanProperty acceptPreviewUpdateProperty() {
return acceptPreviewUpdate;
}

/// Whether automatic update dialogs are disabled.
@SerializedName("disableAutoShowUpdateDialog")
private final BooleanProperty disableAutoShowUpdateDialog = new SimpleBooleanProperty(false);
/// Whether preview builds are accepted by update checks.
@SerializedName("updateMode")
private final ObjectProperty<EnumUpdateMode> updateMode = new SimpleObjectProperty<>(EnumUpdateMode.NOTIFY);

/// Returns the automatic update dialog disable property.
public BooleanProperty disableAutoShowUpdateDialogProperty() {
return disableAutoShowUpdateDialog;
/// Returns the update mode property.
public ObjectProperty<EnumUpdateMode> updateModeProperty() {
return updateMode;
}

/// Whether April Fools features are disabled.
Expand Down
10 changes: 1 addition & 9 deletions HMCL/src/main/java/org/jackhuang/hmcl/ui/Controllers.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,7 @@
import java.util.List;
import java.util.concurrent.CompletableFuture;

import static org.jackhuang.hmcl.setting.SettingsManager.settings;
import static org.jackhuang.hmcl.setting.SettingsManager.getAuthlibInjectorServers;
import static org.jackhuang.hmcl.setting.SettingsManager.state;
import static org.jackhuang.hmcl.setting.SettingsManager.userState;
import static org.jackhuang.hmcl.setting.SettingsManager.*;
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
import static org.jackhuang.hmcl.util.logging.Logger.LOG;

Expand Down Expand Up @@ -382,11 +379,6 @@ public static void initialize(Stage stage) {

decorator = new DecoratorController(stage, getRootPage());
getRootPage().getMainPage().showUpdateProperty().bind(UpdateChecker.checkingUpdateProperty().not().and(UpdateChecker.outdatedProperty()));
getRootPage().getMainPage().showUpdateDialogProperty().bind(
decorator.backableProperty().not()
.and(getRootPage().getMainPage().showUpdateProperty())
.and(settings().disableAutoShowUpdateDialogProperty().not())
);

if (settings().commonDirectoryTypeProperty().get() == EnumCommonDirectory.CUSTOM &&
!FileUtils.canCreateDirectory(settings().getResolvedCommonDirectory())) {
Expand Down
7 changes: 5 additions & 2 deletions HMCL/src/main/java/org/jackhuang/hmcl/ui/UpgradeDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,14 @@ public UpgradeDialog(RemoteVersion remoteVersion, Runnable updateRunnable) {
updateButton.getStyleClass().add("dialog-accept");
updateButton.setOnAction(e -> updateRunnable.run());

JFXButton cancelButton = new JFXButton(i18n("button.cancel"));
JFXButton cancelButton = new JFXButton(updateRunnable != null ? i18n("button.cancel") : i18n("button.ok"));
cancelButton.getStyleClass().add("dialog-cancel");
cancelButton.setOnAction(e -> fireEvent(new DialogCloseEvent()));

setActions(openInBrowser, updateButton, cancelButton);
if (updateRunnable != null)
setActions(openInBrowser, updateButton, cancelButton);
else
setActions(openInBrowser, cancelButton);
onEscPressed(this, cancelButton::fire);
}
}
Loading