fix: ignore initialCount in donations-only mode (#430)#433
Merged
Conversation
When an admin enables donations-only mid-game, existing islands already have an `initialCount` recorded from the original starter-island scan. The level formula subtracts `initialCount` from raw points when `zero-new-island-levels` is on — but under donations-only, raw points are just the donated total, which is typically much smaller than the recorded initial count. The result was a huge negative `modifiedPoints` and a wildly negative level. Ignore `initialCount` (treat as 0) whenever donations-only is enabled: - `calculateLevel(rawPoints)` no longer subtracts it - the `pointsFromCurrentLevel` binary search no longer floors at it - the report no longer prints it (would be misleading, since it isn't applied to the level math) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous short-circuit in scanIsland skipped every scan when donations-only was enabled — including the zero-island scan that fires on IslandCreatedEvent / IslandResettedEvent. That meant new islands created during a donations-only window got initialCount = 0, so if an admin later disabled donations-only the player's entire current block total would count toward their level (no handicap subtracted). Restrict the short-circuit to non-zero-island scans. The zero-island scan still runs and records the real handicap into initialCount; it is just ignored by calculateLevel while donations-only is on (per the existing fix in this PR). When donations-only is later disabled, the stored initialCount is correctly subtracted by calculateLevel as before. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The viewer button at the bottom of the top-ten panel rendered with a "Click to view" tooltip and opened the details panel on click. That panel breaks down scanned blocks, which is meaningless in donations-only mode (and /island detail is not registered there either). Add a donations-only check to the VIEW action filter so it's removed from activeActions for that button when donations-only is enabled. Filtering it out also drops the "Click to view" tooltip — no template or locale change needed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
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.



Follow-up to #432.
Problem
When an admin enables
donations-only: truemid-game on a server with existing islands, the level formula goes wildly negative.Each island already has an
initialCountrecorded from the one-off starter-island scan that ran when the island was created (under `zero-new-island-levels: true`). The formula subtracts that count from raw points:```java
long modifiedPoints = rawPoints - initialCount;
```
Under donations-only, `rawPoints` is just the donated total (often 0 to a few thousand), but `initialCount` was the full block count of the starter island (millions of points worth). `modifiedPoints` becomes hugely negative and so does the resulting level.
Fix
Ignore `initialCount` whenever `donations-only` is enabled:
The flag combines cleanly with `zero-new-island-levels`: `zero-new-island-levels && !donations-only` is the new gate.
Test plan
🤖 Generated with Claude Code