mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-21 18:15:32 +01:00
Track progress through int, part 5. See #2250
This commit is contained in:
parent
c9c4979d60
commit
217620a4db
@ -1162,7 +1162,6 @@ public class BukkitQuester implements Quester {
|
|||||||
* @param formatNames Whether to format item/entity names, if applicable
|
* @param formatNames Whether to format item/entity names, if applicable
|
||||||
* @return List of detailed objectives
|
* @return List of detailed objectives
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public LinkedList<Objective> getCurrentObjectives(final Quest quest, final boolean ignoreOverrides,
|
public LinkedList<Objective> getCurrentObjectives(final Quest quest, final boolean ignoreOverrides,
|
||||||
final boolean formatNames) {
|
final boolean formatNames) {
|
||||||
if (quest == null) {
|
if (quest == null) {
|
||||||
@ -2155,7 +2154,7 @@ public class BukkitQuester implements Quester {
|
|||||||
}
|
}
|
||||||
for (final Integer match : matches) {
|
for (final Integer match : matches) {
|
||||||
final int amount = bukkitQuestData.itemsCrafted.get(match);
|
final int amount = bukkitQuestData.itemsCrafted.get(match);
|
||||||
final int goal = ((BukkitStage) getCurrentStage(quest)).getItemsToCraft().get(match).getAmount();
|
final ItemStack goal = ((BukkitStage) getCurrentStage(quest)).getItemsToCraft().get(match);
|
||||||
|
|
||||||
final ObjectiveType type = ObjectiveType.CRAFT_ITEM;
|
final ObjectiveType type = ObjectiveType.CRAFT_ITEM;
|
||||||
final BukkitQuesterPreUpdateObjectiveEvent preEvent = new BukkitQuesterPreUpdateObjectiveEvent(this, quest,
|
final BukkitQuesterPreUpdateObjectiveEvent preEvent = new BukkitQuesterPreUpdateObjectiveEvent(this, quest,
|
||||||
@ -2164,8 +2163,7 @@ public class BukkitQuester implements Quester {
|
|||||||
|
|
||||||
final int progress = crafted.getAmount() + amount;
|
final int progress = crafted.getAmount() + amount;
|
||||||
bukkitQuestData.itemsCrafted.set(match, progress);
|
bukkitQuestData.itemsCrafted.set(match, progress);
|
||||||
final Material m = crafted.getType();
|
if (progress >= goal.getAmount()) {
|
||||||
if (progress >= goal) {
|
|
||||||
finishObjective(quest, new BukkitObjective(type, null, progress, goal), null, null, null, null,
|
finishObjective(quest, new BukkitObjective(type, null, progress, goal), null, null, null, null,
|
||||||
null, null, null);
|
null, null, null);
|
||||||
|
|
||||||
@ -2205,7 +2203,7 @@ public class BukkitQuester implements Quester {
|
|||||||
}
|
}
|
||||||
for (final Integer match : matches) {
|
for (final Integer match : matches) {
|
||||||
final int amount = bukkitQuestData.itemsSmelted.get(match);
|
final int amount = bukkitQuestData.itemsSmelted.get(match);
|
||||||
final int goal = ((BukkitStage) getCurrentStage(quest)).getItemsToSmelt().get(match).getAmount();
|
final ItemStack goal = ((BukkitStage) getCurrentStage(quest)).getItemsToSmelt().get(match);
|
||||||
|
|
||||||
final ObjectiveType type = ObjectiveType.SMELT_ITEM;
|
final ObjectiveType type = ObjectiveType.SMELT_ITEM;
|
||||||
final BukkitQuesterPreUpdateObjectiveEvent preEvent = new BukkitQuesterPreUpdateObjectiveEvent(this, quest,
|
final BukkitQuesterPreUpdateObjectiveEvent preEvent = new BukkitQuesterPreUpdateObjectiveEvent(this, quest,
|
||||||
@ -2214,8 +2212,7 @@ public class BukkitQuester implements Quester {
|
|||||||
|
|
||||||
final int progress = smelted.getAmount() + amount;
|
final int progress = smelted.getAmount() + amount;
|
||||||
bukkitQuestData.itemsSmelted.set(match, progress);
|
bukkitQuestData.itemsSmelted.set(match, progress);
|
||||||
final Material m = smelted.getType();
|
if (progress >= goal.getAmount()) {
|
||||||
if (progress >= goal) {
|
|
||||||
finishObjective(quest, new BukkitObjective(type, null, progress, goal), null, null, null, null,
|
finishObjective(quest, new BukkitObjective(type, null, progress, goal), null, null, null, null,
|
||||||
null, null, null);
|
null, null, null);
|
||||||
|
|
||||||
@ -2258,7 +2255,7 @@ public class BukkitQuester implements Quester {
|
|||||||
}
|
}
|
||||||
for (final Integer match : matches) {
|
for (final Integer match : matches) {
|
||||||
final int amount = bukkitQuestData.itemsEnchanted.get(match);
|
final int amount = bukkitQuestData.itemsEnchanted.get(match);
|
||||||
final int goal = ((BukkitStage) getCurrentStage(quest)).getItemsToEnchant().get(match).getAmount();
|
final ItemStack goal = ((BukkitStage) getCurrentStage(quest)).getItemsToEnchant().get(match);
|
||||||
|
|
||||||
final ObjectiveType type = ObjectiveType.ENCHANT_ITEM;
|
final ObjectiveType type = ObjectiveType.ENCHANT_ITEM;
|
||||||
final BukkitQuesterPreUpdateObjectiveEvent preEvent = new BukkitQuesterPreUpdateObjectiveEvent(this, quest,
|
final BukkitQuesterPreUpdateObjectiveEvent preEvent = new BukkitQuesterPreUpdateObjectiveEvent(this, quest,
|
||||||
@ -2267,8 +2264,7 @@ public class BukkitQuester implements Quester {
|
|||||||
|
|
||||||
final int progress = enchantedBook.getAmount() + amount;
|
final int progress = enchantedBook.getAmount() + amount;
|
||||||
bukkitQuestData.itemsEnchanted.set(match, progress);
|
bukkitQuestData.itemsEnchanted.set(match, progress);
|
||||||
final Material m = enchantedBook.getType();
|
if (progress >= goal.getAmount()) {
|
||||||
if (progress >= goal) {
|
|
||||||
finishObjective(quest, new BukkitObjective(type, null, progress, goal), null, null, null, null,
|
finishObjective(quest, new BukkitObjective(type, null, progress, goal), null, null, null, null,
|
||||||
null, null, null);
|
null, null, null);
|
||||||
|
|
||||||
@ -2316,7 +2312,7 @@ public class BukkitQuester implements Quester {
|
|||||||
}
|
}
|
||||||
for (final Integer match : matches) {
|
for (final Integer match : matches) {
|
||||||
final int amount = bukkitQuestData.itemsEnchanted.get(match);
|
final int amount = bukkitQuestData.itemsEnchanted.get(match);
|
||||||
final int goal = ((BukkitStage) getCurrentStage(quest)).getItemsToEnchant().get(match).getAmount();
|
final ItemStack goal = ((BukkitStage) getCurrentStage(quest)).getItemsToEnchant().get(match);
|
||||||
|
|
||||||
final ObjectiveType type = ObjectiveType.ENCHANT_ITEM;
|
final ObjectiveType type = ObjectiveType.ENCHANT_ITEM;
|
||||||
final BukkitQuesterPreUpdateObjectiveEvent preEvent = new BukkitQuesterPreUpdateObjectiveEvent(this, quest,
|
final BukkitQuesterPreUpdateObjectiveEvent preEvent = new BukkitQuesterPreUpdateObjectiveEvent(this, quest,
|
||||||
@ -2325,8 +2321,7 @@ public class BukkitQuester implements Quester {
|
|||||||
|
|
||||||
final int progress = enchanted.getAmount() + amount;
|
final int progress = enchanted.getAmount() + amount;
|
||||||
bukkitQuestData.itemsEnchanted.set(match, progress);
|
bukkitQuestData.itemsEnchanted.set(match, progress);
|
||||||
final Material m = enchanted.getType();
|
if (progress >= goal.getAmount()) {
|
||||||
if (progress >= goal) {
|
|
||||||
finishObjective(quest, new BukkitObjective(type, null, progress, goal), null, null, null, null,
|
finishObjective(quest, new BukkitObjective(type, null, progress, goal), null, null, null, null,
|
||||||
null, null, null);
|
null, null, null);
|
||||||
|
|
||||||
@ -2366,7 +2361,7 @@ public class BukkitQuester implements Quester {
|
|||||||
}
|
}
|
||||||
for (final Integer match : matches) {
|
for (final Integer match : matches) {
|
||||||
final int amount = bukkitQuestData.itemsBrewed.get(match);
|
final int amount = bukkitQuestData.itemsBrewed.get(match);
|
||||||
final int goal = ((BukkitStage) getCurrentStage(quest)).getItemsToBrew().get(match).getAmount();
|
final ItemStack goal = ((BukkitStage) getCurrentStage(quest)).getItemsToBrew().get(match);
|
||||||
|
|
||||||
final ObjectiveType type = ObjectiveType.BREW_ITEM;
|
final ObjectiveType type = ObjectiveType.BREW_ITEM;
|
||||||
final BukkitQuesterPreUpdateObjectiveEvent preEvent = new BukkitQuesterPreUpdateObjectiveEvent(this, quest,
|
final BukkitQuesterPreUpdateObjectiveEvent preEvent = new BukkitQuesterPreUpdateObjectiveEvent(this, quest,
|
||||||
@ -2375,8 +2370,7 @@ public class BukkitQuester implements Quester {
|
|||||||
|
|
||||||
final int progress = brewed.getAmount() + amount;
|
final int progress = brewed.getAmount() + amount;
|
||||||
bukkitQuestData.itemsBrewed.set(match, progress);
|
bukkitQuestData.itemsBrewed.set(match, progress);
|
||||||
final Material m = brewed.getType();
|
if (progress >= goal.getAmount()) {
|
||||||
if (progress >= goal) {
|
|
||||||
finishObjective(quest, new BukkitObjective(type, null, progress, goal), null, null, null, null,
|
finishObjective(quest, new BukkitObjective(type, null, progress, goal), null, null, null, null,
|
||||||
null, null, null);
|
null, null, null);
|
||||||
|
|
||||||
@ -2416,7 +2410,7 @@ public class BukkitQuester implements Quester {
|
|||||||
}
|
}
|
||||||
for (final Integer match : matches) {
|
for (final Integer match : matches) {
|
||||||
final int amount = bukkitQuestData.itemsConsumed.get(match);
|
final int amount = bukkitQuestData.itemsConsumed.get(match);
|
||||||
final int goal = ((BukkitStage) getCurrentStage(quest)).getItemsToConsume().get(match).getAmount();
|
final ItemStack goal = ((BukkitStage) getCurrentStage(quest)).getItemsToConsume().get(match);
|
||||||
|
|
||||||
final ObjectiveType type = ObjectiveType.CONSUME_ITEM;
|
final ObjectiveType type = ObjectiveType.CONSUME_ITEM;
|
||||||
final BukkitQuesterPreUpdateObjectiveEvent preEvent = new BukkitQuesterPreUpdateObjectiveEvent(this, quest,
|
final BukkitQuesterPreUpdateObjectiveEvent preEvent = new BukkitQuesterPreUpdateObjectiveEvent(this, quest,
|
||||||
@ -2425,8 +2419,7 @@ public class BukkitQuester implements Quester {
|
|||||||
|
|
||||||
final int progress = consumed.getAmount() + amount;
|
final int progress = consumed.getAmount() + amount;
|
||||||
bukkitQuestData.itemsConsumed.set(match, progress);
|
bukkitQuestData.itemsConsumed.set(match, progress);
|
||||||
final Material m = consumed.getType();
|
if (progress >= goal.getAmount()) {
|
||||||
if (progress >= goal) {
|
|
||||||
finishObjective(quest, new BukkitObjective(type, null, progress, goal), null, null, null, null,
|
finishObjective(quest, new BukkitObjective(type, null, progress, goal), null, null, null, null,
|
||||||
null, null, null);
|
null, null, null);
|
||||||
|
|
||||||
@ -2475,7 +2468,7 @@ public class BukkitQuester implements Quester {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final int amount = bukkitQuestData.itemsDelivered.get(match);
|
final int amount = bukkitQuestData.itemsDelivered.get(match);
|
||||||
final int goal = ((BukkitStage) getCurrentStage(quest)).getItemsToDeliver().get(match).getAmount();
|
final ItemStack goal = ((BukkitStage) getCurrentStage(quest)).getItemsToDeliver().get(match);
|
||||||
|
|
||||||
final ObjectiveType type = ObjectiveType.DELIVER_ITEM;
|
final ObjectiveType type = ObjectiveType.DELIVER_ITEM;
|
||||||
final Set<String> dispatchedQuestIDs = new HashSet<>();
|
final Set<String> dispatchedQuestIDs = new HashSet<>();
|
||||||
@ -2484,18 +2477,17 @@ public class BukkitQuester implements Quester {
|
|||||||
plugin.getServer().getPluginManager().callEvent(preEvent);
|
plugin.getServer().getPluginManager().callEvent(preEvent);
|
||||||
|
|
||||||
final int progress = delivered.getAmount() + amount;
|
final int progress = delivered.getAmount() + amount;
|
||||||
final Material m = delivered.getType();
|
|
||||||
final int index = player.getInventory().first(delivered);
|
final int index = player.getInventory().first(delivered);
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
// Already delivered in previous loop
|
// Already delivered in previous loop
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bukkitQuestData.itemsDelivered.set(match, progress);
|
bukkitQuestData.itemsDelivered.set(match, progress);
|
||||||
if (progress >= goal) {
|
if (progress >= goal.getAmount()) {
|
||||||
if ((delivered.getAmount() + amount) >= goal) {
|
if ((delivered.getAmount() + amount) >= goal.getAmount()) {
|
||||||
// Take away remaining amount to be delivered
|
// Take away remaining amount to be delivered
|
||||||
final ItemStack clone = delivered.clone();
|
final ItemStack clone = delivered.clone();
|
||||||
clone.setAmount(delivered.getAmount() - (goal - amount));
|
clone.setAmount(delivered.getAmount() - (goal.getAmount() - amount));
|
||||||
player.getInventory().setItem(index, clone);
|
player.getInventory().setItem(index, clone);
|
||||||
} else {
|
} else {
|
||||||
player.getInventory().setItem(index, null);
|
player.getInventory().setItem(index, null);
|
||||||
@ -2509,7 +2501,7 @@ public class BukkitQuester implements Quester {
|
|||||||
final String[] message = BukkitConfigUtil.parseStringWithPossibleLineBreaks(getCurrentStage(quest)
|
final String[] message = BukkitConfigUtil.parseStringWithPossibleLineBreaks(getCurrentStage(quest)
|
||||||
.getDeliverMessages().get(new Random().nextInt(getCurrentStage(quest)
|
.getDeliverMessages().get(new Random().nextInt(getCurrentStage(quest)
|
||||||
.getDeliverMessages().size())), getCurrentStage(quest).getItemDeliveryTargets()
|
.getDeliverMessages().size())), getCurrentStage(quest).getItemDeliveryTargets()
|
||||||
.get(match), goal - progress);
|
.get(match), goal.getAmount() - progress);
|
||||||
player.sendMessage(message);
|
player.sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3417,23 +3409,6 @@ public class BukkitQuester implements Quester {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets an item with 0 amount (ideal), unless server is on certain builds of Paper
|
|
||||||
* server software, in which case gets an item with 1 amount (not ideal)
|
|
||||||
*
|
|
||||||
* @param type Material of item
|
|
||||||
* @param durability Durability of item
|
|
||||||
* @return item with 0 or 1 amount
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
private ItemStack getLowItemStack(final Material type, final short durability) {
|
|
||||||
try {
|
|
||||||
return new ItemStack(type, 0, durability);
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
return new ItemStack(type, 1, durability);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add empty map values per Quest stage
|
* Add empty map values per Quest stage
|
||||||
@ -3441,7 +3416,6 @@ public class BukkitQuester implements Quester {
|
|||||||
* @param quest Quest with at least one stage
|
* @param quest Quest with at least one stage
|
||||||
* @param stage Where first stage is '0'
|
* @param stage Where first stage is '0'
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public void addEmptiesFor(final Quest quest, final int stage) {
|
public void addEmptiesFor(final Quest quest, final int stage) {
|
||||||
final BukkitQuestProgress data = new BukkitQuestProgress(this);
|
final BukkitQuestProgress data = new BukkitQuestProgress(this);
|
||||||
data.setDoJournalUpdate(false);
|
data.setDoJournalUpdate(false);
|
||||||
@ -3491,7 +3465,7 @@ public class BukkitQuester implements Quester {
|
|||||||
}
|
}
|
||||||
if (!bukkitStage.getItemsToEnchant().isEmpty()) {
|
if (!bukkitStage.getItemsToEnchant().isEmpty()) {
|
||||||
for (final ItemStack ignored : bukkitStage.getItemsToEnchant()) {
|
for (final ItemStack ignored : bukkitStage.getItemsToEnchant()) {
|
||||||
data.blocksUsed.add(0);
|
data.itemsEnchanted.add(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!bukkitStage.getItemsToBrew().isEmpty()) {
|
if (!bukkitStage.getItemsToBrew().isEmpty()) {
|
||||||
|
@ -175,95 +175,95 @@ public class BukkitQuesterYamlStorage implements QuesterStorageImpl {
|
|||||||
final BukkitQuestProgress bukkitQuestData = (BukkitQuestProgress) quester.getQuestDataOrDefault(quest);
|
final BukkitQuestProgress bukkitQuestData = (BukkitQuestProgress) quester.getQuestDataOrDefault(quest);
|
||||||
if (questSec.contains("blocks-broken-amounts")) {
|
if (questSec.contains("blocks-broken-amounts")) {
|
||||||
final List<Integer> brokenAmounts = questSec.getIntegerList("blocks-broken-amounts");
|
final List<Integer> brokenAmounts = questSec.getIntegerList("blocks-broken-amounts");
|
||||||
quester.getQuestDataOrDefault(quest).setBlocksBroken(new LinkedList<>(brokenAmounts));
|
bukkitQuestData.setBlocksBroken(new LinkedList<>(brokenAmounts));
|
||||||
}
|
}
|
||||||
if (questSec.contains("blocks-damaged-amounts")) {
|
if (questSec.contains("blocks-damaged-amounts")) {
|
||||||
final List<Integer> damagedAmounts = questSec.getIntegerList("blocks-damaged-amounts");
|
final List<Integer> damagedAmounts = questSec.getIntegerList("blocks-damaged-amounts");
|
||||||
quester.getQuestDataOrDefault(quest).setBlocksDamaged(new LinkedList<>(damagedAmounts));
|
bukkitQuestData.setBlocksDamaged(new LinkedList<>(damagedAmounts));
|
||||||
}
|
}
|
||||||
if (questSec.contains("blocks-placed-amounts")) {
|
if (questSec.contains("blocks-placed-amounts")) {
|
||||||
final List<Integer> placedAmounts = questSec.getIntegerList("blocks-placed-amounts");
|
final List<Integer> placedAmounts = questSec.getIntegerList("blocks-placed-amounts");
|
||||||
quester.getQuestDataOrDefault(quest).setBlocksPlaced(new LinkedList<>(placedAmounts));
|
bukkitQuestData.setBlocksPlaced(new LinkedList<>(placedAmounts));
|
||||||
}
|
}
|
||||||
if (questSec.contains("blocks-used-amounts")) {
|
if (questSec.contains("blocks-used-amounts")) {
|
||||||
final List<Integer> usedAmounts = questSec.getIntegerList("blocks-used-amounts");
|
final List<Integer> usedAmounts = questSec.getIntegerList("blocks-used-amounts");
|
||||||
quester.getQuestDataOrDefault(quest).setBlocksUsed(new LinkedList<>(usedAmounts));
|
bukkitQuestData.setBlocksUsed(new LinkedList<>(usedAmounts));
|
||||||
}
|
}
|
||||||
if (questSec.contains("blocks-cut-amounts")) {
|
if (questSec.contains("blocks-cut-amounts")) {
|
||||||
final List<Integer> cutAmounts = questSec.getIntegerList("blocks-cut-amounts");
|
final List<Integer> cutAmounts = questSec.getIntegerList("blocks-cut-amounts");
|
||||||
quester.getQuestDataOrDefault(quest).setBlocksCut(new LinkedList<>(cutAmounts));
|
bukkitQuestData.setBlocksCut(new LinkedList<>(cutAmounts));
|
||||||
}
|
}
|
||||||
if (questSec.contains("item-craft-amounts")) {
|
if (questSec.contains("item-craft-amounts")) {
|
||||||
final List<Integer> craftAmounts = questSec.getIntegerList("item-craft-amounts");
|
final List<Integer> craftAmounts = questSec.getIntegerList("item-craft-amounts");
|
||||||
quester.getQuestDataOrDefault(quest).setItemsCrafted(new LinkedList<>(craftAmounts));
|
bukkitQuestData.setItemsCrafted(new LinkedList<>(craftAmounts));
|
||||||
}
|
}
|
||||||
if (questSec.contains("item-smelt-amounts")) {
|
if (questSec.contains("item-smelt-amounts")) {
|
||||||
final List<Integer> smeltAmounts = questSec.getIntegerList("item-smelt-amounts");
|
final List<Integer> smeltAmounts = questSec.getIntegerList("item-smelt-amounts");
|
||||||
quester.getQuestDataOrDefault(quest).setItemsSmelted(new LinkedList<>(smeltAmounts));
|
bukkitQuestData.setItemsSmelted(new LinkedList<>(smeltAmounts));
|
||||||
}
|
}
|
||||||
if (questSec.contains("item-enchant-amounts")) {
|
if (questSec.contains("item-enchant-amounts")) {
|
||||||
final List<Integer> enchantAmounts = questSec.getIntegerList("item-enchant-amounts");
|
final List<Integer> enchantAmounts = questSec.getIntegerList("item-enchant-amounts");
|
||||||
quester.getQuestDataOrDefault(quest).setItemsEnchanted(new LinkedList<>(enchantAmounts));
|
bukkitQuestData.setItemsEnchanted(new LinkedList<>(enchantAmounts));
|
||||||
}
|
}
|
||||||
if (questSec.contains("item-brew-amounts")) {
|
if (questSec.contains("item-brew-amounts")) {
|
||||||
final List<Integer> brewAmounts = questSec.getIntegerList("item-brew-amounts");
|
final List<Integer> brewAmounts = questSec.getIntegerList("item-brew-amounts");
|
||||||
quester.getQuestDataOrDefault(quest).setItemsBrewed(new LinkedList<>(brewAmounts));
|
bukkitQuestData.setItemsBrewed(new LinkedList<>(brewAmounts));
|
||||||
}
|
}
|
||||||
if (questSec.contains("item-consume-amounts")) {
|
if (questSec.contains("item-consume-amounts")) {
|
||||||
final List<Integer> consumeAmounts = questSec.getIntegerList("item-consume-amounts");
|
final List<Integer> consumeAmounts = questSec.getIntegerList("item-consume-amounts");
|
||||||
quester.getQuestDataOrDefault(quest).setItemsConsumed(new LinkedList<>(consumeAmounts));
|
bukkitQuestData.setItemsConsumed(new LinkedList<>(consumeAmounts));
|
||||||
}
|
}
|
||||||
if (questSec.contains("item-delivery-amounts")) {
|
if (questSec.contains("item-delivery-amounts")) {
|
||||||
final List<Integer> deliveryAmounts = questSec.getIntegerList("item-delivery-amounts");
|
final List<Integer> deliveryAmounts = questSec.getIntegerList("item-delivery-amounts");
|
||||||
quester.getQuestDataOrDefault(quest).setItemsDelivered(new LinkedList<>(deliveryAmounts));
|
bukkitQuestData.setItemsDelivered(new LinkedList<>(deliveryAmounts));
|
||||||
}
|
}
|
||||||
if (questSec.contains("has-talked-to")) {
|
if (questSec.contains("has-talked-to")) {
|
||||||
final List<Boolean> talkAmount = questSec.getBooleanList("has-talked-to");
|
final List<Boolean> talkAmount = questSec.getBooleanList("has-talked-to");
|
||||||
quester.getQuestDataOrDefault(quest).setNpcsInteracted(new LinkedList<>(talkAmount));
|
bukkitQuestData.setNpcsInteracted(new LinkedList<>(talkAmount));
|
||||||
}
|
}
|
||||||
if (questSec.contains("npc-killed-amounts")) {
|
if (questSec.contains("npc-killed-amounts")) {
|
||||||
final List<Integer> npcAmounts = questSec.getIntegerList("npc-killed-amounts");
|
final List<Integer> npcAmounts = questSec.getIntegerList("npc-killed-amounts");
|
||||||
quester.getQuestDataOrDefault(quest).setNpcsNumKilled(new LinkedList<>(npcAmounts));
|
bukkitQuestData.setNpcsNumKilled(new LinkedList<>(npcAmounts));
|
||||||
} else if (questSec.contains("citizen-amounts-killed")) {
|
} else if (questSec.contains("citizen-amounts-killed")) {
|
||||||
// Legacy
|
// Legacy
|
||||||
final List<Integer> npcAmounts = questSec.getIntegerList("citizen-amounts-killed");
|
final List<Integer> npcAmounts = questSec.getIntegerList("citizen-amounts-killed");
|
||||||
quester.getQuestDataOrDefault(quest).setNpcsNumKilled(new LinkedList<>(npcAmounts));
|
bukkitQuestData.setNpcsNumKilled(new LinkedList<>(npcAmounts));
|
||||||
}
|
}
|
||||||
if (questSec.contains("cows-milked")) {
|
if (questSec.contains("cows-milked")) {
|
||||||
quester.getQuestDataOrDefault(quest).setCowsMilked(questSec.getInt("cows-milked"));
|
bukkitQuestData.setCowsMilked(questSec.getInt("cows-milked"));
|
||||||
}
|
}
|
||||||
if (questSec.contains("fish-caught")) {
|
if (questSec.contains("fish-caught")) {
|
||||||
quester.getQuestDataOrDefault(quest).setFishCaught(questSec.getInt("fish-caught"));
|
bukkitQuestData.setFishCaught(questSec.getInt("fish-caught"));
|
||||||
}
|
}
|
||||||
if (questSec.contains("players-killed")) {
|
if (questSec.contains("players-killed")) {
|
||||||
quester.getQuestDataOrDefault(quest).setPlayersKilled(questSec.getInt("players-killed"));
|
bukkitQuestData.setPlayersKilled(questSec.getInt("players-killed"));
|
||||||
}
|
}
|
||||||
if (questSec.contains("mobs-killed-amounts")) {
|
if (questSec.contains("mobs-killed-amounts")) {
|
||||||
final List<Integer> mobAmounts = questSec.getIntegerList("mobs-killed-amounts");
|
final List<Integer> mobAmounts = questSec.getIntegerList("mobs-killed-amounts");
|
||||||
quester.getQuestDataOrDefault(quest).setMobNumKilled(new LinkedList<>(mobAmounts));
|
bukkitQuestData.setMobNumKilled(new LinkedList<>(mobAmounts));
|
||||||
}
|
}
|
||||||
if (questSec.contains("has-reached-location")) {
|
if (questSec.contains("has-reached-location")) {
|
||||||
final List<Boolean> hasReached = questSec.getBooleanList("has-reached-location");
|
final List<Boolean> hasReached = questSec.getBooleanList("has-reached-location");
|
||||||
quester.getQuestDataOrDefault(quest).setLocationsReached(new LinkedList<>(hasReached));
|
bukkitQuestData.setLocationsReached(new LinkedList<>(hasReached));
|
||||||
}
|
}
|
||||||
if (questSec.contains("mob-tame-amounts")) {
|
if (questSec.contains("mob-tame-amounts")) {
|
||||||
final List<Integer> tameAmounts = questSec.getIntegerList("mob-tame-amounts");
|
final List<Integer> tameAmounts = questSec.getIntegerList("mob-tame-amounts");
|
||||||
quester.getQuestDataOrDefault(quest).setMobsTamed(new LinkedList<>(tameAmounts));
|
bukkitQuestData.setMobsTamed(new LinkedList<>(tameAmounts));
|
||||||
}
|
}
|
||||||
if (questSec.contains("sheep-sheared")) {
|
if (questSec.contains("sheep-sheared")) {
|
||||||
final List<Integer> sheepAmounts = questSec.getIntegerList("sheep-sheared");
|
final List<Integer> sheepAmounts = questSec.getIntegerList("sheep-sheared");
|
||||||
quester.getQuestDataOrDefault(quest).setSheepSheared(new LinkedList<>(sheepAmounts));
|
bukkitQuestData.setSheepSheared(new LinkedList<>(sheepAmounts));
|
||||||
}
|
}
|
||||||
if (questSec.contains("passwords-said")) {
|
if (questSec.contains("passwords-said")) {
|
||||||
final List<Boolean> passAmounts = questSec.getBooleanList("passwords-said");
|
final List<Boolean> passAmounts = questSec.getBooleanList("passwords-said");
|
||||||
quester.getQuestDataOrDefault(quest).setPasswordsSaid(new LinkedList<>(passAmounts));
|
bukkitQuestData.setPasswordsSaid(new LinkedList<>(passAmounts));
|
||||||
}
|
}
|
||||||
if (questSec.contains("custom-objective-counts")) {
|
if (questSec.contains("custom-objective-counts")) {
|
||||||
final List<Integer> customObjCounts = questSec.getIntegerList("custom-objective-counts");
|
final List<Integer> customObjCounts = questSec.getIntegerList("custom-objective-counts");
|
||||||
quester.getQuestDataOrDefault(quest).setCustomObjectiveCounts(new LinkedList<>(customObjCounts));
|
bukkitQuestData.setCustomObjectiveCounts(new LinkedList<>(customObjCounts));
|
||||||
}
|
}
|
||||||
if (questSec.contains("stage-delay")) {
|
if (questSec.contains("stage-delay")) {
|
||||||
quester.getQuestDataOrDefault(quest).setDelayTimeLeft(questSec.getLong("stage-delay"));
|
bukkitQuestData.setDelayTimeLeft(questSec.getLong("stage-delay"));
|
||||||
}
|
}
|
||||||
questProgress.put(quest, bukkitQuestData);
|
questProgress.put(quest, bukkitQuestData);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user