[PR #7714] Dedicated server: operators can run /stop, /save-all, /save-on, /save… #7780

Open
opened 2026-11-03 07:24:03 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7714
Author: @hello23113
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: fix/dedicated-operator-stop-save


📝 Commits (1)

  • 9608a5d Dedicated server: operators can run /stop, /save-all, /save-on, /save-off

📊 Changes

9 files changed (+138 additions, -19 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+4 -0)
📝 crates/horizon-client/src/game/commands.rs (+3 -0)
📝 crates/horizon-client/src/game/commands/profiles.rs (+59 -1)
📝 crates/horizon-client/src/game/dedicated.rs (+19 -15)
📝 crates/horizon-client/src/game/dedicated/management.rs (+1 -1)
📝 crates/horizon-client/src/game/lan_actions.rs (+6 -1)
📝 crates/horizon-command/src/tests.rs (+30 -1)
📝 crates/horizon-command/src/tree_extra.rs (+12 -0)
📝 crates/horizon-command/src/vanilla_order.rs (+4 -0)

📄 Description

🤖 Opened by hello23113's AI agent (Claude Code, Claude Opus 5.5), not by hello23113 personally.

What and why

Fixes #7667

On a dedicated server, a level-4 operator now has /stop, /save-all (and save-all flush), /save-off and /save-on. Before this they existed only on the server console, so an operator in game got "Unknown or incomplete command".

  • tree_extra.rs: the four commands in the dedicated tree at level 4; vanilla_order.rs: vanilla's order (after pardon-ip).
  • dedicated.rs: stop and autosave moved from the loop's ServerState into the shared Lists, so the console, the management protocol and a player's command change the same switches.
  • commands/profiles.rs: the handlers. A guest's /save-all saves once their turn ends (run_guest_command): during the turn their record holds the game's state, and saving then would write it to their file.
  • Not done: the other operators aren't told of a guest's /save-all (marked shortcut:). /perf, /setidletimeout, /transfer and /debugconfig are still missing, also on the console.

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

net.minecraft.commands.Commands.<init>: under CommandSelection.includeDedicated it registers SaveAllCommand, SaveOffCommand, SaveOnCommand and StopCommand (read from the 26.3 server jar with javap). Each requires Commands.LEVEL_OWNERS. Replies: commands.stop.stopping, commands.save.saving / success / failed, commands.save.enabled / disabled / alreadyOn / alreadyOff.

No parity harness covers these. Checked with a new unit test (a_dedicated_servers_owners_can_stop_and_save_it, extended only_a_dedicated_server_has_the_dedicated_commands) and by hand on a real dedicated server with two clients:

  • Level 3 op: stop, save-all and save-off give "Unknown or incomplete command".
  • Level 4 op: save-off twice gives "disabled", then "already turned off"; save-on likewise; save-all and save-all flush give "Saving…", then "Saved the game".
  • After tp 100 90 100 then save-all, the player's .dat holds their own position.
  • stop saves and shuts the server down.

Other projects' code

none

Self-check

pr_ready (tools/pr_ready.py --quick on DESKTOP-CJ53OBT, against origin/main at 97937bcf8, 4 min 52 s)

Check Result
Scope ✅ 9 files, +126 −19
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 591 run, FAILED (errors=12, skipped=12) (1 min 34 s)
rustfmt ❌ failed (10 s)
Rust ⚠️ 1.96.0 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with rustup update
clippy ❌ failed; likely the old Rust above (20 s)
tests: horizon-client, horizon-command ✅ 728 passed (2 min 14 s)
doc tests ✅ 0 passed (7 s)
content root tests ➖ content root untouched
mod API up to date ✅ (23 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Notes on the ❌ rows:

  • rustfmt: fixed after this run with cargo fmt; cargo fmt --check is clean on the commit.
  • clippy: the only errors are nonminimal_bool / manual_range_contains in files this PR doesn't touch (Rust 1.96 here, 1.99 in CI). cargo clippy --no-deps -p horizon-command -p horizon-client --lib --bins --tests -- -D warnings without those two lints is clean.
  • Python tests: the same run on unmodified main has 18 errors (Windows environment: lab, nightly, CI-runner tests).

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/7714 **Author:** [@hello23113](https://github.com/hello23113) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/dedicated-operator-stop-save` --- ### 📝 Commits (1) - [`9608a5d`](https://github.com/horizon-rust/horizon/commit/9608a5d84175a30f27d1004b83af6bb86670701f) Dedicated server: operators can run /stop, /save-all, /save-on, /save-off ### 📊 Changes **9 files changed** (+138 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+4 -0) 📝 `crates/horizon-client/src/game/commands.rs` (+3 -0) 📝 `crates/horizon-client/src/game/commands/profiles.rs` (+59 -1) 📝 `crates/horizon-client/src/game/dedicated.rs` (+19 -15) 📝 `crates/horizon-client/src/game/dedicated/management.rs` (+1 -1) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+6 -1) 📝 `crates/horizon-command/src/tests.rs` (+30 -1) 📝 `crates/horizon-command/src/tree_extra.rs` (+12 -0) 📝 `crates/horizon-command/src/vanilla_order.rs` (+4 -0) </details> ### 📄 Description > 🤖 Opened by hello23113's AI agent (Claude Code, Claude Opus 5.5), not by hello23113 personally. ## What and why Fixes #7667 On a dedicated server, a level-4 operator now has `/stop`, `/save-all` (and `save-all flush`), `/save-off` and `/save-on`. Before this they existed only on the server console, so an operator in game got "Unknown or incomplete command". - `tree_extra.rs`: the four commands in the dedicated tree at level 4; `vanilla_order.rs`: vanilla's order (after `pardon-ip`). - `dedicated.rs`: `stop` and `autosave` moved from the loop's `ServerState` into the shared `Lists`, so the console, the management protocol and a player's command change the same switches. - `commands/profiles.rs`: the handlers. A guest's `/save-all` saves once their turn ends (`run_guest_command`): during the turn their record holds the game's state, and saving then would write it to their file. - Not done: the other operators aren't told of a guest's `/save-all` (marked `shortcut:`). `/perf`, `/setidletimeout`, `/transfer` and `/debugconfig` are still missing, also on the console. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference `net.minecraft.commands.Commands.<init>`: under `CommandSelection.includeDedicated` it registers `SaveAllCommand`, `SaveOffCommand`, `SaveOnCommand` and `StopCommand` (read from the 26.3 server jar with `javap`). Each requires `Commands.LEVEL_OWNERS`. Replies: `commands.stop.stopping`, `commands.save.saving` / `success` / `failed`, `commands.save.enabled` / `disabled` / `alreadyOn` / `alreadyOff`. No parity harness covers these. Checked with a new unit test (`a_dedicated_servers_owners_can_stop_and_save_it`, extended `only_a_dedicated_server_has_the_dedicated_commands`) and by hand on a real dedicated server with two clients: - Level 3 op: `stop`, `save-all` and `save-off` give "Unknown or incomplete command". - Level 4 op: `save-off` twice gives "disabled", then "already turned off"; `save-on` likewise; `save-all` and `save-all flush` give "Saving…", then "Saved the game". - After `tp 100 90 100` then `save-all`, the player's `.dat` holds their own position. - `stop` saves and shuts the server down. ## Other projects' code none ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on DESKTOP-CJ53OBT, against origin/main at 97937bcf8, 4 min 52 s) | Check | Result | | --- | --- | | Scope | ✅ 9 files, +126 −19 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 591 run, FAILED (errors=12, skipped=12) (1 min 34 s) | | rustfmt | ❌ failed (10 s) | | Rust | ⚠️ 1.96.0 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with `rustup update` | | clippy | ❌ failed; likely the old Rust above (20 s) | | tests: horizon-client, horizon-command | ✅ 728 passed (2 min 14 s) | | doc tests | ✅ 0 passed (7 s) | | content root tests | ➖ content root untouched | | mod API up to date | ✅ (23 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Notes on the ❌ rows: - **rustfmt:** fixed after this run with `cargo fmt`; `cargo fmt --check` is clean on the commit. - **clippy:** the only errors are `nonminimal_bool` / `manual_range_contains` in files this PR doesn't touch (Rust 1.96 here, 1.99 in CI). `cargo clippy --no-deps -p horizon-command -p horizon-client --lib --bins --tests -- -D warnings` without those two lints is clean. - **Python tests:** the same run on unmodified main has 18 errors (Windows environment: lab, nightly, CI-runner tests). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#7780
No description provided.