fix: cap donated block counts to current block limits in level calculation#443
Merged
Merged
Conversation
…lculation When a block limit is lowered after players have already donated blocks, the donated count is now capped to the current limit in IslandLevelCalculator.tidyUp(). This ensures excess donated blocks no longer contribute points beyond the limit. Adds three new tests to IslandLevelCalculatorTidyUpTest covering: - donated count under limit (full count used) - donated count over limit (capped to current limit) - donated count with no limit (full count used) Agent-Logs-Url: https://github.com/BentoBoxWorld/Level/sessions/3c49eef0-18f1-4340-bdd3-2afd5ce36286 Co-authored-by: tastybento <4407265+tastybento@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix donate blocks counting when limit is changed
fix: cap donated block counts to current block limits in level calculation
May 20, 2026
|
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.



When a block's donation limit is lowered after players have already donated above the new threshold, the excess blocks continue counting toward island level. The donated count was never validated against the current limit at calculation time.
Changes
IslandLevelCalculator.tidyUp(): When computing donated points, look up the current block limit for each donated block type and applyMath.min(donatedCount, limit)before multiplying by value. This mirrors the existinglimitCountAndValue()enforcement applied to on-island blocks during chunk scanning.IslandLevelCalculatorTidyUpTest: Three new tests covering donated-under-limit (full count used), donated-over-limit (capped to current limit), and no limit configured (full count used).