[PR #7908] Dedicated server: /setidletimeout in game, and the minutes change while it runs #7890

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7908
Author: @MSedgeMC
Created: 11/3/2026
Status: 🔄 Open

Base: main ← Head: feat/setidletimeout


📝 Commits (3)

  • c8d567b feat: a dedicated server's players get /setidletimeout
  • a8f42e8 feat: /setidletimeout changes the running server's idle timeout
  • 4e403e2 feat: /setidletimeout runs in game and names the minutes

📊 Changes

6 files changed (+137 additions, -9 deletions)

View changed files

📝 crates/horizon-client/src/game/commands.rs (+1 -0)
📝 crates/horizon-client/src/game/commands/profiles.rs (+60 -5)
📝 crates/horizon-client/src/game/dedicated.rs (+9 -1)
📝 crates/horizon-command/src/tests.rs (+51 -1)
📝 crates/horizon-command/src/tree_extra.rs (+15 -2)
📝 crates/horizon-command/src/vanilla_order.rs (+1 -0)

📄 Description

What and why

On a dedicated server, /setidletimeout <minutes> did not exist. Vanilla registers it
(Commands.CommandSelection.includeDedicated), so an operator in game got "Unknown or
incomplete command", and the console did not know it either. The only way to change the
minutes was player-idle-timeout in server.properties, and even that was read once at
start-up into a local of the tick loop, so nothing could change it while the server ran.

This adds the command (SetPlayerIdleTimeoutCommand) and moves the value where vanilla has
it: a field of the server that the tick loop reads every tick, seeded from the property.

Parity notes:

  • LEVEL_ADMINS, IntegerArgumentType.integer(0) — 0 turns the timeout off, negative
    minutes are argument.integer.low, past i32 is parsing.int.invalid.
  • The reply is commands.setidletimeout.success with the minutes, or
    commands.setidletimeout.success.disabled for 0, broadcast as sendSuccess(..., true)
    is; the command's result is the number of minutes.
  • Registration order: vanilla puts setidletimeout after pardon-ip and before
    whitelist, which is where the root order table now has it.

Not in this PR: /save-all, /save-off, /save-on and /stop in the same tree — open
PR #7714 has those.

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.commands.SetPlayerIdleTimeoutCommand (register, setIdleTimeout)
and MinecraftServer.setPlayerIdleTimeout / PlayerList.tick, decompiled from the 26.3
jar. No parity harness covers these commands; the tests are unit tests:

  • a_dedicated_servers_admins_set_the_idle_timeout (horizon-command): the node exists on a
    dedicated tree only, at LEVEL_ADMINS, setidletimeout 0 and 5 execute, -1 is
    argument.integer.low, 2147483648 is parsing.int.invalid, a missing argument is
    command.unknown.command.
  • only_a_dedicated_server_has_the_dedicated_commands now lists setidletimeout.
  • the_idle_timeout_reply_names_the_minutes_or_says_it_is_off (horizon-client): the reply
    carries the minutes, and the disabled message has no argument.

Without the fix the first test fails at setidletimeout 0 with
command.unknown.command (input setidletimeout 0, cursor 0).

Other projects' code

none

Self-check

  • cargo fmt --all -- --check: clean
  • cargo clippy -p horizon-client -p horizon-command --all-targets -- -D warnings: clean
  • cargo test -p horizon-command --lib: 30 passed
  • cargo test -p horizon-client --lib: 710 passed, 5 ignored

🔄 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/7908 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/3/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/setidletimeout` --- ### 📝 Commits (3) - [`c8d567b`](https://github.com/horizon-rust/horizon/commit/c8d567b4540987ac12e493416aa9d77725a43750) feat: a dedicated server's players get /setidletimeout - [`a8f42e8`](https://github.com/horizon-rust/horizon/commit/a8f42e81c832baee244cbfec8f43bd0d2805c741) feat: /setidletimeout changes the running server's idle timeout - [`4e403e2`](https://github.com/horizon-rust/horizon/commit/4e403e2d34d2693a11aebaf0d84091e2da5d4dec) feat: /setidletimeout runs in game and names the minutes ### 📊 Changes **6 files changed** (+137 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/commands.rs` (+1 -0) 📝 `crates/horizon-client/src/game/commands/profiles.rs` (+60 -5) 📝 `crates/horizon-client/src/game/dedicated.rs` (+9 -1) 📝 `crates/horizon-command/src/tests.rs` (+51 -1) 📝 `crates/horizon-command/src/tree_extra.rs` (+15 -2) 📝 `crates/horizon-command/src/vanilla_order.rs` (+1 -0) </details> ### 📄 Description ## What and why On a dedicated server, `/setidletimeout <minutes>` did not exist. Vanilla registers it (`Commands.CommandSelection.includeDedicated`), so an operator in game got "Unknown or incomplete command", and the console did not know it either. The only way to change the minutes was `player-idle-timeout` in server.properties, and even that was read once at start-up into a local of the tick loop, so nothing could change it while the server ran. This adds the command (SetPlayerIdleTimeoutCommand) and moves the value where vanilla has it: a field of the server that the tick loop reads every tick, seeded from the property. Parity notes: - LEVEL_ADMINS, `IntegerArgumentType.integer(0)` — 0 turns the timeout off, negative minutes are `argument.integer.low`, past i32 is `parsing.int.invalid`. - The reply is `commands.setidletimeout.success` with the minutes, or `commands.setidletimeout.success.disabled` for 0, broadcast as `sendSuccess(..., true)` is; the command's result is the number of minutes. - Registration order: vanilla puts `setidletimeout` after `pardon-ip` and before `whitelist`, which is where the root order table now has it. Not in this PR: `/save-all`, `/save-off`, `/save-on` and `/stop` in the same tree — open PR #7714 has those. ## 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.commands.SetPlayerIdleTimeoutCommand` (`register`, `setIdleTimeout`) and `MinecraftServer.setPlayerIdleTimeout` / `PlayerList.tick`, decompiled from the 26.3 jar. No parity harness covers these commands; the tests are unit tests: - `a_dedicated_servers_admins_set_the_idle_timeout` (horizon-command): the node exists on a dedicated tree only, at LEVEL_ADMINS, `setidletimeout 0` and `5` execute, `-1` is `argument.integer.low`, `2147483648` is `parsing.int.invalid`, a missing argument is `command.unknown.command`. - `only_a_dedicated_server_has_the_dedicated_commands` now lists `setidletimeout`. - `the_idle_timeout_reply_names_the_minutes_or_says_it_is_off` (horizon-client): the reply carries the minutes, and the disabled message has no argument. Without the fix the first test fails at `setidletimeout 0` with `command.unknown.command` (input `setidletimeout 0`, cursor 0). ## Other projects' code none ## Self-check - `cargo fmt --all -- --check`: clean - `cargo clippy -p horizon-client -p horizon-command --all-targets -- -D warnings`: clean - `cargo test -p horizon-command --lib`: 30 passed - `cargo test -p horizon-client --lib`: 710 passed, 5 ignored --- <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#7890
No description provided.