From af42740fc58dce4e200329a7bca71a8e28fd7bce Mon Sep 17 00:00:00 2001 From: Brianna Date: Thu, 25 Feb 2021 08:37:55 -0600 Subject: [PATCH] Made it so scanned types from multiple dimensions stack. --- .../java/com/songoda/skyblock/levelling/IslandScan.java | 2 +- .../com/songoda/skyblock/levelling/QueuedIslandScan.java | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/songoda/skyblock/levelling/IslandScan.java b/src/main/java/com/songoda/skyblock/levelling/IslandScan.java index 8a255dda..99067924 100644 --- a/src/main/java/com/songoda/skyblock/levelling/IslandScan.java +++ b/src/main/java/com/songoda/skyblock/levelling/IslandScan.java @@ -56,7 +56,7 @@ public final class IslandScan extends BukkitRunnable { Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> initScan(plugin)); else initScan(plugin); - + return this; } diff --git a/src/main/java/com/songoda/skyblock/levelling/QueuedIslandScan.java b/src/main/java/com/songoda/skyblock/levelling/QueuedIslandScan.java index 312d4371..47270674 100644 --- a/src/main/java/com/songoda/skyblock/levelling/QueuedIslandScan.java +++ b/src/main/java/com/songoda/skyblock/levelling/QueuedIslandScan.java @@ -46,7 +46,14 @@ public class QueuedIslandScan { this.executions += currentScan.getExecutions(); this.totalScanned += currentScan.getTotalScanned(); this.blocksSize += currentScan.getBlocksSize(); - this.amounts.putAll(currentScan.getAmounts()); + + for (Map.Entry entry : currentScan.getAmounts().entrySet()) { + if (amounts.containsKey(entry.getKey())) { + amounts.get(entry.getKey()).increaseAmount(entry.getValue().getAmount()); + } else { + amounts.put(entry.getKey(), entry.getValue()); + } + } } public boolean scan() {