refactor nbt container handling and improve item reversion #135
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
okay so context:
AntiIllegals already set a precedent of allowing "technically illegal" items into the server (e.g., unbreakables, enchanted unenchantable items, etc)
the previous nbt removal logic for armor stands, item frames, and full removal of bundles was overly aggressive: it stripped cosmetic data (ShowArms, Invisible, etc) and deleted any bundles outright. That behaviour doesn't match the plugin's existing pattern of reverting only the "bad" parts while keeping the rest intact when possible
so what changed?
armor stands now iterate ArmorItems/HandItems and only rewrite individual illegal stacks. cosmetic tags such as Small, ShowArms, etc survive.
same approach for item frames and bundle contents.
bundles get full feature parity with shulker boxes: we sanitize their items, and enforce a configurable book limit, and only drop books if theyre over the limit.
this lets the server keep bundles, (even though theyre unobtainable) just like it can keep unbreakables or collectibles via config.
lecterns checks use a books.lecternCheck flag and revert any book that is considered illegal
added interactItems flag plus a lowest priority interact listener, so the held item is reverted before use.
config was reorganized so every new behaviour is opt in or out, etc etc,
keep in mind this pr doesn't "unpatch" illegals, it just continues the same pattern this plugin is focused on, destroy items that are illegal by type. everything else is sanitized per the plugin's philosophy of letting players keep collectibles when they want to.
this results in harmless items being gone while removing any illegal gameplay advantages