[PR #2955] [MERGED] Show a server's Code of Conduct and wait for the answer #4709

Closed
opened 2026-11-03 05:07:21 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/server-code-of-conduct-screen


📝 Commits (2)

  • 98d0c6d Show the server's Code of Conduct and wait for the answer
  • ae4ffbe Merge main into fix/server-code-of-conduct-screen

📊 Changes

7 files changed (+333 additions, -7 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+17 -1)
➕ crates/horizon-client/src/game/code_of_conduct.rs (+278 -0)
📝 crates/horizon-client/src/game/remote.rs (+2 -0)
📝 crates/horizon-client/src/game/server_packs.rs (+2 -2)
📝 crates/horizon-client/src/multiplayer.rs (+2 -1)
📝 crates/horizon-client/src/net.rs (+16 -2)
📝 crates/horizon-protocol/src/servers.rs (+16 -1)

📄 Description

What and why

  • Horizon accepted every server's Code of Conduct without showing it. Now the text opens on a screen with Acknowledge and Disconnect, as vanilla does.
  • The server waits until the player answers. Keep-alives keep flowing meanwhile.
  • "Do not notify again for this Code of Conduct" stores the text's hash on the server's entry in servers.dat (acceptedCodeOfConduct). The screen is skipped while the text still matches. Accepting without the box, or declining, clears the stored hash. Declining ends the connection with vanilla's message.
  • The text sits in a bordered, left-aligned box (width - 100 wide, height - 100 at most) as WarningScreen draws it. A long text scrolls with the mouse wheel.
  • A move or delete in the server list keeps the stored hash.

Vanilla reference

  • multiplayer/ClientConfigurationPacketListenerImpl.java:130-150 (handleCodeOfConduct: skip when accepted, else show the screen)
  • multiplayer/WarningScreen.java (layout: 8 px rows, 12 px around the text box, FittingMultiLineTextWidget)
  • multiplayer/CodeOfConductScreen.java:20-63 (Acknowledge, Disconnect, the "do not notify" box, Escape does nothing)
  • multiplayer/ServerData.java:96-105 (hasAcceptedCodeOfConduct, accept and clear, by String.hashCode)
  • multiplayer/ServerList.java:162-172 (saveSingleServer)

Self-check

clippy and fmt pass for horizon-protocol and horizon-client. Not run in game.


🔄 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/2955 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/server-code-of-conduct-screen` --- ### 📝 Commits (2) - [`98d0c6d`](https://github.com/horizon-rust/horizon/commit/98d0c6d1a361b557f472eff80d676850b8e48d14) Show the server's Code of Conduct and wait for the answer - [`ae4ffbe`](https://github.com/horizon-rust/horizon/commit/ae4ffbea8faa6d57d8ab10665c131b47e93449ed) Merge main into fix/server-code-of-conduct-screen ### 📊 Changes **7 files changed** (+333 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+17 -1) ➕ `crates/horizon-client/src/game/code_of_conduct.rs` (+278 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+2 -0) 📝 `crates/horizon-client/src/game/server_packs.rs` (+2 -2) 📝 `crates/horizon-client/src/multiplayer.rs` (+2 -1) 📝 `crates/horizon-client/src/net.rs` (+16 -2) 📝 `crates/horizon-protocol/src/servers.rs` (+16 -1) </details> ### 📄 Description ## What and why - Horizon accepted every server's Code of Conduct without showing it. Now the text opens on a screen with Acknowledge and Disconnect, as vanilla does. - The server waits until the player answers. Keep-alives keep flowing meanwhile. - "Do not notify again for this Code of Conduct" stores the text's hash on the server's entry in servers.dat (`acceptedCodeOfConduct`). The screen is skipped while the text still matches. Accepting without the box, or declining, clears the stored hash. Declining ends the connection with vanilla's message. - The text sits in a bordered, left-aligned box (`width - 100` wide, `height - 100` at most) as WarningScreen draws it. A long text scrolls with the mouse wheel. - A move or delete in the server list keeps the stored hash. ## Vanilla reference - multiplayer/ClientConfigurationPacketListenerImpl.java:130-150 (handleCodeOfConduct: skip when accepted, else show the screen) - multiplayer/WarningScreen.java (layout: 8 px rows, 12 px around the text box, `FittingMultiLineTextWidget`) - multiplayer/CodeOfConductScreen.java:20-63 (Acknowledge, Disconnect, the "do not notify" box, Escape does nothing) - multiplayer/ServerData.java:96-105 (hasAcceptedCodeOfConduct, accept and clear, by String.hashCode) - multiplayer/ServerList.java:162-172 (saveSingleServer) ## Self-check clippy and fmt pass for horizon-protocol and horizon-client. Not run in game. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:07:21 +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#4709
No description provided.