[PR #5544] [MERGED] Dedicated servers: /seed and /version need op, no /publish #6345

Closed
opened 2026-11-03 06:18:54 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5544
Author: @ludovic111
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: fix/dedicated-command-selection


📝 Commits (1)

  • 26748d7 Dedicated servers: /seed and /version need op, no /publish

📊 Changes

2 files changed (+88 additions, -6 deletions)

View changed files

📝 crates/horizon-command/src/tests.rs (+63 -2)
📝 crates/horizon-command/src/vanilla.rs (+25 -4)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Bug (live on the official server): any player could run /seed (and /version) on a Horizon dedicated server. Seed crackers then find bases, structures and diamonds on an SMP.

Vanilla (Commands.<init>, bytecode of the pinned 26.3 server via tools/rea_vanilla.py):

SeedCommand.register(this.dispatcher, commandSelection != CommandSelection.INTEGRATED);
VersionCommand.register(this.dispatcher, commandSelection != CommandSelection.INTEGRATED);
...
if (commandSelection.includeDedicated)  { BanIp, BanList, BanPlayer, DeOp, Op, Pardon, PardonIp, Perf, SaveAll, SaveOff, SaveOn, SetPlayerIdleTimeout, Stop, Transfer, Whitelist }
if (commandSelection.includeIntegrated) { Publish, Unpublish }

and SeedCommand.register(dispatcher, checkPermissions) → .requires(hasPermission(checkPermissions ? LEVEL_GAMEMASTERS : LEVEL_ALL)) (VersionCommand the same).

What changes: vanilla::build_for(dev, dedicated = true) (the tree game_dispatcher returns once --dedicated calls set_dedicated_commands) now applies the whole DEDICATED selection in one place (dedicated_selection):

  • seed and version: level 2 (game masters). A level-0 player gets vanilla's command.unknown.command, /help and Tab no longer list them.
  • publish and unpublish: not registered (integrated only).
  • the dedicated commands already there (/op, /ban, /whitelist...) unchanged.

The integrated server (single player's server thread, a LAN world) keeps vanilla's INTEGRATED rules: /seed for everyone, /publish, no /op. The Commands packet (lan/commands.rs) already followed the selection; this fixes the executor, which is what let the command run.

Not in this PR: /perf, /save-*, /stop, /setidletimeout, /transfer stay console-only in the executor (the packet lists them to ops; running them from chat is still "unknown command").

Tests: a_dedicated_server_keeps_seed_and_version_for_game_masters (root suggestions at level 0 per selection, /seed and /version refused at level 0 and run at level 2 on dedicated, open on integrated); only_a_dedicated_server_has_the_dedicated_commands now also checks /publish, /unpublish; commands_need_allow_commands keeps the integrated list.

pr_ready (tools/pr_ready.py on ludovics-mac-mini, against origin/main at a4873dec4, 60 min 40 s)

Check Result
Scope ✅ 2 files, +88 −6
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 510 passed (3 min 43 s)
rustfmt ✅ (5 s)
clippy ✅ (3 min 1 s)
tests: horizon-command ✅ 27 passed
doc tests ✅ 0 passed (2 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ❌ 44 affected, 41 passed, failed: dedicated_server, online_mode (52 min 38 s)
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Parity's 2 failures predate this PR and don't involve commands: online_mode (this Mac's IndexError on a stray GET /, fails on main too) and dedicated_server (config-phase minecraft:dialog registry data from #4698, the stage before any command).

🤖 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/5544 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/dedicated-command-selection` --- ### 📝 Commits (1) - [`26748d7`](https://github.com/horizon-rust/horizon/commit/26748d7c11b9dac5303e189803099beb346d73e2) Dedicated servers: /seed and /version need op, no /publish ### 📊 Changes **2 files changed** (+88 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-command/src/tests.rs` (+63 -2) 📝 `crates/horizon-command/src/vanilla.rs` (+25 -4) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. **Bug (live on the official server):** any player could run `/seed` (and `/version`) on a Horizon dedicated server. Seed crackers then find bases, structures and diamonds on an SMP. **Vanilla** (`Commands.<init>`, bytecode of the pinned 26.3 server via `tools/rea_vanilla.py`): ```java SeedCommand.register(this.dispatcher, commandSelection != CommandSelection.INTEGRATED); VersionCommand.register(this.dispatcher, commandSelection != CommandSelection.INTEGRATED); ... if (commandSelection.includeDedicated) { BanIp, BanList, BanPlayer, DeOp, Op, Pardon, PardonIp, Perf, SaveAll, SaveOff, SaveOn, SetPlayerIdleTimeout, Stop, Transfer, Whitelist } if (commandSelection.includeIntegrated) { Publish, Unpublish } ``` and `SeedCommand.register(dispatcher, checkPermissions)` → `.requires(hasPermission(checkPermissions ? LEVEL_GAMEMASTERS : LEVEL_ALL))` (VersionCommand the same). **What changes:** `vanilla::build_for(dev, dedicated = true)` (the tree `game_dispatcher` returns once `--dedicated` calls `set_dedicated_commands`) now applies the whole DEDICATED selection in one place (`dedicated_selection`): - `seed` and `version`: level 2 (game masters). A level-0 player gets vanilla's `command.unknown.command`, `/help` and Tab no longer list them. - `publish` and `unpublish`: not registered (integrated only). - the dedicated commands already there (`/op`, `/ban`, `/whitelist`...) unchanged. The integrated server (single player's server thread, a LAN world) keeps vanilla's INTEGRATED rules: `/seed` for everyone, `/publish`, no `/op`. The Commands packet (`lan/commands.rs`) already followed the selection; this fixes the executor, which is what let the command run. Not in this PR: `/perf`, `/save-*`, `/stop`, `/setidletimeout`, `/transfer` stay console-only in the executor (the packet lists them to ops; running them from chat is still "unknown command"). **Tests:** `a_dedicated_server_keeps_seed_and_version_for_game_masters` (root suggestions at level 0 per selection, `/seed` and `/version` refused at level 0 and run at level 2 on dedicated, open on integrated); `only_a_dedicated_server_has_the_dedicated_commands` now also checks `/publish`, `/unpublish`; `commands_need_allow_commands` keeps the integrated list. **pr_ready** (`tools/pr_ready.py` on ludovics-mac-mini, against origin/main at a4873dec4, 60 min 40 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +88 −6 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 510 passed (3 min 43 s) | | rustfmt | ✅ (5 s) | | clippy | ✅ (3 min 1 s) | | tests: horizon-command | ✅ 27 passed | | doc tests | ✅ 0 passed (2 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ❌ 44 affected, 41 passed, failed: dedicated_server, online_mode (52 min 38 s) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Parity's 2 failures predate this PR and don't involve commands: `online_mode` (this Mac's IndexError on a stray GET /, fails on main too) and `dedicated_server` (config-phase `minecraft:dialog` registry data from #4698, the stage before any command). 🤖 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>
bsakaguchi 2026-11-03 06:18:54 +07:00
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#6345
No description provided.