[PR #5575] [MERGED] Commands: a player name finds the player going by that nickname #6364

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

📋 Pull Request Information

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

Base: main ← Head: fix/commands-take-nicknames


📝 Commits (2)

  • d8afea7 Commands: a player name finds the player going by that nickname
  • 25c17cb Server /msg: a player name finds the player going by that nickname

📊 Changes

2 files changed (+41 additions, -4 deletions)

View changed files

📝 crates/horizon-client/src/game/commands/players.rs (+20 -1)
📝 crates/horizon-client/src/game/lan_chat.rs (+21 -3)

📄 Description

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

Why

On the official server, players with a nickname (the SMP mod's /nick, shown as ~Rocky) can't be messaged by the
name chat shows. Players asked "how am I meant to respond to messages with this nickname system". /msg Rocky fails
because vanilla only looks player names up (PlayerList.getPlayerByName).

What

player_named (the name form of an entity argument: /msg, /tell, /w, and any command naming a player): when no
player has that name, it finds the player whose nickname it is (native_set_nickname).

  • Any case. The ~ is dropped on either side: vanilla's parser stops at ~ in an unquoted name, so players type
    /msg Rocky, or /msg "~Rocky" quoted.
  • Real names win. The SMP mod refuses nicknames that look like a known player's name, so the two can't meet.
  • No nickname set: no change (the lookup is in the fallback only, after the vanilla miss).

A guest's /msg on a server (LAN, the integrated server thread, dedicated) doesn't reach player_named: it routes in
game/lan_chat.rs, which matched real names only. It gets the same fallback: no placed guest with that name, then
the one whose nickname it is (hub.nicknames).

Proof

  • cargo clippy -p horizon-client --bins -D warnings, cargo fmt --check: clean.
  • The SMP mod's native.py proof smp on this branch with SMP_PROOF_MSG_NICK=1 (horizon-mods fix/smp-nick-abuse):
    Alex /msg Rocky psst → Steve (~Rocky) reads Alex whispers to you: psst. Results in a comment. (The first run on d8afea7 failed: Steve got no whisper, which found the lan_chat.rs path.)

🤖 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/5575 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/commands-take-nicknames` --- ### 📝 Commits (2) - [`d8afea7`](https://github.com/horizon-rust/horizon/commit/d8afea7ae38d0529f87b79a896dbb50c89245be8) Commands: a player name finds the player going by that nickname - [`25c17cb`](https://github.com/horizon-rust/horizon/commit/25c17cbfbc018e965ca10a509c27d92272c4e723) Server /msg: a player name finds the player going by that nickname ### 📊 Changes **2 files changed** (+41 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/commands/players.rs` (+20 -1) 📝 `crates/horizon-client/src/game/lan_chat.rs` (+21 -3) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## Why On the official server, players with a nickname (the SMP mod's `/nick`, shown as `~Rocky`) can't be messaged by the name chat shows. Players asked "how am I meant to respond to messages with this nickname system". `/msg Rocky` fails because vanilla only looks player names up (`PlayerList.getPlayerByName`). ## What `player_named` (the name form of an entity argument: `/msg`, `/tell`, `/w`, and any command naming a player): when no player has that name, it finds the player whose nickname it is (`native_set_nickname`). - Any case. The `~` is dropped on either side: vanilla's parser stops at `~` in an unquoted name, so players type `/msg Rocky`, or `/msg "~Rocky"` quoted. - Real names win. The SMP mod refuses nicknames that look like a known player's name, so the two can't meet. - No nickname set: no change (the lookup is in the fallback only, after the vanilla miss). A guest's `/msg` on a server (LAN, the integrated server thread, dedicated) doesn't reach `player_named`: it routes in `game/lan_chat.rs`, which matched real names only. It gets the same fallback: no placed guest with that name, then the one whose nickname it is (`hub.nicknames`). ## Proof - `cargo clippy -p horizon-client --bins -D warnings`, `cargo fmt --check`: clean. - The SMP mod's `native.py proof smp` on this branch with `SMP_PROOF_MSG_NICK=1` (horizon-mods `fix/smp-nick-abuse`): Alex `/msg Rocky psst` → Steve (`~Rocky`) reads `Alex whispers to you: psst`. Results in a comment. (The first run on d8afea7 failed: Steve got no whisper, which found the `lan_chat.rs` path.) 🤖 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:19:14 +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#6364
No description provided.