From c9c4979d603607261bb6dce500700684c3f10bcd Mon Sep 17 00:00:00 2001 From: PikaMug <2267126+PikaMug@users.noreply.github.com> Date: Sun, 14 Jul 2024 16:10:46 -0400 Subject: [PATCH] Track progress through int, part 4. See #2250 --- .../java/me/pikamug/quests/player/BukkitQuester.java | 12 ++++++------ .../file/BukkitQuesterYamlStorage.java | 5 ++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/me/pikamug/quests/player/BukkitQuester.java b/core/src/main/java/me/pikamug/quests/player/BukkitQuester.java index c12757d2f..7d98629cb 100644 --- a/core/src/main/java/me/pikamug/quests/player/BukkitQuester.java +++ b/core/src/main/java/me/pikamug/quests/player/BukkitQuester.java @@ -3476,17 +3476,17 @@ public class BukkitQuester implements Quester { } if (!bukkitStage.getBlocksToCut().isEmpty()) { for (final ItemStack ignored : bukkitStage.getBlocksToCut()) { - data.blocksUsed.add(0); + data.blocksCut.add(0); } } if (!bukkitStage.getItemsToCraft().isEmpty()) { for (final ItemStack ignored : bukkitStage.getItemsToCraft()) { - data.blocksUsed.add(0); + data.itemsCrafted.add(0); } } if (!bukkitStage.getItemsToSmelt().isEmpty()) { for (final ItemStack ignored : bukkitStage.getItemsToSmelt()) { - data.blocksUsed.add(0); + data.itemsSmelted.add(0); } } if (!bukkitStage.getItemsToEnchant().isEmpty()) { @@ -3496,17 +3496,17 @@ public class BukkitQuester implements Quester { } if (!bukkitStage.getItemsToBrew().isEmpty()) { for (final ItemStack ignored : bukkitStage.getItemsToBrew()) { - data.blocksUsed.add(0); + data.itemsBrewed.add(0); } } if (!bukkitStage.getItemsToConsume().isEmpty()) { for (final ItemStack ignored : bukkitStage.getItemsToConsume()) { - data.blocksUsed.add(0); + data.itemsConsumed.add(0); } } if (!bukkitStage.getItemsToDeliver().isEmpty()) { for (final ItemStack ignored : bukkitStage.getItemsToDeliver()) { - data.blocksUsed.add(0); + data.itemsDelivered.add(0); } } if (!quest.getStage(stage).getNpcsToInteract().isEmpty()) { diff --git a/core/src/main/java/me/pikamug/quests/storage/implementation/file/BukkitQuesterYamlStorage.java b/core/src/main/java/me/pikamug/quests/storage/implementation/file/BukkitQuesterYamlStorage.java index e8be71de0..df6c42bfc 100644 --- a/core/src/main/java/me/pikamug/quests/storage/implementation/file/BukkitQuesterYamlStorage.java +++ b/core/src/main/java/me/pikamug/quests/storage/implementation/file/BukkitQuesterYamlStorage.java @@ -62,7 +62,7 @@ public class BukkitQuesterYamlStorage implements QuesterStorageImpl { @Override public Quester loadQuester(final UUID uniqueId) throws IOException, InvalidConfigurationException { final FileConfiguration data = new YamlConfiguration(); - Quester quester = plugin.getQuester(uniqueId); + BukkitQuester quester = plugin.getQuester(uniqueId); if (quester != null) { quester.hardClear(); } else { @@ -154,6 +154,7 @@ public class BukkitQuesterYamlStorage implements QuesterStorageImpl { if (dataSec == null || dataSec.getKeys(false).isEmpty()) { return null; } + final ConcurrentHashMap questProgress = new ConcurrentHashMap<>(); for (final String key : dataSec.getKeys(false)) { final ConfigurationSection questSec = dataSec.getConfigurationSection(key); final Quest quest = plugin.getQuestById(key) != null ? plugin.getQuestById(key) : plugin.getQuest(key); @@ -264,7 +265,9 @@ public class BukkitQuesterYamlStorage implements QuesterStorageImpl { if (questSec.contains("stage-delay")) { quester.getQuestDataOrDefault(quest).setDelayTimeLeft(questSec.getLong("stage-delay")); } + questProgress.put(quest, bukkitQuestData); } + quester.setQuestProgress(questProgress); } return quester; }