Skip to content

Fix restoring off-hand and cursor items after games - #116

Open
GerwinVerkerk wants to merge 1 commit into
ShaneBeeStudios:masterfrom
UnitedFactions:fix/preserve-player-hand-state
Open

GerwinVerkerk wants to merge 1 commit into
ShaneBeeStudios:masterfrom
UnitedFactions:fix/preserve-player-hand-state

Conversation

@GerwinVerkerk

Copy link
Copy Markdown

Describe your changes

Preserve the player's extra inventory contents and cursor item in the existing pre-game PlayerData snapshot.

PlayerInventory#getExtraContents() includes the off-hand slot on Paper. HungerGames previously cleared that slot when a game started but only restored storage and armor contents, causing off-hand items to disappear after leaving or finishing a game.

This change:

  • snapshots all extra inventory slots before clearing the player;
  • snapshots and clears the cursor item so it cannot enter the arena;
  • restores both extra contents and the cursor alongside the existing storage and armor contents;
  • keeps the existing game, join, leave, and restore flow unchanged.

This intentionally does not address the large-arena preparation issue or add durable crash recovery; those have different risk and review scope. A follow-up proposal for durable snapshots is described on issue #113. It also does not duplicate the world-border work in #115.

Verification

  • ./gradlew clean build --no-daemon
  • git diff --check
  • Build completed successfully against the repository's Paper 26.2 configuration.

Target Minecraft Versions: all currently supported versions
Requirements: none
Related Issues: #113

Checklist before requesting a review

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