Track progress through int, part 4. See #2250

This commit is contained in:
PikaMug 2024-07-14 16:10:46 -04:00
parent 7e4f1ea561
commit c9c4979d60
2 changed files with 10 additions and 7 deletions

View File

@ -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()) {

View File

@ -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<Quest, BukkitQuestProgress> 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;
}