mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-21 18:15:32 +01:00
Track progress through int, part 2. Fixes #2246
This commit is contained in:
parent
10880e8a2e
commit
0d79f5fbc1
@ -13,27 +13,27 @@ package me.pikamug.quests.player;
|
||||
import java.util.LinkedList;
|
||||
|
||||
public interface QuestProgress {
|
||||
LinkedList<?> getBlocksBroken();
|
||||
LinkedList<Integer> getBlocksBroken();
|
||||
|
||||
LinkedList<?> getBlocksDamaged();
|
||||
LinkedList<Integer> getBlocksDamaged();
|
||||
|
||||
LinkedList<?> getBlocksPlaced();
|
||||
LinkedList<Integer> getBlocksPlaced();
|
||||
|
||||
LinkedList<?> getBlocksUsed();
|
||||
LinkedList<Integer> getBlocksUsed();
|
||||
|
||||
LinkedList<?> getBlocksCut();
|
||||
LinkedList<Integer> getBlocksCut();
|
||||
|
||||
LinkedList<?> getItemsCrafted();
|
||||
LinkedList<Integer> getItemsCrafted();
|
||||
|
||||
LinkedList<?> getItemsSmelted();
|
||||
LinkedList<Integer> getItemsSmelted();
|
||||
|
||||
LinkedList<?> getItemsEnchanted();
|
||||
LinkedList<Integer> getItemsEnchanted();
|
||||
|
||||
LinkedList<?> getItemsBrewed();
|
||||
LinkedList<Integer> getItemsBrewed();
|
||||
|
||||
LinkedList<?> getItemsConsumed();
|
||||
LinkedList<Integer> getItemsConsumed();
|
||||
|
||||
LinkedList<?> getItemsDelivered();
|
||||
LinkedList<Integer> getItemsDelivered();
|
||||
|
||||
LinkedList<Boolean> getNpcsInteracted();
|
||||
|
||||
|
@ -102,7 +102,12 @@ public class BukkitBlockListener implements Listener {
|
||||
if (quest.getOptions().canIgnoreBlockReplace()) {
|
||||
// Ignore blocks broken once replaced (self)
|
||||
if (currentStage.containsObjective(placeType)) {
|
||||
for (final ItemStack is : questData.blocksPlaced) {
|
||||
for (int i = 0; i < questData.blocksPlaced.size(); i++) {
|
||||
final int progress = questData.blocksPlaced.get(i) - 1;
|
||||
if (progress < 0) {
|
||||
break;
|
||||
}
|
||||
final ItemStack is = currentStage.getBlocksToBreak().get(i);
|
||||
if (event.getBlock().getType().equals(is.getType()) && is.getAmount() > 0) {
|
||||
ItemStack goal = new ItemStack(is.getType(), 64);
|
||||
for (final ItemStack stack : currentStage.getBlocksToPlace()) {
|
||||
@ -116,14 +121,11 @@ public class BukkitBlockListener implements Listener {
|
||||
new BukkitObjective(placeType, null, is.getAmount(), goal.getAmount()));
|
||||
plugin.getServer().getPluginManager().callEvent(preEvent);
|
||||
|
||||
final int index = questData.blocksPlaced.indexOf(is);
|
||||
final int newAmount = is.getAmount() - 1;
|
||||
is.setAmount(newAmount);
|
||||
questData.blocksPlaced.set(index, is);
|
||||
questData.blocksPlaced.set(i, progress);
|
||||
|
||||
final BukkitQuesterPostUpdateObjectiveEvent postEvent
|
||||
= new BukkitQuesterPostUpdateObjectiveEvent(quester, quest,
|
||||
new BukkitObjective(placeType, null, newAmount, goal.getAmount()));
|
||||
new BukkitObjective(placeType, null, progress, goal.getAmount()));
|
||||
plugin.getServer().getPluginManager().callEvent(postEvent);
|
||||
}
|
||||
}
|
||||
@ -133,7 +135,12 @@ public class BukkitBlockListener implements Listener {
|
||||
(final Quester q, final Quest cq) -> {
|
||||
if (!dispatchedPlaceQuestIDs.contains(cq.getId())) {
|
||||
final BukkitQuestProgress qQuestData = (BukkitQuestProgress) q.getQuestDataOrDefault(cq);
|
||||
for (final ItemStack is : qQuestData.blocksPlaced) {
|
||||
for (int i = 0; i < qQuestData.blocksPlaced.size(); i++) {
|
||||
final int progress = qQuestData.blocksPlaced.get(i) - 1;
|
||||
if (progress < 0) {
|
||||
break;
|
||||
}
|
||||
final ItemStack is = currentStage.getBlocksToBreak().get(i);
|
||||
if (event.getBlock().getType().equals(is.getType()) && is.getAmount() > 0) {
|
||||
ItemStack goal = new ItemStack(is.getType(), 64);
|
||||
for (final ItemStack stack : ((BukkitStage) quester.getCurrentStage(cq)).getBlocksToPlace()) {
|
||||
@ -147,14 +154,11 @@ public class BukkitBlockListener implements Listener {
|
||||
new BukkitObjective(placeType, null, is.getAmount(), goal.getAmount()));
|
||||
plugin.getServer().getPluginManager().callEvent(preEvent);
|
||||
|
||||
final int index = qQuestData.blocksPlaced.indexOf(is);
|
||||
final int newAmount = is.getAmount() - 1;
|
||||
is.setAmount(newAmount);
|
||||
qQuestData.blocksPlaced.set(index, is);
|
||||
qQuestData.blocksPlaced.set(i, progress);
|
||||
|
||||
final BukkitQuesterPostUpdateObjectiveEvent postEvent
|
||||
= new BukkitQuesterPostUpdateObjectiveEvent((BukkitQuester) q, cq,
|
||||
new BukkitObjective(placeType, null, newAmount, goal.getAmount()));
|
||||
new BukkitObjective(placeType, null, progress, goal.getAmount()));
|
||||
plugin.getServer().getPluginManager().callEvent(postEvent);
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,6 @@
|
||||
|
||||
package me.pikamug.quests.player;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
|
||||
@ -25,7 +23,7 @@ public class BukkitQuestProgress implements QuestProgress {
|
||||
public BukkitQuestProgress(final Quester quester) {
|
||||
this.quester = quester;
|
||||
}
|
||||
// TODO increase serial id
|
||||
|
||||
public LinkedList<Integer> blocksBroken = new LinkedList<Integer>() {
|
||||
|
||||
private static final long serialVersionUID = -6071822509475270169L;
|
||||
@ -93,32 +91,39 @@ public class BukkitQuestProgress implements QuestProgress {
|
||||
}
|
||||
};
|
||||
|
||||
public LinkedList<ItemStack> blocksDamaged = new LinkedList<ItemStack>() {
|
||||
public LinkedList<Integer> blocksDamaged = new LinkedList<Integer>() {
|
||||
|
||||
private static final long serialVersionUID = -4211891633163257743L;
|
||||
private static final long serialVersionUID = -4211891633163257744L;
|
||||
|
||||
@Override
|
||||
public ItemStack set(final int index, final ItemStack key) {
|
||||
final ItemStack data = super.set(index, key);
|
||||
public boolean add(final Integer e) {
|
||||
final boolean b = super.add(e);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return data;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(final ItemStack key) {
|
||||
final boolean data = super.add(key);
|
||||
public void add(final int index, final Integer element) {
|
||||
super.add(index, element);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(final Object key) {
|
||||
final boolean i = super.remove(key);
|
||||
public boolean addAll(final Collection<? extends Integer> c) {
|
||||
final boolean b = super.addAll(c);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return i;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final int index, final Collection<? extends Integer> c) {
|
||||
final boolean b = super.addAll(index, c);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -129,40 +134,63 @@ public class BukkitQuestProgress implements QuestProgress {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final Collection<? extends ItemStack> m) {
|
||||
final boolean i = super.addAll(m);
|
||||
public boolean remove(final Object o) {
|
||||
final boolean b = super.remove(o);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return i;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer remove(final int index) {
|
||||
final Integer s = super.remove(index);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer set(final int index, final Integer element) {
|
||||
final Integer s = super.set(index, element);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
public LinkedList<ItemStack> blocksPlaced = new LinkedList<ItemStack>() {
|
||||
public LinkedList<Integer> blocksPlaced = new LinkedList<Integer>() {
|
||||
|
||||
private static final long serialVersionUID = 4226366446050903433L;
|
||||
private static final long serialVersionUID = 4226366446050903434L;
|
||||
|
||||
@Override
|
||||
public ItemStack set(final int index, final ItemStack key) {
|
||||
final ItemStack data = super.set(index, key);
|
||||
public boolean add(final Integer e) {
|
||||
final boolean b = super.add(e);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return data;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(final ItemStack key) {
|
||||
final boolean data = super.add(key);
|
||||
public void add(final int index, final Integer element) {
|
||||
super.add(index, element);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(final Object key) {
|
||||
final boolean i = super.remove(key);
|
||||
public boolean addAll(final Collection<? extends Integer> c) {
|
||||
final boolean b = super.addAll(c);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return i;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final int index, final Collection<? extends Integer> c) {
|
||||
final boolean b = super.addAll(index, c);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -173,40 +201,63 @@ public class BukkitQuestProgress implements QuestProgress {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final Collection<? extends ItemStack> m) {
|
||||
final boolean i = super.addAll(m);
|
||||
public boolean remove(final Object o) {
|
||||
final boolean b = super.remove(o);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return i;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer remove(final int index) {
|
||||
final Integer s = super.remove(index);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer set(final int index, final Integer element) {
|
||||
final Integer s = super.set(index, element);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
public LinkedList<ItemStack> blocksUsed = new LinkedList<ItemStack>() {
|
||||
public LinkedList<Integer> blocksUsed = new LinkedList<Integer>() {
|
||||
|
||||
private static final long serialVersionUID = -9057864863810306890L;
|
||||
private static final long serialVersionUID = -9057864863810306891L;
|
||||
|
||||
@Override
|
||||
public ItemStack set(final int index, final ItemStack key) {
|
||||
final ItemStack data = super.set(index, key);
|
||||
public boolean add(final Integer e) {
|
||||
final boolean b = super.add(e);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return data;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(final ItemStack key) {
|
||||
final boolean data = super.add(key);
|
||||
public void add(final int index, final Integer element) {
|
||||
super.add(index, element);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(final Object key) {
|
||||
final boolean i = super.remove(key);
|
||||
public boolean addAll(final Collection<? extends Integer> c) {
|
||||
final boolean b = super.addAll(c);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return i;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final int index, final Collection<? extends Integer> c) {
|
||||
final boolean b = super.addAll(index, c);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -217,40 +268,63 @@ public class BukkitQuestProgress implements QuestProgress {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final Collection<? extends ItemStack> m) {
|
||||
final boolean i = super.addAll(m);
|
||||
public boolean remove(final Object o) {
|
||||
final boolean b = super.remove(o);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return i;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer remove(final int index) {
|
||||
final Integer s = super.remove(index);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer set(final int index, final Integer element) {
|
||||
final Integer s = super.set(index, element);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
public LinkedList<ItemStack> blocksCut = new LinkedList<ItemStack>() {
|
||||
public LinkedList<Integer> blocksCut = new LinkedList<Integer>() {
|
||||
|
||||
private static final long serialVersionUID = -8204359763290995080L;
|
||||
private static final long serialVersionUID = -8204359763290995081L;
|
||||
|
||||
@Override
|
||||
public ItemStack set(final int index, final ItemStack key) {
|
||||
final ItemStack data = super.set(index, key);
|
||||
public boolean add(final Integer e) {
|
||||
final boolean b = super.add(e);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return data;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(final ItemStack key) {
|
||||
final boolean data = super.add(key);
|
||||
public void add(final int index, final Integer element) {
|
||||
super.add(index, element);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(final Object key) {
|
||||
final boolean i = super.remove(key);
|
||||
public boolean addAll(final Collection<? extends Integer> c) {
|
||||
final boolean b = super.addAll(c);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return i;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final int index, final Collection<? extends Integer> c) {
|
||||
final boolean b = super.addAll(index, c);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -261,40 +335,63 @@ public class BukkitQuestProgress implements QuestProgress {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final Collection<? extends ItemStack> m) {
|
||||
final boolean i = super.addAll(m);
|
||||
public boolean remove(final Object o) {
|
||||
final boolean b = super.remove(o);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return i;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer remove(final int index) {
|
||||
final Integer s = super.remove(index);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer set(final int index, final Integer element) {
|
||||
final Integer s = super.set(index, element);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
public LinkedList<ItemStack> itemsCrafted = new LinkedList<ItemStack>() {
|
||||
public LinkedList<Integer> itemsCrafted = new LinkedList<Integer>() {
|
||||
|
||||
private static final long serialVersionUID = 2774356294049526105L;
|
||||
private static final long serialVersionUID = 2774356294049526106L;
|
||||
|
||||
@Override
|
||||
public ItemStack set(final int index, final ItemStack key) {
|
||||
final ItemStack data = super.set(index, key);
|
||||
public boolean add(final Integer e) {
|
||||
final boolean b = super.add(e);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return data;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(final ItemStack key) {
|
||||
final boolean data = super.add(key);
|
||||
public void add(final int index, final Integer element) {
|
||||
super.add(index, element);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(final Object key) {
|
||||
final boolean i = super.remove(key);
|
||||
public boolean addAll(final Collection<? extends Integer> c) {
|
||||
final boolean b = super.addAll(c);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return i;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final int index, final Collection<? extends Integer> c) {
|
||||
final boolean b = super.addAll(index, c);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -305,128 +402,63 @@ public class BukkitQuestProgress implements QuestProgress {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final Collection<? extends ItemStack> m) {
|
||||
final boolean i = super.addAll(m);
|
||||
public boolean remove(final Object o) {
|
||||
final boolean b = super.remove(o);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return i;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer remove(final int index) {
|
||||
final Integer s = super.remove(index);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer set(final int index, final Integer element) {
|
||||
final Integer s = super.set(index, element);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
public LinkedList<ItemStack> itemsSmelted = new LinkedList<ItemStack>() {
|
||||
|
||||
private static final long serialVersionUID = 2774356235274526106L;
|
||||
|
||||
@Override
|
||||
public ItemStack set(final int index, final ItemStack key) {
|
||||
final ItemStack data = super.set(index, key);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(final ItemStack key) {
|
||||
final boolean data = super.add(key);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(final Object key) {
|
||||
final boolean i = super.remove(key);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
super.clear();
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final Collection<? extends ItemStack> m) {
|
||||
final boolean i = super.addAll(m);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return i;
|
||||
}
|
||||
};
|
||||
|
||||
public LinkedList<ItemStack> itemsEnchanted = new LinkedList<ItemStack>() {
|
||||
|
||||
private static final long serialVersionUID = 416869352279205852L;
|
||||
|
||||
@Override
|
||||
public ItemStack set(final int index, final ItemStack key) {
|
||||
final ItemStack data = super.set(index, key);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(final ItemStack key) {
|
||||
final boolean data = super.add(key);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(final Object key) {
|
||||
final boolean i = super.remove(key);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
super.clear();
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final Collection<? extends ItemStack> m) {
|
||||
final boolean i = super.addAll(m);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return i;
|
||||
}
|
||||
};
|
||||
|
||||
public LinkedList<ItemStack> itemsBrewed = new LinkedList<ItemStack>() {
|
||||
public LinkedList<Integer> itemsSmelted = new LinkedList<Integer>() {
|
||||
|
||||
private static final long serialVersionUID = 2774356235274526107L;
|
||||
|
||||
@Override
|
||||
public ItemStack set(final int index, final ItemStack key) {
|
||||
final ItemStack data = super.set(index, key);
|
||||
public boolean add(final Integer e) {
|
||||
final boolean b = super.add(e);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return data;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(final ItemStack key) {
|
||||
final boolean data = super.add(key);
|
||||
public void add(final int index, final Integer element) {
|
||||
super.add(index, element);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(final Object key) {
|
||||
final boolean i = super.remove(key);
|
||||
public boolean addAll(final Collection<? extends Integer> c) {
|
||||
final boolean b = super.addAll(c);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return i;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final int index, final Collection<? extends Integer> c) {
|
||||
final boolean b = super.addAll(index, c);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -437,40 +469,63 @@ public class BukkitQuestProgress implements QuestProgress {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final Collection<? extends ItemStack> m) {
|
||||
final boolean i = super.addAll(m);
|
||||
public boolean remove(final Object o) {
|
||||
final boolean b = super.remove(o);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return i;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer remove(final int index) {
|
||||
final Integer s = super.remove(index);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer set(final int index, final Integer element) {
|
||||
final Integer s = super.set(index, element);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
public LinkedList<ItemStack> itemsConsumed = new LinkedList<ItemStack>() {
|
||||
public LinkedList<Integer> itemsEnchanted = new LinkedList<Integer>() {
|
||||
|
||||
private static final long serialVersionUID = -5475073316902757883L;
|
||||
private static final long serialVersionUID = 416869352279205853L;
|
||||
|
||||
@Override
|
||||
public ItemStack set(final int index, final ItemStack key) {
|
||||
final ItemStack data = super.set(index, key);
|
||||
public boolean add(final Integer e) {
|
||||
final boolean b = super.add(e);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return data;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(final ItemStack key) {
|
||||
final boolean data = super.add(key);
|
||||
public void add(final int index, final Integer element) {
|
||||
super.add(index, element);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(final Object key) {
|
||||
final boolean i = super.remove(key);
|
||||
public boolean addAll(final Collection<? extends Integer> c) {
|
||||
final boolean b = super.addAll(c);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return i;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final int index, final Collection<? extends Integer> c) {
|
||||
final boolean b = super.addAll(index, c);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -481,40 +536,63 @@ public class BukkitQuestProgress implements QuestProgress {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final Collection<? extends ItemStack> m) {
|
||||
final boolean i = super.addAll(m);
|
||||
public boolean remove(final Object o) {
|
||||
final boolean b = super.remove(o);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return i;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer remove(final int index) {
|
||||
final Integer s = super.remove(index);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer set(final int index, final Integer element) {
|
||||
final Integer s = super.set(index, element);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
public LinkedList<ItemStack> itemsDelivered = new LinkedList<ItemStack>() {
|
||||
public LinkedList<Integer> itemsBrewed = new LinkedList<Integer>() {
|
||||
|
||||
private static final long serialVersionUID = 2712497347022734646L;
|
||||
private static final long serialVersionUID = 2774356235274526108L;
|
||||
|
||||
@Override
|
||||
public ItemStack set(final int index, final ItemStack key) {
|
||||
final ItemStack data = super.set(index, key);
|
||||
public boolean add(final Integer e) {
|
||||
final boolean b = super.add(e);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return data;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(final ItemStack key) {
|
||||
final boolean data = super.add(key);
|
||||
public void add(final int index, final Integer element) {
|
||||
super.add(index, element);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(final Object key) {
|
||||
final boolean i = super.remove(key);
|
||||
public boolean addAll(final Collection<? extends Integer> c) {
|
||||
final boolean b = super.addAll(c);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return i;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final int index, final Collection<? extends Integer> c) {
|
||||
final boolean b = super.addAll(index, c);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -525,11 +603,161 @@ public class BukkitQuestProgress implements QuestProgress {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final Collection<? extends ItemStack> m) {
|
||||
final boolean i = super.addAll(m);
|
||||
public boolean remove(final Object o) {
|
||||
final boolean b = super.remove(o);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return i;
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer remove(final int index) {
|
||||
final Integer s = super.remove(index);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer set(final int index, final Integer element) {
|
||||
final Integer s = super.set(index, element);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
public LinkedList<Integer> itemsConsumed = new LinkedList<Integer>() {
|
||||
|
||||
private static final long serialVersionUID = -5475073316902757884L;
|
||||
|
||||
@Override
|
||||
public boolean add(final Integer e) {
|
||||
final boolean b = super.add(e);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(final int index, final Integer element) {
|
||||
super.add(index, element);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final Collection<? extends Integer> c) {
|
||||
final boolean b = super.addAll(c);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final int index, final Collection<? extends Integer> c) {
|
||||
final boolean b = super.addAll(index, c);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
super.clear();
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(final Object o) {
|
||||
final boolean b = super.remove(o);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer remove(final int index) {
|
||||
final Integer s = super.remove(index);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer set(final int index, final Integer element) {
|
||||
final Integer s = super.set(index, element);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
public LinkedList<Integer> itemsDelivered = new LinkedList<Integer>() {
|
||||
|
||||
private static final long serialVersionUID = 2712497347022734647L;
|
||||
|
||||
@Override
|
||||
public boolean add(final Integer e) {
|
||||
final boolean b = super.add(e);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(final int index, final Integer element) {
|
||||
super.add(index, element);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final Collection<? extends Integer> c) {
|
||||
final boolean b = super.addAll(c);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final int index, final Collection<? extends Integer> c) {
|
||||
final boolean b = super.addAll(index, c);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
super.clear();
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(final Object o) {
|
||||
final boolean b = super.remove(o);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer remove(final int index) {
|
||||
final Integer s = super.remove(index);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer set(final int index, final Integer element) {
|
||||
final Integer s = super.set(index, element);
|
||||
if (doJournalUpdate)
|
||||
quester.updateJournal();
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
@ -1092,11 +1320,11 @@ public class BukkitQuestProgress implements QuestProgress {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkedList<ItemStack> getBlocksDamaged() {
|
||||
public LinkedList<Integer> getBlocksDamaged() {
|
||||
return blocksDamaged;
|
||||
}
|
||||
|
||||
public void setBlocksDamaged(final LinkedList<ItemStack> blocksDamaged) {
|
||||
public void setBlocksDamaged(final LinkedList<Integer> blocksDamaged) {
|
||||
this.blocksDamaged = blocksDamaged;
|
||||
if (doJournalUpdate) {
|
||||
quester.updateJournal();
|
||||
@ -1104,11 +1332,11 @@ public class BukkitQuestProgress implements QuestProgress {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkedList<ItemStack> getBlocksPlaced() {
|
||||
public LinkedList<Integer> getBlocksPlaced() {
|
||||
return blocksPlaced;
|
||||
}
|
||||
|
||||
public void setBlocksPlaced(final LinkedList<ItemStack> blocksPlaced) {
|
||||
public void setBlocksPlaced(final LinkedList<Integer> blocksPlaced) {
|
||||
this.blocksPlaced = blocksPlaced;
|
||||
if (doJournalUpdate) {
|
||||
quester.updateJournal();
|
||||
@ -1116,11 +1344,11 @@ public class BukkitQuestProgress implements QuestProgress {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkedList<ItemStack> getBlocksUsed() {
|
||||
public LinkedList<Integer> getBlocksUsed() {
|
||||
return blocksUsed;
|
||||
}
|
||||
|
||||
public void setBlocksUsed(final LinkedList<ItemStack> blocksUsed) {
|
||||
public void setBlocksUsed(final LinkedList<Integer> blocksUsed) {
|
||||
this.blocksUsed = blocksUsed;
|
||||
if (doJournalUpdate) {
|
||||
quester.updateJournal();
|
||||
@ -1128,11 +1356,11 @@ public class BukkitQuestProgress implements QuestProgress {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkedList<ItemStack> getBlocksCut() {
|
||||
public LinkedList<Integer> getBlocksCut() {
|
||||
return blocksCut;
|
||||
}
|
||||
|
||||
public void setBlocksCut(final LinkedList<ItemStack> blocksCut) {
|
||||
public void setBlocksCut(final LinkedList<Integer> blocksCut) {
|
||||
this.blocksCut = blocksCut;
|
||||
if (doJournalUpdate) {
|
||||
quester.updateJournal();
|
||||
@ -1140,11 +1368,11 @@ public class BukkitQuestProgress implements QuestProgress {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkedList<ItemStack> getItemsCrafted() {
|
||||
public LinkedList<Integer> getItemsCrafted() {
|
||||
return itemsCrafted;
|
||||
}
|
||||
|
||||
public void setItemsCrafted(final LinkedList<ItemStack> itemsCrafted) {
|
||||
public void setItemsCrafted(final LinkedList<Integer> itemsCrafted) {
|
||||
this.itemsCrafted = itemsCrafted;
|
||||
if (doJournalUpdate) {
|
||||
quester.updateJournal();
|
||||
@ -1152,11 +1380,11 @@ public class BukkitQuestProgress implements QuestProgress {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkedList<ItemStack> getItemsSmelted() {
|
||||
public LinkedList<Integer> getItemsSmelted() {
|
||||
return itemsSmelted;
|
||||
}
|
||||
|
||||
public void setItemsSmelted(final LinkedList<ItemStack> itemsSmelted) {
|
||||
public void setItemsSmelted(final LinkedList<Integer> itemsSmelted) {
|
||||
this.itemsSmelted = itemsSmelted;
|
||||
if (doJournalUpdate) {
|
||||
quester.updateJournal();
|
||||
@ -1164,11 +1392,11 @@ public class BukkitQuestProgress implements QuestProgress {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkedList<ItemStack> getItemsEnchanted() {
|
||||
public LinkedList<Integer> getItemsEnchanted() {
|
||||
return itemsEnchanted;
|
||||
}
|
||||
|
||||
public void setItemsEnchanted(final LinkedList<ItemStack> itemsEnchanted) {
|
||||
public void setItemsEnchanted(final LinkedList<Integer> itemsEnchanted) {
|
||||
this.itemsEnchanted = itemsEnchanted;
|
||||
if (doJournalUpdate) {
|
||||
quester.updateJournal();
|
||||
@ -1176,11 +1404,11 @@ public class BukkitQuestProgress implements QuestProgress {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkedList<ItemStack> getItemsBrewed() {
|
||||
public LinkedList<Integer> getItemsBrewed() {
|
||||
return itemsBrewed;
|
||||
}
|
||||
|
||||
public void setItemsBrewed(final LinkedList<ItemStack> itemsBrewed) {
|
||||
public void setItemsBrewed(final LinkedList<Integer> itemsBrewed) {
|
||||
this.itemsBrewed = itemsBrewed;
|
||||
if (doJournalUpdate) {
|
||||
quester.updateJournal();
|
||||
@ -1188,11 +1416,11 @@ public class BukkitQuestProgress implements QuestProgress {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkedList<ItemStack> getItemsConsumed() {
|
||||
public LinkedList<Integer> getItemsConsumed() {
|
||||
return itemsConsumed;
|
||||
}
|
||||
|
||||
public void setItemsConsumed(final LinkedList<ItemStack> itemsConsumed) {
|
||||
public void setItemsConsumed(final LinkedList<Integer> itemsConsumed) {
|
||||
this.itemsConsumed = itemsConsumed;
|
||||
if (doJournalUpdate) {
|
||||
quester.updateJournal();
|
||||
@ -1200,11 +1428,11 @@ public class BukkitQuestProgress implements QuestProgress {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkedList<ItemStack> getItemsDelivered() {
|
||||
public LinkedList<Integer> getItemsDelivered() {
|
||||
return itemsDelivered;
|
||||
}
|
||||
|
||||
public void setItemsDelivered(final LinkedList<ItemStack> itemsDelivered) {
|
||||
public void setItemsDelivered(final LinkedList<Integer> itemsDelivered) {
|
||||
this.itemsDelivered = itemsDelivered;
|
||||
if (doJournalUpdate) {
|
||||
quester.updateJournal();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -14,15 +14,14 @@ import me.pikamug.quests.BukkitQuestsPlugin;
|
||||
import me.pikamug.quests.player.BukkitQuestProgress;
|
||||
import me.pikamug.quests.player.BukkitQuester;
|
||||
import me.pikamug.quests.player.Quester;
|
||||
import me.pikamug.quests.quests.components.BukkitStage;
|
||||
import me.pikamug.quests.quests.Quest;
|
||||
import me.pikamug.quests.quests.components.BukkitStage;
|
||||
import me.pikamug.quests.storage.implementation.QuesterStorageImpl;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -60,7 +59,6 @@ public class BukkitQuesterYamlStorage implements QuesterStorageImpl {
|
||||
public void close() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public Quester loadQuester(final UUID uniqueId) throws IOException, InvalidConfigurationException {
|
||||
final FileConfiguration data = new YamlConfiguration();
|
||||
@ -182,134 +180,62 @@ public class BukkitQuesterYamlStorage implements QuesterStorageImpl {
|
||||
}
|
||||
if (questSec.contains("blocks-damaged-amounts")) {
|
||||
final List<Integer> damagedAmounts = questSec.getIntegerList("blocks-damaged-amounts");
|
||||
int index = 0;
|
||||
for (final int amt : damagedAmounts) {
|
||||
final ItemStack is = stage.getBlocksToDamage().get(index);
|
||||
final ItemStack temp = is.clone();
|
||||
temp.setAmount(amt);
|
||||
if (bukkitQuestData.getBlocksDamaged().size() > 0) {
|
||||
bukkitQuestData.blocksDamaged.set(index, temp);
|
||||
}
|
||||
index++;
|
||||
for (int i = 0; i < damagedAmounts.size(); i++) {
|
||||
bukkitQuestData.blocksDamaged.set(i, damagedAmounts.get(i));
|
||||
}
|
||||
}
|
||||
if (questSec.contains("blocks-placed-amounts")) {
|
||||
final List<Integer> placedAmounts = questSec.getIntegerList("blocks-placed-amounts");
|
||||
int index = 0;
|
||||
for (final int amt : placedAmounts) {
|
||||
final ItemStack is = stage.getBlocksToPlace().get(index);
|
||||
final ItemStack temp = is.clone();
|
||||
temp.setAmount(amt);
|
||||
if (bukkitQuestData.getBlocksPlaced().size() > 0) {
|
||||
bukkitQuestData.blocksPlaced.set(index, temp);
|
||||
}
|
||||
index++;
|
||||
for (int i = 0; i < placedAmounts.size(); i++) {
|
||||
bukkitQuestData.blocksPlaced.set(i, placedAmounts.get(i));
|
||||
}
|
||||
}
|
||||
if (questSec.contains("blocks-used-amounts")) {
|
||||
final List<Integer> usedAmounts = questSec.getIntegerList("blocks-used-amounts");
|
||||
int index = 0;
|
||||
for (final int amt : usedAmounts) {
|
||||
final ItemStack is = stage.getBlocksToUse().get(index);
|
||||
final ItemStack temp = is.clone();
|
||||
temp.setAmount(amt);
|
||||
if (bukkitQuestData.getBlocksUsed().size() > 0) {
|
||||
bukkitQuestData.blocksUsed.set(index, temp);
|
||||
}
|
||||
index++;
|
||||
for (int i = 0; i < usedAmounts.size(); i++) {
|
||||
bukkitQuestData.blocksUsed.set(i, usedAmounts.get(i));
|
||||
}
|
||||
}
|
||||
if (questSec.contains("blocks-cut-amounts")) {
|
||||
final List<Integer> cutAmounts = questSec.getIntegerList("blocks-cut-amounts");
|
||||
int index = 0;
|
||||
for (final int amt : cutAmounts) {
|
||||
final ItemStack is = stage.getBlocksToCut().get(index);
|
||||
final ItemStack temp = is.clone();
|
||||
temp.setAmount(amt);
|
||||
if (bukkitQuestData.getBlocksCut().size() > 0) {
|
||||
bukkitQuestData.blocksCut.set(index, temp);
|
||||
}
|
||||
index++;
|
||||
for (int i = 0; i < cutAmounts.size(); i++) {
|
||||
bukkitQuestData.blocksCut.set(i, cutAmounts.get(i));
|
||||
}
|
||||
}
|
||||
if (questSec.contains("item-craft-amounts")) {
|
||||
final List<Integer> craftAmounts = questSec.getIntegerList("item-craft-amounts");
|
||||
int index = 0;
|
||||
for (final int amt : craftAmounts) {
|
||||
final ItemStack is = stage.getItemsToCraft().get(index);
|
||||
final ItemStack temp = new ItemStack(is.clone());
|
||||
temp.setAmount(amt);
|
||||
if (bukkitQuestData.getItemsCrafted().size() > 0) {
|
||||
bukkitQuestData.itemsCrafted.set(index, temp);
|
||||
}
|
||||
index++;
|
||||
for (int i = 0; i < craftAmounts.size(); i++) {
|
||||
bukkitQuestData.itemsCrafted.set(i, craftAmounts.get(i));
|
||||
}
|
||||
}
|
||||
if (questSec.contains("item-smelt-amounts")) {
|
||||
final List<Integer> smeltAmounts = questSec.getIntegerList("item-smelt-amounts");
|
||||
int index = 0;
|
||||
for (final int amt : smeltAmounts) {
|
||||
final ItemStack is = stage.getItemsToSmelt().get(index);
|
||||
final ItemStack temp = new ItemStack(is.clone());
|
||||
temp.setAmount(amt);
|
||||
if (bukkitQuestData.getItemsSmelted().size() > 0) {
|
||||
bukkitQuestData.itemsSmelted.set(index, temp);
|
||||
}
|
||||
index++;
|
||||
for (int i = 0; i < smeltAmounts.size(); i++) {
|
||||
bukkitQuestData.itemsSmelted.set(i, smeltAmounts.get(i));
|
||||
}
|
||||
}
|
||||
if (questSec.contains("item-enchant-amounts")) {
|
||||
final List<Integer> enchantAmounts = questSec.getIntegerList("item-enchant-amounts");
|
||||
int index = 0;
|
||||
for (final int amt : enchantAmounts) {
|
||||
final ItemStack is = stage.getItemsToEnchant().get(index);
|
||||
final ItemStack temp = new ItemStack(is.clone());
|
||||
temp.setAmount(amt);
|
||||
if (bukkitQuestData.getItemsEnchanted().size() > 0) {
|
||||
bukkitQuestData.itemsEnchanted.set(index, temp);
|
||||
}
|
||||
index++;
|
||||
for (int i = 0; i < enchantAmounts.size(); i++) {
|
||||
bukkitQuestData.itemsEnchanted.set(i, enchantAmounts.get(i));
|
||||
}
|
||||
}
|
||||
if (questSec.contains("item-brew-amounts")) {
|
||||
final List<Integer> brewAmounts = questSec.getIntegerList("item-brew-amounts");
|
||||
int index = 0;
|
||||
for (final int amt : brewAmounts) {
|
||||
final ItemStack is = stage.getItemsToBrew().get(index);
|
||||
final ItemStack temp = new ItemStack(is.clone());
|
||||
temp.setAmount(amt);
|
||||
if (bukkitQuestData.getItemsBrewed().size() > 0) {
|
||||
bukkitQuestData.itemsBrewed.set(index, temp);
|
||||
}
|
||||
index++;
|
||||
for (int i = 0; i < brewAmounts.size(); i++) {
|
||||
bukkitQuestData.itemsBrewed.set(i, brewAmounts.get(i));
|
||||
}
|
||||
}
|
||||
if (questSec.contains("item-consume-amounts")) {
|
||||
final List<Integer> consumeAmounts = questSec.getIntegerList("item-consume-amounts");
|
||||
int index = 0;
|
||||
for (final int amt : consumeAmounts) {
|
||||
final ItemStack is = stage.getItemsToConsume().get(index);
|
||||
final ItemStack temp = new ItemStack(is.clone());
|
||||
temp.setAmount(amt);
|
||||
if (bukkitQuestData.getItemsConsumed().size() > 0) {
|
||||
bukkitQuestData.itemsConsumed.set(index, temp);
|
||||
}
|
||||
index++;
|
||||
for (int i = 0; i < consumeAmounts.size(); i++) {
|
||||
bukkitQuestData.itemsConsumed.set(i, consumeAmounts.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
if (questSec.contains("item-delivery-amounts")) {
|
||||
final List<Integer> deliveryAmounts = questSec.getIntegerList("item-delivery-amounts");
|
||||
int index = 0;
|
||||
for (final int amt : deliveryAmounts) {
|
||||
final ItemStack is = stage.getItemsToDeliver().get(index);
|
||||
final ItemStack temp = new ItemStack(is.getType(), amt, is.getDurability());
|
||||
temp.addUnsafeEnchantments(is.getEnchantments());
|
||||
temp.setItemMeta(is.getItemMeta());
|
||||
if (bukkitQuestData.getItemsDelivered().size() > 0) {
|
||||
bukkitQuestData.itemsDelivered.set(index, temp);
|
||||
}
|
||||
index++;
|
||||
for (int i = 0; i < deliveryAmounts.size(); i++) {
|
||||
bukkitQuestData.itemsDelivered.set(i, deliveryAmounts.get(i));
|
||||
}
|
||||
}
|
||||
if (questSec.contains("has-talked-to")) {
|
||||
@ -320,7 +246,7 @@ public class BukkitQuesterYamlStorage implements QuesterStorageImpl {
|
||||
final List<Integer> npcAmounts = questSec.getIntegerList("npc-killed-amounts");
|
||||
int index = 0;
|
||||
for (final int amt : npcAmounts) {
|
||||
if (bukkitQuestData.getNpcsNumKilled().size() > 0) {
|
||||
if (!bukkitQuestData.getNpcsNumKilled().isEmpty()) {
|
||||
bukkitQuestData.npcsNumKilled.set(index, amt);
|
||||
}
|
||||
index++;
|
||||
@ -330,7 +256,7 @@ public class BukkitQuesterYamlStorage implements QuesterStorageImpl {
|
||||
final List<Integer> npcAmounts = questSec.getIntegerList("citizen-amounts-killed");
|
||||
int index = 0;
|
||||
for (final int amt : npcAmounts) {
|
||||
if (bukkitQuestData.getNpcsNumKilled().size() > 0) {
|
||||
if (!bukkitQuestData.getNpcsNumKilled().isEmpty()) {
|
||||
bukkitQuestData.npcsNumKilled.set(index, amt);
|
||||
}
|
||||
index++;
|
||||
@ -349,7 +275,7 @@ public class BukkitQuesterYamlStorage implements QuesterStorageImpl {
|
||||
final List<Integer> mobAmounts = questSec.getIntegerList("mobs-killed-amounts");
|
||||
int index = 0;
|
||||
for (final int amt : mobAmounts) {
|
||||
if (quester.getQuestDataOrDefault(quest).getMobNumKilled().size() > 0) {
|
||||
if (!quester.getQuestDataOrDefault(quest).getMobNumKilled().isEmpty()) {
|
||||
bukkitQuestData.mobNumKilled.set(index, amt);
|
||||
}
|
||||
index++;
|
||||
|
@ -361,16 +361,16 @@ public class BukkitQuesterSqlStorage implements QuesterStorageImpl {
|
||||
ps.setString(1, uniqueId.toString());
|
||||
ps.setString(2, entry.getKey().getId());
|
||||
ps.setString(3, serializeProgress(entry.getValue().getBlocksBroken()));
|
||||
ps.setString(4, serializeItemStackProgress(entry.getValue().getBlocksDamaged()));
|
||||
ps.setString(5, serializeItemStackProgress(entry.getValue().getBlocksPlaced()));
|
||||
ps.setString(6, serializeItemStackProgress(entry.getValue().getBlocksUsed()));
|
||||
ps.setString(7, serializeItemStackProgress(entry.getValue().getBlocksCut()));
|
||||
ps.setString(8, serializeItemStackProgress(entry.getValue().getItemsCrafted()));
|
||||
ps.setString(9, serializeItemStackProgress(entry.getValue().getItemsSmelted()));
|
||||
ps.setString(10, serializeItemStackProgress(entry.getValue().getItemsEnchanted()));
|
||||
ps.setString(11, serializeItemStackProgress(entry.getValue().getItemsBrewed()));
|
||||
ps.setString(12, serializeItemStackProgress(entry.getValue().getItemsConsumed()));
|
||||
ps.setString(13, serializeItemStackProgress(entry.getValue().getItemsDelivered()));
|
||||
ps.setString(4, serializeProgress(entry.getValue().getBlocksDamaged()));
|
||||
ps.setString(5, serializeProgress(entry.getValue().getBlocksPlaced()));
|
||||
ps.setString(6, serializeProgress(entry.getValue().getBlocksUsed()));
|
||||
ps.setString(7, serializeProgress(entry.getValue().getBlocksCut()));
|
||||
ps.setString(8, serializeProgress(entry.getValue().getItemsCrafted()));
|
||||
ps.setString(9, serializeProgress(entry.getValue().getItemsSmelted()));
|
||||
ps.setString(10, serializeProgress(entry.getValue().getItemsEnchanted()));
|
||||
ps.setString(11, serializeProgress(entry.getValue().getItemsBrewed()));
|
||||
ps.setString(12, serializeProgress(entry.getValue().getItemsConsumed()));
|
||||
ps.setString(13, serializeProgress(entry.getValue().getItemsDelivered()));
|
||||
ps.setString(14, serializeProgress(entry.getValue().getNpcsInteracted()));
|
||||
ps.setString(15, serializeProgress(entry.getValue().getNpcsNumKilled()));
|
||||
ps.setString(16, serializeProgress(entry.getValue().getMobNumKilled()));
|
||||
@ -463,26 +463,16 @@ public class BukkitQuesterSqlStorage implements QuesterStorageImpl {
|
||||
if (quest != null && quester.getCurrentStage(quest) != null) {
|
||||
final BukkitStage stage = (BukkitStage) quester.getCurrentStage(quest);
|
||||
data.blocksBroken.addAll(deserializeIntProgress(rs.getString("blocks_broken")));
|
||||
data.blocksDamaged.addAll(deserializeItemStackProgress(rs.getString("blocks_damaged"),
|
||||
stage.getBlocksToDamage()));
|
||||
data.blocksPlaced.addAll(deserializeItemStackProgress(rs.getString("blocks_placed"),
|
||||
stage.getBlocksToPlace()));
|
||||
data.blocksUsed.addAll(deserializeItemStackProgress(rs.getString("blocks_used"),
|
||||
stage.getBlocksToUse()));
|
||||
data.blocksCut.addAll(deserializeItemStackProgress(rs.getString("blocks_cut"),
|
||||
stage.getBlocksToCut()));
|
||||
data.itemsCrafted.addAll(deserializeItemStackProgress(rs.getString("items_crafted"),
|
||||
stage.getItemsToCraft()));
|
||||
data.itemsSmelted.addAll(deserializeItemStackProgress(rs.getString("items_smelted"),
|
||||
stage.getItemsToSmelt()));
|
||||
data.itemsEnchanted.addAll(deserializeItemStackProgress(rs.getString("items_enchanted"),
|
||||
stage.getItemsToEnchant()));
|
||||
data.itemsBrewed.addAll(deserializeItemStackProgress(rs.getString("items_brewed"),
|
||||
stage.getItemsToBrew()));
|
||||
data.itemsConsumed.addAll(deserializeItemStackProgress(rs.getString("items_consumed"),
|
||||
stage.getItemsToConsume()));
|
||||
data.itemsDelivered.addAll(deserializeItemStackProgress(rs.getString("items_delivered"),
|
||||
stage.getItemsToDeliver()));
|
||||
data.blocksDamaged.addAll(deserializeIntProgress(rs.getString("blocks_damaged")));
|
||||
data.blocksPlaced.addAll(deserializeIntProgress(rs.getString("blocks_placed")));
|
||||
data.blocksUsed.addAll(deserializeIntProgress(rs.getString("blocks_used")));
|
||||
data.blocksCut.addAll(deserializeIntProgress(rs.getString("blocks_cut")));
|
||||
data.itemsCrafted.addAll(deserializeIntProgress(rs.getString("items_crafted")));
|
||||
data.itemsSmelted.addAll(deserializeIntProgress(rs.getString("items_smelted")));
|
||||
data.itemsEnchanted.addAll(deserializeIntProgress(rs.getString("items_enchanted")));
|
||||
data.itemsBrewed.addAll(deserializeIntProgress(rs.getString("items_brewed")));
|
||||
data.itemsConsumed.addAll(deserializeIntProgress(rs.getString("items_consumed")));
|
||||
data.itemsDelivered.addAll(deserializeIntProgress(rs.getString("items_delivered")));
|
||||
data.npcsInteracted.addAll(deserializeBooleanProgress(rs.getString("npcs_interacted")));
|
||||
data.npcsNumKilled.addAll(deserializeIntProgress(rs.getString("npcs_killed")));
|
||||
data.mobNumKilled.addAll(deserializeIntProgress(rs.getString("mobs_killed")));
|
||||
|
Loading…
Reference in New Issue
Block a user