Skip to content

fix: 修复快速启动按钮出现在不支持的版本的bug#5461

Merged
Glavo merged 7 commits intoHMCL-dev:mainfrom
Mine-diamond:fix-world-launch
Feb 8, 2026
Merged

fix: 修复快速启动按钮出现在不支持的版本的bug#5461
Glavo merged 7 commits intoHMCL-dev:mainfrom
Mine-diamond:fix-world-launch

Conversation

@Mine-diamond
Copy link
Copy Markdown
Contributor

修复了两个问题:

  1. 之前判断是否正常快速启动使用的是世界版本,现在修改为实例版本
  2. 之前在世界列表显示快速启动按钮没有做判断,现在做了,不支持的版本不会显示

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 修复“快速启动/Quick Play”相关的版本判断逻辑:将是否支持快速启动的判断从“世界版本”调整为“实例(游戏)版本”,并在世界列表中对快速启动入口增加不支持版本的显示控制,避免在不支持的版本中出现快速启动按钮。

Changes:

  • WorldManagePage:将构造参数/内部字段由 versionId 改为 instanceId,并用实例的 gameVersion 判断是否支持 Quick Play,从而控制管理页中的快速启动入口。
  • WorldListPage:新增基于实例版本的 supportQuickPlay 属性,并在世界列表 cell 中按该属性控制快速启动按钮的显示/布局占位。

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/WorldManagePage.java 以实例版本判断 Quick Play 支持性,并将启动/脚本生成逻辑切换为使用 instanceId
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/WorldListPage.java 增加实例级 supportQuickPlay 状态并绑定到列表快速启动按钮可见性

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +93 to +95
Optional<String> gameVersion = profile.getRepository().getGameVersion(instanceId);
supportQuickPlay = World.supportQuickPlay(GameVersionNumber.asGameVersion(gameVersion));

Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

profile.getRepository().getGameVersion(instanceId) is documented as time-consuming (jar detection) and should run on the IO scheduler; calling it in the WorldManagePage constructor (FX thread) can freeze the UI. Consider computing supportQuickPlay asynchronously (e.g., Task.supplyAsync(Schedulers.io(), ...) / Platform.runLater) and exposing it as a BooleanProperty so the toolbar/menu visibility can react when the value arrives from cache/detection.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

真的吗?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

private List<World> worlds;
private Profile profile;
private String instanceId;
private final BooleanProperty supportQuickPlay = new SimpleBooleanProperty(this, "supportQuickPlay", false);
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

supportQuickPlay is stored on the WorldListPage instance, and WorldListPage is reused across instance switches (VersionPage.loadVersion(...) calls loadVersion(...) on already-initialized tabs). If the user switches to another instance, supportQuickPlay will keep the previous instance’s value until the async refresh() completes, which can briefly show the quick-play button/menu items for an unsupported instance. Consider resetting supportQuickPlay to false in loadVersion(...) (or at the beginning of refresh()) before starting the background task.

Copilot uses AI. Check for mistakes.
Comment on lines +126 to +128
Optional<String> gameVersion = profile.getRepository().getGameVersion(instanceId);
supportQuickPlay.set(World.supportQuickPlay(GameVersionNumber.asGameVersion(gameVersion)));

Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In whenComplete(Schedulers.javafx(), ...), this re-invokes profile.getRepository().getGameVersion(instanceId) on the JavaFX thread. Even though you try to “warm” the cache in the background task, getGameVersion is documented as time-consuming; it’s safer to compute the Optional<String> (or the boolean supportQuickPlay) in the IO task and pass it to the FX continuation, avoiding any potential UI-thread blocking if caching behavior changes or the warm-up call is skipped.

Copilot uses AI. Check for mistakes.
@Glavo Glavo merged commit 10df7a8 into HMCL-dev:main Feb 8, 2026
2 checks passed
@Mine-diamond Mine-diamond deleted the fix-world-launch branch February 8, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants