fix: refine player state preservation (NV/Flight), fix UI sync, and implement permission caching#14
fix: refine player state preservation (NV/Flight), fix UI sync, and implement permission caching#14CreeperDisco wants to merge 2 commits into
Conversation
…vision preservation 1. Non-destructive Configuration Updates Issue: Previously, config updates would overwrite the entire file using YamlConfiguration.save(), stripping user comments and custom formatting. Fix: Implemented a ConfigUpdater that uses a line-by-line injection approach. It only adds missing keys from the template while preserving all existing comments, indentation, and user-defined settings. 2. Fixed F3+F4 Gamemode Switcher Bug Issue: The ProtocolLib packet interceptor was blocking ENTITY_STATUS packets sent to the player themselves, causing the client to lose "OP status" for UI features like the F3+F4 switcher. Fix: Added a self-entity exemption in ProtocolLibManager. Packets where the observer is the same as the target are now allowed to pass through. 3. Robust Night Vision State Preservation Issue: Unvanishing would unconditionally remove all NIGHT_VISION effects, stripping effects provided by equipment, beacons, or other plugins. Fix: Replaced hard removePotionEffect with a "soft expiry" strategy (replacing infinite effect with a 1-tick effect) to avoid breaking the game engine's internal effect tracking. Added a two-tick armor re-evaluation (unequip/re-equip) during unvanish to force the server to re-detect and re-apply any equipment-based effects. This ensures that if a player has night vision equipment, the effect correctly persists or returns after leaving vanish. Tested on Paper 1.21.8.
|
Thanks for the thorough PR! You've made some great additions to the project and I really appreciate the time and effort you put into this. There are just a few things to address before I can merge: 1. VRule bypass in applyVanishEffects 2. Unreachable case 8 in MigrationManager.applyRefactorRules 3. Permission cache not cleared on reload Two smaller things that aren't blocking but worth a look: the # [Auto-Generated Default] comment on every Thanks again for the contribution, looking forward to getting this merged! |
Stability and Logic Refinements: Config Preservation, UI Sync, Night Vision, and Performance Optimization
This Pull Request introduces critical stability fixes, administrative UI compatibility, and significant performance optimizations to Vanishpp.
1. Non-destructive Configuration Updates
Issue: Previously, config updates would overwrite the entire file using
YamlConfiguration.save(), stripping user comments and custom formatting.Fix:
ConfigUpdaterthat uses a line-by-line injection approach. It adds missing keys from the template while preserving all existing comments and indentation.MigrationManagerto disable destructivesave()calls for configuration versions 8 and above.2. Restored F3+F4 Gamemode Switcher
Issue: The ProtocolLib packet interceptor was blocking
ENTITY_STATUSpackets sent to the player themselves, causing the client to lose sync regarding "OP status" for UI features like the F3+F4 switcher.Fix: Added a self-entity exemption in
ProtocolLibManager. Critical client-side sync packets are now allowed to pass through if the observer is the same as the target.3. Improved Spectator Mode Restoration
Issue: Inconsistent behavior when using the "double-shift" spectator toggle, often resulting in incorrect gamemode restoration or permission conflicts during unvanishing.
Fix: Optimized metadata tracking for pre-vanish gamemodes and enforced strict permission checks (
vanishpp.spectator.bypass) to ensure predictable state restoration.4. Robust Night Vision State Preservation
Issue: Unvanishing would wipe all
NIGHT_VISIONeffects, stripping sources from equipment, beacons, or other plugins.Fix:
removePotionEffect()with a 1-tick effect override to allow the game engine to expire the effect naturally.5. Performance: Permission Result Caching
Issue: High-frequency permission checks (specifically
vanishpp.see) during Tab list and ActionBar refreshes were causing significant log spam when usingLuckPerms verbosemode and adding unnecessary overhead.Fix:
PermissionManager.6. Fix: Reliable Flight on Join
Issue: When "Auto-vanish on join" was enabled, players would often fail to start flying on their first join because server/plugin initialization (like AuthMe) would overwrite the flight status immediately after the join event.
Fix:
Technical Notes