feat(instance): align game server list with vanilla multiplayer - #2006
Dainsleif233 wants to merge 3 commits into
Conversation
Allow duplicate addresses like the in-game server list, key entries by servers.dat index for delete/reorder, add edit + move up/down, ping each server progressively, and cache pinged icons into servers.dat. Drop the hidden-server duplicate check that made empty lists reject adds. Also guard global keyboard shortcuts when event.key is missing.
Reviewer's GuideAligns Minecraft instance server management with vanilla multiplayer by allowing duplicate entries and indexed operations, adding edit/reorder controls, progressively querying and displaying status, persisting compatible icons, and updating the MCP and localization contracts. Sequence diagram for progressive game-server status refreshsequenceDiagram
participant UI as InstanceWorldsPage
participant Service as InstanceService
participant Backend as Tauri commands
participant Servers as servers.dat
participant Ping as Minecraft servers
UI->>Service: retrieveGameServerList(instanceId)
Service->>Backend: retrieve_game_server_list
Backend->>Servers: load_servers_info_from_nbt
Servers-->>Backend: visible entries with index
Backend-->>Service: local server list
Service-->>UI: render immediately
UI->>Service: queryGameServerOnlineStatus(instanceId, indexes)
Service->>Backend: query_game_server_online_status
Backend->>Ping: query_servers_online
loop Each completed ping
Ping-->>Backend: status and favicon
Backend-->>UI: instance:game-server-status
UI->>UI: applyQueriedServers
end
Backend->>Servers: persist_server_icons_to_nbt
Entity relationship diagram for indexed server entrieserDiagram
SERVERS_DAT_ENTRY {
usize index PK
string ip
string name
boolean hidden
string icon
}
VISIBLE_SERVER_ROW {
usize index FK
string ip
string name
boolean online
uint latency
}
SERVERS_DAT_ENTRY ||--o| VISIBLE_SERVER_ROW : "hidden entries excluded"
Flow diagram for indexed server-list operationsflowchart LR
List["Visible servers.dat entries"] --> Index["Entry index"]
Index --> Add["add_game_server\nappend; duplicates allowed"]
Index --> Edit["update_game_server\nupdate name/address"]
Index --> Delete["delete_game_server\nremove one entry"]
Index --> Move["move_game_server\nswap visible neighbors"]
Add --> List
Edit --> List
Delete --> List
Move --> List
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Waiting #1972 |
Replace mc-server-status with lite-mc-ping (UNIkeEN#1972) while keeping progressive per-server status events and servers.dat icon cache.
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/pages/instances/details/[id]/worlds.tsx" line_range="158-161" />
<code_context>
+ .filter((s) => s.isQueried)
+ .map((s) => [s.ip + "|" + s.name, s] as const)
+ );
+ return next.map((s) => {
+ const hit = statusMap.get(s.ip + "|" + s.name);
+ return hit ? hit : s;
+ });
+ });
+ }
</code_context>
<issue_to_address>
**issue (broader_impact):** When a delete or reorder shifts the `servers.dat` positions, `statusMap` returns the previous `GameServerInfo` object instead of the newly loaded object, preserving its stale `index`. Subsequent edit, move, or delete actions therefore target the wrong entry; duplicate entries with the same address and name also collapse into one status-map key.
**Triggers:** When the affected servers have already been queried and the list is reloaded with `preserveStatus: true`, such as after delete or reorder.
**Suggested fix:** Preserve queried status fields while retaining each newly loaded server's current `index` and identity, or key the map by `index` and update shifted entries explicitly.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and the new index-based delete, update, and reorder commands persist changes directly to servers.dat, so a wrong index or stale UI can remove or overwrite a saved server entry. Reverting the code would not restore those entries, although the impact is limited to the affected local server-list records and can be repaired manually.
Blocking findings: src/pages/instances/details/[id]/worlds.tsx:161
Merge only status fields after list reloads so delete/reorder cannot reuse a stale servers.dat index, and match duplicate address+name pairs in order.
Checklist
This PR is a ..
Related Issues
Description
Additional Context
Summary by Sourcery
Align instance game-server management with vanilla multiplayer semantics, including duplicate entries, index-based editing and ordering, progressive status updates, and icon persistence.
New Features:
Bug Fixes:
Enhancements:
Chores: