[PR #1841] [MERGED] Use the team-formatted player name in chat #3807

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

📋 Pull Request Information

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

Base: main ← Head: fix/1378-team-chat-names


📝 Commits (1)

  • 3843a9a Use the team-formatted player name in chat

📊 Changes

5 files changed (+34 additions, -11 deletions)

View changed files

📝 crates/horizon-client/src/game/chat.rs (+1 -1)
📝 crates/horizon-client/src/game/commands.rs (+4 -4)
📝 crates/horizon-client/src/game/scoreboard.rs (+1 -0)
📝 crates/horizon-client/src/lan/hub.rs (+22 -0)
📝 crates/horizon-client/src/lan/hub/chat.rs (+6 -6)

📄 Description

What and why

Fixes #1378.

A player on a team with a prefix, suffix or colour still showed up as the bare name in chat. Team feedback had the prefix, so the team was set; chat just never asked for it.

With the server thread (and for LAN guests and dedicated servers), the server built the sender name of chat, /say, /me and /tell from the profile name alone. The game now copies the scoreboard's teams to the hub each tick (in lan_sync_scoreboard, next to the scoreboard sync it already does), and the hub builds Player.getDisplayName: the team's prefix, the name and the suffix in the team colour, with the same click, hover and insertion as before. A player on no team gets exactly the old component.

In-frame, ordinary chat, /say//me typed by the player, and both /tell lines used the plain name. They now use the existing player_display_name, which already formats for the team.

Vanilla reference

  • Player.getDisplayName -> PlayerTeam.formatNameForTeam -> PlayerTeam.getFormattedName (Component.empty().append(prefix).append(name).append(suffix), then the team colour), then Player.decorateDisplayNameComponent (click, hover, insertion on the outer component).
  • ServerGamePacketListenerImpl chat, SayCommand, EmoteCommands and MsgCommand bind their chat type to the sender's getDisplayName() (and the target's for the outgoing whisper).

No harness covers chat sender names with teams. I ran the existing harnesses for the touched code: python3 tools/parity.py secure_chat chat_screen team_rules scoreboard (4 passed). cargo check -p horizon-client and cargo fmt --check are clean.

Self-check

pr_ready (tools/pr_ready.py --quick on device-591, against origin/main at e28b45376, 6 min 8 s)

Check Result
Scope ✅ 5 files, +34 −11
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (5 s)
clippy ✅ (44 s)
tests: horizon-client ✅ 1236 passed (5 min 14 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 ➖ 330 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 318 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🔄 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/1841 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/1378-team-chat-names` --- ### 📝 Commits (1) - [`3843a9a`](https://github.com/horizon-rust/horizon/commit/3843a9a4aae425fa4ec4f759dc9e4e37a5c44abc) Use the team-formatted player name in chat ### 📊 Changes **5 files changed** (+34 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/chat.rs` (+1 -1) 📝 `crates/horizon-client/src/game/commands.rs` (+4 -4) 📝 `crates/horizon-client/src/game/scoreboard.rs` (+1 -0) 📝 `crates/horizon-client/src/lan/hub.rs` (+22 -0) 📝 `crates/horizon-client/src/lan/hub/chat.rs` (+6 -6) </details> ### 📄 Description ## What and why Fixes #1378. A player on a team with a prefix, suffix or colour still showed up as the bare name in chat. Team feedback had the prefix, so the team was set; chat just never asked for it. With the server thread (and for LAN guests and dedicated servers), the server built the sender name of chat, `/say`, `/me` and `/tell` from the profile name alone. The game now copies the scoreboard's teams to the hub each tick (in `lan_sync_scoreboard`, next to the scoreboard sync it already does), and the hub builds `Player.getDisplayName`: the team's prefix, the name and the suffix in the team colour, with the same click, hover and insertion as before. A player on no team gets exactly the old component. In-frame, ordinary chat, `/say`/`/me` typed by the player, and both `/tell` lines used the plain name. They now use the existing `player_display_name`, which already formats for the team. ## Vanilla reference - `Player.getDisplayName` -> `PlayerTeam.formatNameForTeam` -> `PlayerTeam.getFormattedName` (`Component.empty().append(prefix).append(name).append(suffix)`, then the team colour), then `Player.decorateDisplayNameComponent` (click, hover, insertion on the outer component). - `ServerGamePacketListenerImpl` chat, `SayCommand`, `EmoteCommands` and `MsgCommand` bind their chat type to the sender's `getDisplayName()` (and the target's for the outgoing whisper). No harness covers chat sender names with teams. I ran the existing harnesses for the touched code: `python3 tools/parity.py secure_chat chat_screen team_rules scoreboard` (4 passed). `cargo check -p horizon-client` and `cargo fmt --check` are clean. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on device-591, against origin/main at e28b45376, 6 min 8 s) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +34 −11 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (5 s) | | clippy | ✅ (44 s) | | tests: horizon-client | ✅ 1236 passed (5 min 14 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 | ➖ 330 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 318 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | --- <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:27 +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#3807
No description provided.