Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ private List<String> getReport() {
donatedBlocks.entrySet().stream()
.sorted(Map.Entry.<String, Integer>comparingByValue().reversed())
.forEach(entry -> {
Integer value = addon.getBlockConfig().getBlockValues().getOrDefault(entry.getKey().toLowerCase(java.util.Locale.ENGLISH), 0);
Integer value = Objects.requireNonNullElse(addon.getBlockConfig().getValue(island.getWorld(), entry.getKey().toLowerCase(java.util.Locale.ENGLISH)), 0);
long totalValue = (long) value * entry.getValue();
reportLines.add(" " + Util.prettifyText(entry.getKey()) + " x "
+ String.format("%,d", entry.getValue())
Expand Down Expand Up @@ -730,8 +730,17 @@ public void tidyUp() {
results.rawBlockCount
.addAndGet((long) (results.underWaterBlockCount.get() * addon.getSettings().getUnderWaterMultiplier()));

// Add donated block points (permanent contributions that persist across recalculations)
long donatedPoints = addon.getManager().getDonatedPoints(island);
// Add donated block points (permanent contributions that persist across recalculations).
// Recalculate from the donated blocks map using current block config values so the
// level always reflects the current configuration, even if block values changed since donation.
Map<String, Integer> donatedBlocksMap = addon.getManager().getDonatedBlocks(island);
long donatedPoints = donatedBlocksMap.entrySet().stream()
.mapToLong(entry -> {
Integer value = addon.getBlockConfig().getValue(island.getWorld(),
entry.getKey().toLowerCase(java.util.Locale.ENGLISH));
return (long) Objects.requireNonNullElse(value, 0) * entry.getValue();
})
.sum();
results.rawBlockCount.addAndGet(donatedPoints);
results.donatedPoints.set(donatedPoints);

Expand Down
Loading