Improve hologram system with persistence fix, new placeholders, and chunk limit initialization#62
Merged
Merged
Conversation
- Add setPersistent(false) to hologram entities to prevent stuck holograms - Add %formatted_storage% and %formatted_exp% placeholders for percentage display - Add proper hologram cleanup on shutdown with sync wait - Fix chunk spawner limit not being initialized on server restart (only worked after /ss reload) - Initialize chunk limits after spawners are loaded in WorldEventHandler Co-authored-by: ptthanh02 <73684260+ptthanh02@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Enhance hologram system for spawner with cleanup on shutdown
Improve hologram system with persistence fix, new placeholders, and chunk limit initialization
Oct 15, 2025
Contributor
|
@copilot okay can you rename the placeholders from %formatted_storage% to %percentage_storage% and also rename it for the bedrock ui as well and for the DonutSMP gui.yml as well for clearer name. And write sort intruction in config.yml above the hologram section to intrucs user that placeholder %percentage_storage is available and what it return |
- Rename %formatted_storage% to %percentage_storage% - Rename %formatted_exp% to %percentage_exp% - Update placeholders in SpawnerHologram.java, SpawnerMenuUI.java, and SpawnerMenuFormUI.java - Update all GUI files: DonutSMP, en_US, de_DE, vi_VN - Add documentation in config.yml explaining the new placeholders and their return values Co-authored-by: ptthanh02 <73684260+ptthanh02@users.noreply.github.com>
Contributor
Author
Done! Renamed placeholders from Updated in:
Commit: 02f9675 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Overview
This PR addresses several issues with the hologram system and fixes a critical bug where chunk spawner limits were not properly initialized on server restart.
Changes
1. Hologram Persistence Fix
Added
setPersistent(false)to hologram TextDisplay entities to prevent them from being saved to world data. This resolves the issue where holograms would sometimes get stuck after server restarts or chunk unloads.Why this matters: By default, entities are persistent and get saved with the world. Since holograms are temporary visual elements that are managed by the plugin, they should not persist between sessions. This prevents ghost holograms from accumulating over time.
2. New Hologram Placeholders
Added two new percentage-based placeholders for hologram text:
%percentage_storage%- Shows storage capacity as a percentage (e.g., "75.5" for 75.5% full)%percentage_exp%- Shows experience capacity as a percentage (e.g., "50.0" for 50.0% full)These placeholders provide a cleaner way to display spawner capacity in holograms, matching the format already used in the GUI system.
Example usage in config:
3. Proper Hologram Cleanup on Shutdown
Implemented synchronous hologram cleanup during plugin shutdown:
removeAllHolograms()method that safely removes all holograms before clearing spawner dataThis ensures clean shutdown without leaving orphaned hologram entities.
4. Fix Chunk Spawner Limit Initialization Bug
Problem: Chunk spawner limits were reset to 0 on every server restart, allowing players to bypass the
max_per_chunklimit until/ss reloadwas executed.Root Cause: The
ChunkSpawnerLimiterwas initialized before spawners were loaded from disk. ItsinitializeChunkCounts()method ran with an empty spawner list, resulting in zero counts.Solution: Added chunk limit reinitialization after spawners are loaded:
WorldEventHandlerBefore: Chunk limits only worked after
/ss reloadAfter: Chunk limits work correctly from server startup
5. Placeholder Documentation
Added comprehensive documentation in
config.ymlexplaining the new percentage placeholders and their return values, making it easier for users to understand and use these placeholders in their hologram configurations.Technical Details
Files Modified
SpawnerHologram.java- Added persistence flag and percentage placeholdersSpawnerManager.java- Added hologram cleanup methodWorldEventHandler.java- Added chunk limit initialization after spawner loadingSpawnerMenuUI.java- Updated to use new placeholder namesSpawnerMenuFormUI.java- Updated to use new placeholder names (Bedrock UI)config.yml- Added placeholder documentationDonutSMP/gui.yml,en_US/gui.yml,de_DE/gui.yml,vi_VN/gui.yml) - Updated placeholdersTesting
The changes preserve existing functionality while fixing the identified issues:
/ss hologram) properly creates/removes hologramsRelated Issues
Fixes issues mentioned in the Vietnamese problem statement regarding:
> [!WARNING]
>
>
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.