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
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* 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;

import org.jetbrains.annotations.NotNullByDefault;

/// Selects how HMCL resolves the account used to launch a game.
///
/// Additional payload for [SPECIFIC] is stored in `GameSettings.specificAccountID`.
///
/// @author Glavo
@NotNullByDefault
public enum AccountSelectionType {
/// Follows the account currently selected in the account list.
GLOBAL,

/// Uses the account specified by `GameSettings.specificAccountID`.
SPECIFIC
}
27 changes: 27 additions & 0 deletions HMCL/src/main/java/org/jackhuang/hmcl/setting/GameSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableSet;
import org.jackhuang.hmcl.auth.AccountID;
import org.jackhuang.hmcl.game.*;
import org.jackhuang.hmcl.java.JavaManager;
import org.jackhuang.hmcl.java.JavaRuntime;
Expand Down Expand Up @@ -704,6 +705,32 @@ public InheritableProperty<String> postExitCommandProperty() {
return postExitCommand;
}

/// Property name for the account selection mode.
public static final String PROPERTY_ACCOUNT_TYPE = "accountType";

/// The account selection mode.
@SerializedName(PROPERTY_ACCOUNT_TYPE)
private final InheritableProperty<AccountSelectionType> accountType =
newInheritableProperty(PROPERTY_ACCOUNT_TYPE, AccountSelectionType.GLOBAL);

/// Returns the account selection mode property.
public InheritableProperty<AccountSelectionType> accountTypeProperty() {
return accountType;
}

/// Property name for the account used by `SPECIFIC` account selection mode.
public static final String PROPERTY_SPECIFIC_ACCOUNT_ID = "specificAccountID";

/// Account used by `SPECIFIC` account selection mode.
@SerializedName(PROPERTY_SPECIFIC_ACCOUNT_ID)
private final InheritableProperty<@Nullable AccountID> specificAccountID =
newInheritableProperty(PROPERTY_SPECIFIC_ACCOUNT_ID);

/// Returns the account used by `SPECIFIC` account selection mode property.
public InheritableProperty<@Nullable AccountID> specificAccountIDProperty() {
return specificAccountID;
}

/// Property name for the quick play target type.
public static final String PROPERTY_QUICK_PLAY = "quickPlay";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ public static class Choice<T extends @UnknownNullability Object> {
/// The optional subtitle shown on the right side.
protected @Nullable String subtitle;

/// The label rendering the current subtitle, kept for dynamic subtitle updates.
private @Nullable javafx.scene.control.Label subtitleLabel;

/// The optional tooltip installed on the radio button.
protected @Nullable String tooltip;

Expand Down Expand Up @@ -251,6 +254,9 @@ public Choice<T> setTitle(String title) {
/// Sets the optional subtitle.
public Choice<T> setSubtitle(@Nullable String subtitle) {
this.subtitle = subtitle;
if (subtitleLabel != null) {
subtitleLabel.setText(subtitle);
}
return this;
}

Expand Down Expand Up @@ -332,6 +338,7 @@ private Node createSubtitleLabel() {
label.getStyleClass().add("subtitle-label");
label.setStyle("-fx-font-size: 10;");
label.setPadding(new Insets(0, 0, 0, 15));
subtitleLabel = label;
return label;
}
}
Expand Down
Loading