Skip to content

Persist hidden items in permission-based ender chest rows#1774

Merged
granny merged 8 commits into
PurpurMC:ver/26.1.2from
GoodrichDev:fix-non-persistent-enderchest-rows
May 1, 2026
Merged

Persist hidden items in permission-based ender chest rows#1774
granny merged 8 commits into
PurpurMC:ver/26.1.2from
GoodrichDev:fix-non-persistent-enderchest-rows

Conversation

@GoodrichDev

@GoodrichDev GoodrichDev commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

This fixes item loss with permission-based ender chest rows.

Previously, PlayerEnderChestContainer#getContainerSize() returned the player’s currently permitted row count, and the ender chest load/save methods also used that value. If a player stored items in higher rows and later lost the corresponding permission, those hidden slots could be skipped during load/save and omitted from saved player data.

This changes ender chest persistence to use the full backing container size while keeping the permission-limited size for access/UI behavior. Hidden rows remain inaccessible without permission, but their contents stay saved and become available again if the player regains the required permission.

EDIT: This adds support for preserving ender chest contents in rows hidden by permission-based row limits.

Currently, when permission-based ender chest rows are enabled, reducing a player’s allowed row count also reduces the size used by ender chest load/save logic. As a result, slots outside the player’s current permission range are not retained. This change keeps the existing permission-based access behavior intact: players can only view and interact with rows they currently have permission for. The new behavior is that hidden rows remain part of the backing storage during persistence, so their contents can be retained and become available again if the player regains the required row permission.

@/BillyGalbreath says this is not a bug and is working as intended, asked if it instead it could be intended to work this way. Hence the strike-through and rename

- Use the full backing ender chest storage size when loading and saving ender chest contents.
Permission-based ender chest rows still limit the visible/accessible container size, but hidden slots are now preserved in persistent player data. This prevents items in higher rows from being dropped from EnderItems when a player loses permissions such as `purpur.enderchest.rows.six`.
@GoodrichDev GoodrichDev changed the title Fix ender chest item loss when row permissions are reduced Add persistence for hidden permission-based ender chest rows Apr 21, 2026

@granny granny left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on all the discussion around this change, I feel like it wouldn't hurt to put this behind a config option that's enabled by default. I'll make sure to include it in an announcement so that those who relied on the container size "deleting" data when the container resizes can still have that available to them. Persisting the data would be the default, since I agree that most people would expect it to persist.

Add a settings.blocks.ender_chest.preserve-hidden-items option to control the recent change that preserves permission-hidden ender chest rows. The option defaults to true, and disabling it restores the legacy behavior that trims saved contents to the visible row count.
@GoodrichDev GoodrichDev requested a review from granny April 24, 2026 23:46
@GoodrichDev

Copy link
Copy Markdown
Contributor Author

I made the necessary changes @granny

@granny granny left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for the PR!

@granny granny changed the title Add persistence for hidden permission-based ender chest rows Persist hidden items in permission-based ender chest rows May 1, 2026
@granny granny merged commit 9982c0e into PurpurMC:ver/26.1.2 May 1, 2026
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.

Ender chest items are lost when permission-based rows are reduced

2 participants