Check for block index first, fixes #556

This commit is contained in:
BuildTools 2018-12-04 16:01:19 -05:00
parent 5bd07bf78f
commit 2338c127fb

View File

@ -860,12 +860,14 @@ public class Quester {
if (broken.getAmount() < toBreak.getAmount()) {
ItemStack newBroken = broken;
newBroken.setAmount(broken.getAmount() + 1);
if (getQuestData(quest).blocksBroken.contains(broken)) {
getQuestData(quest).blocksBroken.set(getQuestData(quest).blocksBroken.indexOf(broken), newBroken);
if (broken.getAmount() == toBreak.getAmount()) {
finishObjective(quest, "breakBlock", m, null, null, null, null, null, null, null, null, null);
}
}
}
}
public void damageBlock(Quest quest, ItemStack m) {
ItemStack temp = m;
@ -901,12 +903,14 @@ public class Quester {
if (damaged.getAmount() < toDamage.getAmount()) {
ItemStack newDamaged = damaged;
newDamaged.setAmount(damaged.getAmount() + 1);
if (getQuestData(quest).blocksDamaged.contains(damaged)) {
getQuestData(quest).blocksDamaged.set(getQuestData(quest).blocksDamaged.indexOf(damaged), newDamaged);
if (damaged.getAmount() == toDamage.getAmount()) {
finishObjective(quest, "damageBlock", m, null, null, null, null, null, null, null, null, null);
}
}
}
}
public void placeBlock(Quest quest, ItemStack m) {
ItemStack temp = m;
@ -942,12 +946,14 @@ public class Quester {
if (placed.getAmount() < toPlace.getAmount()) {
ItemStack newplaced = placed;
newplaced.setAmount(placed.getAmount() + 1);
if (getQuestData(quest).blocksPlaced.contains(placed)) {
getQuestData(quest).blocksPlaced.set(getQuestData(quest).blocksPlaced.indexOf(placed), newplaced);
if (placed.getAmount() == toPlace.getAmount()) {
finishObjective(quest, "placeBlock", m, null, null, null, null, null, null, null, null, null);
}
}
}
}
public void useBlock(Quest quest, ItemStack m) {
ItemStack temp = m;
@ -983,12 +989,14 @@ public class Quester {
if (used.getAmount() < toUse.getAmount()) {
ItemStack newUsed = used;
newUsed.setAmount(used.getAmount() + 1);
if (getQuestData(quest).blocksUsed.contains(used)) {
getQuestData(quest).blocksUsed.set(getQuestData(quest).blocksUsed.indexOf(used), newUsed);
if (used.getAmount() == toUse.getAmount()) {
finishObjective(quest, "useBlock", m, null, null, null, null, null, null, null, null, null);
}
}
}
}
public void cutBlock(Quest quest, ItemStack m) {
ItemStack temp = m;
@ -1024,12 +1032,14 @@ public class Quester {
if (cut.getAmount() < toCut.getAmount()) {
ItemStack newCut = cut;
newCut.setAmount(cut.getAmount() + 1);
if (getQuestData(quest).blocksCut.contains(cut)) {
getQuestData(quest).blocksCut.set(getQuestData(quest).blocksCut.indexOf(cut), newCut);
if (cut.getAmount() == toCut.getAmount()) {
finishObjective(quest, "cutBlock", m, null, null, null, null, null, null, null, null, null);
}
}
}
}
public void catchFish(Quest quest) {
if (getQuestData(quest).getFishCaught() < getCurrentStage(quest).fishToCatch) {