Skip to content

fix: Session restore list index overflow when using a plugin that modifies the slot count#52

Merged
iLynxcat merged 2 commits intomainfrom
fix/session-restore-list-bounds
Apr 2, 2026
Merged

fix: Session restore list index overflow when using a plugin that modifies the slot count#52
iLynxcat merged 2 commits intomainfrom
fix/session-restore-list-bounds

Conversation

@iLynxcat
Copy link
Copy Markdown
Contributor

@iLynxcat iLynxcat commented Apr 2, 2026

Fixes #51

Problem

  • Plugins like InvSee++ may modify the amount of slots in a player's inventory
  • We hardcode the slot count at the vanilla limit of 41
  • This causes an overflow when saving -> restoring sessions to/from admin-state.yml

Solution

  • Pass the full Player reference down to AdminState#fromConfig
  • Use the lower value of these two for the array's size
    • Number of items in saved list
    • Total slots in Player's inventory
  • This should now gracefully handle mismatches

To-do

  • Test with InvSee++ installed
    • Verify bug on 1.5.1 release
      Not sure on an exact replication, can't seem to make it produce more than 41 items. Pushing this fix anyway for verification by the user
    • Verify fix at 7afc63d

@iLynxcat iLynxcat merged commit 117a66b into main Apr 2, 2026
1 of 3 checks passed
@iLynxcat iLynxcat deleted the fix/session-restore-list-bounds branch April 3, 2026 19:40
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.

An error pops up

1 participant