Skip to content

新增服务器管理界面以及适配 26.4 带参数的服务器地址 - #4962

Open
CaaMoe wants to merge 104 commits into
HMCL-dev:mainfrom
CaaMoe:main
Open

CaaMoe wants to merge 104 commits into
HMCL-dev:mainfrom
CaaMoe:main

Conversation

@CaaMoe

@CaaMoe CaaMoe commented Dec 10, 2025 •

Copy link
Copy Markdown

新增服务器管理界面,并适配 26.4 带参数的服务器地址

close #5246

概述

在实例页面新增「服务器管理」标签页,用于查看和编辑实例的 servers.dat:

  • 实时显示服务器的状态和延迟。
  • 一键启动游戏并直接连接服务器。
  • 支持把服务器拖进启动器窗口来添加。

同时支持 26.4-snapshot-1 引入的带参数服务器地址([id@]host[:port][?key=value...])。这也修复了快速游玩「多人游戏」填写带参数的地址后不生效的问题。

image

Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/server/ServerListPage.java Outdated
@CaaMoe
CaaMoe requested a review from zkitefly December 10, 2025 05:30
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/SVG.java Outdated
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/server/ServerListItem.java Outdated
@CaaMoe
CaaMoe requested a review from Mine-diamond December 10, 2025 07:46
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/SVG.java Outdated
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/SVG.java Outdated
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/server/ServerData.java Outdated
@burningtnt

Copy link
Copy Markdown
Member

不要使用 ImageIO 来加载图片。请参阅 FXUtils 以查看图片替代方案

@CaaMoe
CaaMoe requested a review from CiiLu December 11, 2025 02:46
Comment thread HMCL/src/main/resources/assets/lang/I18N.properties Outdated
Comment thread HMCL/src/main/resources/assets/lang/I18N.properties Outdated
Comment thread HMCL/src/main/resources/assets/lang/I18N_ja.properties Outdated
Comment thread HMCL/src/main/resources/assets/lang/I18N_zh.properties Outdated
Comment thread HMCL/src/main/resources/assets/lang/I18N.properties Outdated
Comment thread HMCL/src/main/resources/assets/lang/I18N.properties Outdated
Comment thread HMCL/src/main/resources/assets/lang/I18N.properties Outdated
@3gf8jv4dv

Copy link
Copy Markdown
Contributor

图标可以考虑下这个:

Image

Comment thread HMCL/src/main/resources/assets/lang/I18N_zh.properties Outdated
@CaaMoe
CaaMoe requested a review from 3gf8jv4dv December 11, 2025 08:31
@3gf8jv4dv

Copy link
Copy Markdown
Contributor

假如有多个实例的「版本隔离」为「默认」,且 .minecraft 目录下有 servers.dat文件。

这时候切到另一个实例的「服务器管理」列表,勾选「显示全部」,会显示多个重复的条目。

这种情况是否需要解决?

@CaaMoe

CaaMoe commented Dec 11, 2025

Copy link
Copy Markdown
Author

假如有多个实例的「版本隔离」为「默认」,且 .minecraft 目录下有 servers.dat文件。

这时候切到另一个实例的「服务器管理」列表,勾选「显示全部」,会显示多个重复的条目。

这种情况是否需要解决?

这看起来的确是个问题, 已经整改好了, 确保他们不会重复读取和显示。

@3gf8jv4dv

3gf8jv4dv commented Dec 11, 2025 •

Copy link
Copy Markdown
Contributor

我看了一下。建议:

  1. 对于当前实例会使用的条目,标签显示为「当前实例」或类似内容。
    这样,对于有大量实例用户,可以快速区分。

  2. 说实话, server.tag.public 这个文本语义不明。
    类似于第一条。如果能显示会使用它的实例,那么会更明了。

    以下是我的设想:

    当 .minecraft\servers.dat 存在时:

    • A 实例「版本隔离」为「各版本独立」,附带 servers.dat
    • B 实例「版本隔离」为「默认」
    • C 实例「版本隔离」为「各版本独立」,附带 servers.dat
    • D 实例「版本隔离」为「默认」

    这时在 C 实例的「服务器管理」页,勾选「显示所有」:

    • A 实例附带的 servers.dat 内条目,标签显示为「Name-A」
    • B、D 实例会使用的 .minecraft\servers.dat 内条目,标签不是含糊的「默认」,而是清晰显示「Name-B」「Name-D」两个标签
    • C 实例附带的 servers.dat 内条目,标签显示为「当前实例」

    如果进入 B 实例的「服务器管理」页,勾选「显示所有」:

    • A 实例附带的 servers.dat 内条目,标签显示为「Name-A」
    • B、D 实例会使用的 .minecraft\servers.dat 内条目,标签显示为「当前实例」和「Name-D」
    • C 实例附带的 servers.dat 内条目,标签显示为「Name-C」

@CaaMoe

CaaMoe commented Dec 12, 2025

Copy link
Copy Markdown
Author

我看了一下。建议:

  1. 对于当前实例会使用的条目,标签显示为「当前实例」或类似内容。
    这样,对于有大量实例用户,可以快速区分。

  2. 说实话, server.tag.public 这个文本语义不明。
    类似于第一条。如果能显示会使用它的实例,那么会更明了。
    以下是我的设想:
    当 .minecraft\servers.dat 存在时:

    • A 实例「版本隔离」为「各版本独立」,附带 servers.dat
    • B 实例「版本隔离」为「默认」
    • C 实例「版本隔离」为「各版本独立」,附带 servers.dat
    • D 实例「版本隔离」为「默认」

    这时在 C 实例的「服务器管理」页,勾选「显示所有」:

    • A 实例附带的 servers.dat 内条目,标签显示为「Name-A」
    • B、D 实例会使用的 .minecraft\servers.dat 内条目,标签不是含糊的「默认」,而是清晰显示「Name-B」「Name-D」两个标签
    • C 实例附带的 servers.dat 内条目,标签显示为「当前实例」

    如果进入 B 实例的「服务器管理」页,勾选「显示所有」:

    • A 实例附带的 servers.dat 内条目,标签显示为「Name-A」
    • B、D 实例会使用的 .minecraft\servers.dat 内条目,标签显示为「当前实例」和「Name-D」
    • C 实例附带的 servers.dat 内条目,标签显示为「Name-C」

我根据你的描述重新设计了holder, 这是效果:
image

image

@3gf8jv4dv 3gf8jv4dv left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

图标可以改一下。暂时没其他意见。

Comment thread HMCL/src/main/resources/assets/lang/I18N_zh.properties Outdated
@CaaMoe

CaaMoe commented Jan 31, 2026

Copy link
Copy Markdown
Author

图标可以改一下。暂时没其他意见。

图标还能改成啥样呢,没找到有更好康的

@Calboot

Calboot commented Feb 1, 2026

Copy link
Copy Markdown
Contributor

图标还能改成啥样呢,没找到有更好康的

可以直接尝试获取对应服务器的图标?

@3gf8jv4dv

Copy link
Copy Markdown
Contributor

图标还能改成啥样呢,没找到有更好康的

这个 #4962 (comment)

@github-actions github-actions Bot added the 500+ label Jul 17, 2026
@ToobLac

ToobLac commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

还有动静吗

@CaaMoe

CaaMoe commented Sep 20, 2026

Copy link
Copy Markdown
Author

未同步的改动太多了,我重新调整了一份,相比较于之前的改动添加了方便快速启动并且连接到指定服务器的功能
image

Comment thread HMCLCore/src/main/java/org/jackhuang/hmcl/game/World.java Outdated

@Glavo Glavo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

本审查建议由 GPT-6 Astra 生成


已将具体审查建议标注在对应代码行。

Comment thread HMCLCore/src/main/java/org/jackhuang/hmcl/server/sorage/ServerStorage.java Outdated
Comment thread HMCLCore/src/main/java/org/jackhuang/hmcl/util/ServerAddress.java Outdated
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/instances/server/ServerStatusPane.java Outdated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 Static analysis found the following issues (max count 10):

Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/instances/server/ServerListPage.java Outdated
@CaaMoe
CaaMoe requested a review from Glavo October 12, 2026 18:19

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] 添加服务器管理功能

9 participants