From f17c70e5e419d07ac6e1737c93da23251997d80f Mon Sep 17 00:00:00 2001 From: tastybento Date: Tue, 12 May 2026 07:17:22 -0700 Subject: [PATCH 1/3] fix: ignore initialCount in donations-only mode (#430) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .../level/calculators/IslandLevelCalculator.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/world/bentobox/level/calculators/IslandLevelCalculator.java b/src/main/java/world/bentobox/level/calculators/IslandLevelCalculator.java index 0ec2c29..9bf12f7 100644 --- a/src/main/java/world/bentobox/level/calculators/IslandLevelCalculator.java +++ b/src/main/java/world/bentobox/level/calculators/IslandLevelCalculator.java @@ -133,9 +133,14 @@ public IslandLevelCalculator(Level addon, Island island, CompletableFuture getReport() { if (addon.getSettings().isZeroNewIslandLevels()) { reportLines.add("Initial island level = " + (0L - addon.getManager().getInitialLevel(island))); }*/ - if (addon.getSettings().isZeroNewIslandLevels()) { + if (addon.getSettings().isZeroNewIslandLevels() && !addon.getSettings().isDonationsOnly()) { reportLines.add("Initial island count = " + (0L - addon.getManager().getInitialCount(island))); } reportLines.add("Previous level = " + addon.getManager().getIslandLevel(island.getWorld(), island.getOwner())); @@ -766,7 +771,9 @@ public void tidyUp() { // Binary search for points accumulated within the current level. // Floor at initialCount when zeroing new islands to avoid negative/NaN in non-linear formulas. - long minBlocks = addon.getSettings().isZeroNewIslandLevels() ? results.initialCount.get() : 0; + // In donations-only mode, the initial count is ignored (see calculateLevel). + long minBlocks = addon.getSettings().isZeroNewIslandLevels() && !addon.getSettings().isDonationsOnly() + ? results.initialCount.get() : 0; lo = Math.max(minBlocks, blockAndDeathPoints - MAX_AMOUNT); hi = blockAndDeathPoints; while (lo < hi) { From 8b8b2de27de4315b39f237889680c6299b8f542a Mon Sep 17 00:00:00 2001 From: tastybento Date: Tue, 12 May 2026 07:20:03 -0700 Subject: [PATCH 2/3] fix: still run zero-island scan under donations-only (#430) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .../level/calculators/IslandLevelCalculator.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/world/bentobox/level/calculators/IslandLevelCalculator.java b/src/main/java/world/bentobox/level/calculators/IslandLevelCalculator.java index 9bf12f7..dc1ddcc 100644 --- a/src/main/java/world/bentobox/level/calculators/IslandLevelCalculator.java +++ b/src/main/java/world/bentobox/level/calculators/IslandLevelCalculator.java @@ -801,9 +801,14 @@ boolean isNotZeroIsland() { } public void scanIsland(Pipeliner pipeliner) { - // In donations-only mode, skip the chunk scan entirely. tidyUp() will add - // the donated points and compute the level from those alone. - if (addon.getSettings().isDonationsOnly()) { + // In donations-only mode, skip the chunk scan for regular level calcs: + // tidyUp() will add the donated points and compute the level from those + // alone. Zero-island scans (run on island create/reset when + // zero-new-island-levels is true) still run the full scan so the + // initial-count handicap is recorded — this lets an admin later + // disable donations-only without losing the handicap that would + // otherwise need to be subtracted from the scanned block total. + if (addon.getSettings().isDonationsOnly() && !zeroIsland) { pipeliner.getInProcessQueue().remove(this); this.tidyUp(); this.getR().complete(getResults()); From 13ab09bf62bfabebebdfc7bbc72fddf757034537 Mon Sep 17 00:00:00 2001 From: tastybento Date: Tue, 12 May 2026 07:31:09 -0700 Subject: [PATCH 3/3] fix: disable VIEW action in top panel under donations-only (#430) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .../java/world/bentobox/level/panels/TopLevelPanel.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/world/bentobox/level/panels/TopLevelPanel.java b/src/main/java/world/bentobox/level/panels/TopLevelPanel.java index 81910b8..3dfa68c 100644 --- a/src/main/java/world/bentobox/level/panels/TopLevelPanel.java +++ b/src/main/java/world/bentobox/level/panels/TopLevelPanel.java @@ -180,7 +180,11 @@ private PanelItem createIslandIcon(ItemTemplateRecord template, IslandTopRecord || !this.addon.getVisitHook().getAddonManager().preprocessTeleportation(this.user, island, true); } case "VIEW" -> { - return island.getOwner() == null + // In donations-only mode there is no detail panel to view, so this + // action is filtered out — that also drops the "click to view" + // tooltip from the rendered button. + return this.addon.getSettings().isDonationsOnly() + || island.getOwner() == null || !island.getMemberSet(RanksManager.MEMBER_RANK).contains(this.user.getUniqueId()); } default -> {