Skip to content

fix(resourcepack): wait for the client to drop the pack before kicking - #289

Merged
TheMeinerLP merged 1 commit into
mainfrom
fix/pop-resource-pack-before-leave
Oct 4, 2026
Merged

TheMeinerLP merged 1 commit into
mainfrom
fix/pop-resource-pack-before-leave

Conversation

@TheMeinerLP

Copy link
Copy Markdown
Contributor

Proposed changes

Players (reported for the slender) kept the Cygnus resource pack in the lobby after the RestartPhase kick or SpectatorService.leave. Behind Velocity a kick moves the player to the lobby and the client connection survives. The pop was sent immediately before the disconnect, and nothing guaranteed the client had processed it before being rerouted.

Fix. CygnusPlayer.kick sends the pop and defers the disconnect until either:

  • the client reports a terminal status (DISCARDED) for our pack id via onResourcePackStatus, or
  • 10 ticks have passed.

An exactly-once guard covers repeated kicks and the ack/timeout race. Kicks without a pack id, or outside the PLAY state, stay immediate. ResourcePackService.handleStatus ignores a leaving player's DISCARDED, so the "must accept" message no longer replaces the leave message. 10 ticks is well below the 1 s RestartPhase waits before shutdown.

Minestom notes.

  • PlayerResourcePackStatusEvent#getPackUuid identifies the pack.
  • ResourcePackListener fires the event, then calls Player#onResourcePackStatus.
  • Minestom's own required-pack kick only applies to packs that are still pending, and it goes through the overridden kick (ignored while leaving).

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING.md
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

Limitation. A player-initiated proxy switch (/hub, /server) closes the connection without warning. That cannot be solved here. A related lobby-side safeguard is tracked in OneLiteFeatherNET/Titan#361.

Test plan.

  • New and updated tests in CygnusPlayerResourcePackKickTest and ResourcePackServiceTest cover: the pop is sent before the kick, the disconnect is deferred until DISCARDED or the 10 tick timeout, repeated kicks and ack+timeout disconnect only once, kicks without a pack id or outside PLAY stay immediate, and a leaving player's DISCARDED does not trigger the "must accept" message.
  • ./gradlew :game:test is green (658 tests).
  • In-game check behind Velocity is still open.

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Test results

  516 files    516 suites   3m 22s ⏱️
1 042 tests 1 034 ✅  8 💤 0 ❌
3 129 runs  3 105 ✅ 24 💤 0 ❌

Results for commit 82cffa3.

@TheMeinerLP
TheMeinerLP merged commit fa38167 into main Oct 4, 2026
8 checks passed
@Joltras
Joltras deleted the fix/pop-resource-pack-before-leave branch October 4, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant