[PR #1932] [MERGED] Chat: the Chat option hides what it says it hides #3874

Closed
opened 2026-11-03 04:12:56 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1932
Author: @levzzz5154
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: fix/chat-visibility


📝 Commits (4)

  • b3807d6 Chat: the Chat option hides what it says it hides
  • 1e6f05e Chat option: filter the chat's lines both ways, as setVisibleMessageFilter
  • 6e15257 Merge remote-tracking branch 'origin/main' into cg15/1932
  • 2256941 Chat: mod output lines are the client's own

📊 Changes

10 files changed (+384 additions, -49 deletions)

View changed files

📝 crates/horizon-client/examples/probe/chat_screen_fixture.rs (+2 -1)
📝 crates/horizon-client/examples/probe/hud_fixture/kinds.rs (+1 -0)
📝 crates/horizon-client/src/chat.rs (+167 -10)
📝 crates/horizon-client/src/chat_tests.rs (+114 -5)
📝 crates/horizon-client/src/game.rs (+3 -0)
📝 crates/horizon-client/src/game/chat.rs (+36 -8)
📝 crates/horizon-client/src/game/commands.rs (+8 -3)
📝 crates/horizon-client/src/game/lan_screen.rs (+4 -1)
📝 crates/horizon-client/src/game/mods.rs (+9 -3)
📝 crates/horizon-client/src/game/remote.rs (+40 -18)

📄 Description

🤖 Opened by levzzz5154's AI agent ([CC], deepseek-v4.1-flash), not by levzzz5154.

What and why

Fixes #1376.

The Chat option (Chat Settings → Chat: Shown / Commands Only / Hidden) was saved and displayed but never applied:
Commands Only still sent and showed ordinary chat, and Hidden still sent chat, ran commands and showed the
server's messages. The option also never reached a server, so a server could not honour it either.

Minecraft.computeChatAbilities turns the option into ChatRestriction's permissions; this adds the same model
and honours it where vanilla does:

  • chat::ChatAbilities/ChatVisibility (ChatAbilities::new for the three levels, allows for
    hasAllowedInput), and ChatScreen carries them: Enter does not submit input they take, and the red usage line
    chat_screen.messages_not_allowed/chat_screen.commands_not_allowed appears under the input
    (CommandSuggestions.updateUsageInfo).
  • ClientPacketListener.sendChat/sendCommand: Game::send_chat and handle_chat_input stop before the packet
    (so a control-socket chat cannot send what the player's setting hides either).
  • ChatListener: chat_line takes its GuiMessageSource — player chat and disguised chat, the server's system
    chat, and the client's own lines — and drops the ones the option hides (receive_player_messages,
    receive_system_messages; the client's own always show). Game::system_message does the same in-frame.
  • ClientInformation carries the visibility to a server, at login and again whenever it changes
    (Options.broadcastOptions), which the LAN hub already reads (acceptsChatMessages, tryHandleChat).

#1378 (team prefixes in chat) is a separate fix and already closed.

Vanilla reference

  • Minecraft.computeChatAbilities, ChatRestriction.CHAT_AND_COMMANDS_DISABLED_BY_OPTIONS /
    CHAT_DISABLED_BY_OPTIONS.
  • ChatScreen.keyPressed → CommandSuggestions.hasAllowedInput; updateUsageInfo adds the two lines.
  • ChatListener.handlePlayerChat/handleDisguisedChat/handleSystemMessage: canReceivePlayerMessages and
    canReceiveSystemMessages.
  • ClientPacketListener.broadcastClientInformation, ServerPlayer.acceptsChatMessages.

Verification

In the game (horizon-ctl, server thread, options-set chatVisibility N, chat …, chat-log):

Option hello /say … /tellraw @s …
Shown (0) sent run shown
Commands Only (1) not sent, not shown run shown
Hidden (2) not sent, not shown not run not shown

the_chat_option_decides_what_may_be_sent pins Enter's three levels for chat and commands;
restricted_input_says_why_it_will_not_send pins the usage line. tools/parity.py chat_screen passes.

Scope

5 files, +260 −28: chat.rs, game/chat.rs, game/remote.rs and their tests, plus the probe's constructor.

🤖 Generated with [CC].

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on cachyos-x8664, against upstream/main at 7fd1f3118, 2 min 18 s)

Check Result
Scope ✅ 5 files, +260 −28
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (5 s)
clippy ❌ failed (8 s)
tests: horizon-client ✅ 1244 passed (2 min 2 s)
doc tests ✅ 0 passed (2 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 269 affected, to run in CI (--quick)
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

clippy fails on crates/horizon-client/src/mobs/axolotl.rs:169 (overly_complex_bool_expr), which fails the same way on upstream/main at 7fd1f3118: nothing in this branch touches it.

🤖 Generated with [CC].


🔄 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/1932 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/chat-visibility` --- ### 📝 Commits (4) - [`b3807d6`](https://github.com/horizon-rust/horizon/commit/b3807d6e505de48df82e5861de400e559cbd2988) Chat: the Chat option hides what it says it hides - [`1e6f05e`](https://github.com/horizon-rust/horizon/commit/1e6f05ed5a192f6ccf483f8cb8877448b6eb6a01) Chat option: filter the chat's lines both ways, as setVisibleMessageFilter - [`6e15257`](https://github.com/horizon-rust/horizon/commit/6e15257873e9cf0033a69aaf78e01a3f7cd4fc11) Merge remote-tracking branch 'origin/main' into cg15/1932 - [`2256941`](https://github.com/horizon-rust/horizon/commit/2256941af73b77d540de4b3fa74351f45ac0deee) Chat: mod output lines are the client's own ### 📊 Changes **10 files changed** (+384 additions, -49 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/probe/chat_screen_fixture.rs` (+2 -1) 📝 `crates/horizon-client/examples/probe/hud_fixture/kinds.rs` (+1 -0) 📝 `crates/horizon-client/src/chat.rs` (+167 -10) 📝 `crates/horizon-client/src/chat_tests.rs` (+114 -5) 📝 `crates/horizon-client/src/game.rs` (+3 -0) 📝 `crates/horizon-client/src/game/chat.rs` (+36 -8) 📝 `crates/horizon-client/src/game/commands.rs` (+8 -3) 📝 `crates/horizon-client/src/game/lan_screen.rs` (+4 -1) 📝 `crates/horizon-client/src/game/mods.rs` (+9 -3) 📝 `crates/horizon-client/src/game/remote.rs` (+40 -18) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent ([CC], deepseek-v4.1-flash), not by levzzz5154. ## What and why Fixes #1376. The Chat option (Chat Settings → Chat: Shown / Commands Only / Hidden) was saved and displayed but never applied: Commands Only still sent and showed ordinary chat, and Hidden still sent chat, ran commands and showed the server's messages. The option also never reached a server, so a server could not honour it either. `Minecraft.computeChatAbilities` turns the option into `ChatRestriction`'s permissions; this adds the same model and honours it where vanilla does: - `chat::ChatAbilities`/`ChatVisibility` (`ChatAbilities::new` for the three levels, `allows` for `hasAllowedInput`), and `ChatScreen` carries them: Enter does not submit input they take, and the red usage line `chat_screen.messages_not_allowed`/`chat_screen.commands_not_allowed` appears under the input (`CommandSuggestions.updateUsageInfo`). - `ClientPacketListener.sendChat`/`sendCommand`: `Game::send_chat` and `handle_chat_input` stop before the packet (so a control-socket `chat` cannot send what the player's setting hides either). - `ChatListener`: `chat_line` takes its `GuiMessageSource` — player chat and disguised chat, the server's system chat, and the client's own lines — and drops the ones the option hides (`receive_player_messages`, `receive_system_messages`; the client's own always show). `Game::system_message` does the same in-frame. - `ClientInformation` carries the visibility to a server, at login and again whenever it changes (`Options.broadcastOptions`), which the LAN hub already reads (`acceptsChatMessages`, `tryHandleChat`). #1378 (team prefixes in chat) is a separate fix and already closed. ## Vanilla reference - `Minecraft.computeChatAbilities`, `ChatRestriction.CHAT_AND_COMMANDS_DISABLED_BY_OPTIONS` / `CHAT_DISABLED_BY_OPTIONS`. - `ChatScreen.keyPressed` → `CommandSuggestions.hasAllowedInput`; `updateUsageInfo` adds the two lines. - `ChatListener.handlePlayerChat`/`handleDisguisedChat`/`handleSystemMessage`: `canReceivePlayerMessages` and `canReceiveSystemMessages`. - `ClientPacketListener.broadcastClientInformation`, `ServerPlayer.acceptsChatMessages`. ## Verification In the game (`horizon-ctl`, server thread, `options-set chatVisibility N`, `chat …`, `chat-log`): | Option | `hello` | `/say …` | `/tellraw @s …` | | --- | --- | --- | --- | | Shown (0) | sent | run | shown | | Commands Only (1) | not sent, not shown | run | shown | | Hidden (2) | not sent, not shown | not run | not shown | `the_chat_option_decides_what_may_be_sent` pins Enter's three levels for chat and commands; `restricted_input_says_why_it_will_not_send` pins the usage line. `tools/parity.py chat_screen` passes. ## Scope 5 files, +260 −28: `chat.rs`, `game/chat.rs`, `game/remote.rs` and their tests, plus the probe's constructor. 🤖 Generated with [[CC]](https://github.com/levzzz5154/horizon). ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on cachyos-x8664, against upstream/main at 7fd1f3118, 2 min 18 s) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +260 −28 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (5 s) | | clippy | ❌ failed (8 s) | | tests: horizon-client | ✅ 1244 passed (2 min 2 s) | | doc tests | ✅ 0 passed (2 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 269 affected, to run in CI (--quick) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | `clippy` fails on `crates/horizon-client/src/mobs/axolotl.rs:169` (`overly_complex_bool_expr`), which fails the same way on `upstream/main` at 7fd1f3118: nothing in this branch touches it. 🤖 Generated with [[CC]](https://github.com/levzzz5154/horizon). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:12:56 +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#3874
No description provided.