[PR #6443] [MERGED] RCON: commands run from the Rcon source, and broadcast-rcon-to-ops tells the operators #6876

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6443
Author: @Akirabane
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: feat/6393-rcon-source


📝 Commits (2)

  • be156ad RCON: commands run from a source named Rcon, and broadcast-rcon-to-ops tells the operators
  • 4ef3033 Merge remote-tracking branch 'origin/main' into feat/6393-rcon-source

📊 Changes

8 files changed (+77 additions, -15 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+4 -0)
📝 crates/horizon-client/src/game/commands.rs (+10 -3)
📝 crates/horizon-client/src/game/dedicated.rs (+26 -3)
📝 crates/horizon-client/src/game/dedicated/status.rs (+12 -0)
📝 crates/horizon-server/src/rcon.rs (+16 -4)
📝 docs/hosting.md (+4 -2)
📝 docs/server.md (+4 -2)
📝 tools/port_map/rest-020.tsv (+1 -1)

📄 Description

🤖 Opened by both Akirabane's AI agent (Claude Code), and Akirabane Himself after his review.

What and why

Fixes #6393

An RCON command ran as the server's console: the operators in game saw nothing of what it did, and its say read [Server]. It now runs as vanilla's RconConsoleSource runs it.

  • A new control request rcon <line> (dedicated/status.rs) beside console <line>: the same console at level 4, from a source named Rcon (RconConsoleSource.createCommandSourceStack). rcon.rs sends it instead of console.
  • Its feedback reaches the operators in game as [Rcon: message] (gray, italic, through the existing send_admin_feedback) while broadcast-rcon-to-ops is on (CommandSource.shouldInformAdmins, default true), and not when it is off. The key was read from server.properties and used nowhere.
  • A say from RCON reads [Rcon] message and leaves the reply empty, as vanilla's does.
  • The console and an RCON client take success feedback whatever send_command_feedback says (CommandSource.acceptsSuccess is true for them; it is the rule for a player's source). The reply to an RCON client still carried nothing while the rule was off; it now matches vanilla's.
  • Docs (docs/server.md, docs/hosting.md) and the ledger row of RconConsoleSource.createCommandSourceStack.

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.server.rcon.RconConsoleSource (createCommandSourceStack: the Overworld's respawn position, rotation zero, LevelBasedPermissionSet.OWNER, named Rcon; acceptsSuccess and acceptsFailure true; shouldInformAdmins = MinecraftServer.shouldRconBroadcast), read with javap on the 26.3 server jar. No harness: the comparison below was run by hand.

Other projects' code

none

Self-check

pr_ready (tools/pr_ready.py --quick on DESKTOP-6PU1HU6, against origin/main at cfc7278a4, 5 min 18 s)

Check Result
Scope ✅ 8 files, +77 −15
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 594 run, 1 error, not from this change: test_port_ledger fails to import here (a package named tests on my Windows machine shadows the repo's; python -m unittest tests.test_port_ledger passes)
rustfmt ✅ (8 s)
clippy ✅ (49 s)
tests: horizon-client, horizon-server ❌ 583 passed, 2 failed: native_hooks::tests::native_breathing_stays_hookable and native_loot_kinds_stay_hookable. They search the source text for `"
}
"`, which a Windows checkout with CRLF line endings never has, and they read files this change doesn't touch
doc tests ✅ 0 passed (1 min 17 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 ➖ 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)

Proof

Against a vanilla 26.3 server. Mojang's server.jar and Horizon's horizon-server each ran with enable-rcon, the same password, online-mode=false and no whitelist; an operator joined (a Horizon client, headless) and a Python RCON client sent the same nine commands to each, once with broadcast-rcon-to-ops=true and once with false. For each command the text returned to the RCON client and what the operator received were compared: 18 comparisons, all identical.

Command Reply to the RCON client Operator, true Operator, false
time set 1000 Set minecraft:overworld to 1000 tick(s) [Rcon: Set minecraft:overworld to 1000 tick(s)] nothing
setblock ~ ~ ~ minecraft:stone after setworldspawn 10 70 10 Changed the block at 10, 70, 10 [Rcon: Changed the block at 10, 70, 10] nothing
say hi empty [Rcon] hi [Rcon] hi
difficulty (a query) The difficulty is Easy nothing nothing
time set 2000 with send_command_feedback false Set minecraft:overworld to 2000 tick(s) nothing nothing

(The first comparison, run before the say and send_command_feedback fixes in this change, showed exactly those three differences: say hi read [Server] with a non-empty reply, and the two commands sent while send_command_feedback was off got an empty reply. The operator side matched from the start.)

Unit tests: the control request's wording, and the ten existing RCON tests, two of which now answer the rcon request.


🔄 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/6443 **Author:** [@Akirabane](https://github.com/Akirabane) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/6393-rcon-source` --- ### 📝 Commits (2) - [`be156ad`](https://github.com/horizon-rust/horizon/commit/be156ad9fc246484661fd4d4a5663b911a63ed4b) RCON: commands run from a source named Rcon, and broadcast-rcon-to-ops tells the operators - [`4ef3033`](https://github.com/horizon-rust/horizon/commit/4ef3033c2197d4b8b0c9f1ff49676b4dbac626f8) Merge remote-tracking branch 'origin/main' into feat/6393-rcon-source ### 📊 Changes **8 files changed** (+77 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+4 -0) 📝 `crates/horizon-client/src/game/commands.rs` (+10 -3) 📝 `crates/horizon-client/src/game/dedicated.rs` (+26 -3) 📝 `crates/horizon-client/src/game/dedicated/status.rs` (+12 -0) 📝 `crates/horizon-server/src/rcon.rs` (+16 -4) 📝 `docs/hosting.md` (+4 -2) 📝 `docs/server.md` (+4 -2) 📝 `tools/port_map/rest-020.tsv` (+1 -1) </details> ### 📄 Description 🤖 Opened by both Akirabane's AI agent (Claude Code), and Akirabane Himself after his review. ## What and why Fixes #6393 An RCON command ran as the server's console: the operators in game saw nothing of what it did, and its `say` read `[Server]`. It now runs as vanilla's `RconConsoleSource` runs it. - A new control request `rcon <line>` (`dedicated/status.rs`) beside `console <line>`: the same console at level 4, from a source named `Rcon` (`RconConsoleSource.createCommandSourceStack`). `rcon.rs` sends it instead of `console`. - Its feedback reaches the operators in game as `[Rcon: message]` (gray, italic, through the existing `send_admin_feedback`) while `broadcast-rcon-to-ops` is on (`CommandSource.shouldInformAdmins`, default `true`), and not when it is off. The key was read from `server.properties` and used nowhere. - A `say` from RCON reads `[Rcon] message` and leaves the reply empty, as vanilla's does. - The console and an RCON client take success feedback whatever `send_command_feedback` says (`CommandSource.acceptsSuccess` is true for them; it is the rule for a player's source). The reply to an RCON client still carried nothing while the rule was off; it now matches vanilla's. - Docs (`docs/server.md`, `docs/hosting.md`) and the ledger row of `RconConsoleSource.createCommandSourceStack`. ## 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.server.rcon.RconConsoleSource` (`createCommandSourceStack`: the Overworld's respawn position, rotation zero, `LevelBasedPermissionSet.OWNER`, named `Rcon`; `acceptsSuccess` and `acceptsFailure` true; `shouldInformAdmins` = `MinecraftServer.shouldRconBroadcast`), read with `javap` on the 26.3 server jar. No harness: the comparison below was run by hand. ## Other projects' code none ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on DESKTOP-6PU1HU6, against origin/main at cfc7278a4, 5 min 18 s) | Check | Result | | --- | --- | | Scope | ✅ 8 files, +77 −15 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 594 run, 1 error, not from this change: `test_port_ledger` fails to import here (a package named `tests` on my Windows machine shadows the repo's; `python -m unittest tests.test_port_ledger` passes) | | rustfmt | ✅ (8 s) | | clippy | ✅ (49 s) | | tests: horizon-client, horizon-server | ❌ 583 passed, 2 failed: `native_hooks::tests::native_breathing_stays_hookable` and `native_loot_kinds_stay_hookable`. They search the source text for `" } "`, which a Windows checkout with CRLF line endings never has, and they read files this change doesn't touch | | doc tests | ✅ 0 passed (1 min 17 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 | ➖ 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) | ## Proof **Against a vanilla 26.3 server.** Mojang's `server.jar` and Horizon's `horizon-server` each ran with `enable-rcon`, the same password, `online-mode=false` and no whitelist; an operator joined (a Horizon client, headless) and a Python RCON client sent the same nine commands to each, once with `broadcast-rcon-to-ops=true` and once with `false`. For each command the text returned to the RCON client and what the operator received were compared: **18 comparisons, all identical.** | Command | Reply to the RCON client | Operator, `true` | Operator, `false` | | --- | --- | --- | --- | | `time set 1000` | `Set minecraft:overworld to 1000 tick(s)` | `[Rcon: Set minecraft:overworld to 1000 tick(s)]` | nothing | | `setblock ~ ~ ~ minecraft:stone` after `setworldspawn 10 70 10` | `Changed the block at 10, 70, 10` | `[Rcon: Changed the block at 10, 70, 10]` | nothing | | `say hi` | empty | `[Rcon] hi` | `[Rcon] hi` | | `difficulty` (a query) | `The difficulty is Easy` | nothing | nothing | | `time set 2000` with `send_command_feedback false` | `Set minecraft:overworld to 2000 tick(s)` | nothing | nothing | (The first comparison, run before the `say` and `send_command_feedback` fixes in this change, showed exactly those three differences: `say hi` read `[Server]` with a non-empty reply, and the two commands sent while `send_command_feedback` was off got an empty reply. The operator side matched from the start.) Unit tests: the control request's wording, and the ten existing RCON tests, two of which now answer the `rcon` request. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:28:30 +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#6876
No description provided.