Precautionary List size checks, fixes #733

This commit is contained in:
BuildTools 2019-03-14 14:12:28 -04:00
parent 81fd0425a3
commit 70a6ddfaa1

View File

@ -2404,9 +2404,11 @@ public class Quester {
// Legacy
is = new ItemStack(Material.matchMaterial(s), amounts.get(names.indexOf(s)), (short) 0);
}
if (getQuestData(quest).blocksBroken.size() > 0) {
getQuestData(quest).blocksBroken.set(names.indexOf(s), is);
}
}
}
if (questSec.contains("blocks-damaged-names")) {
List<String> names = questSec.getStringList("blocks-damaged-names");
List<Integer> amounts = questSec.getIntegerList("blocks-damaged-amounts");
@ -2419,9 +2421,11 @@ public class Quester {
// Legacy
is = new ItemStack(Material.matchMaterial(s), amounts.get(names.indexOf(s)), (short) 0);
}
if (getQuestData(quest).blocksDamaged.size() > 0) {
getQuestData(quest).blocksDamaged.set(names.indexOf(s), is);
}
}
}
if (questSec.contains("blocks-placed-names")) {
List<String> names = questSec.getStringList("blocks-placed-names");
List<Integer> amounts = questSec.getIntegerList("blocks-placed-amounts");
@ -2434,9 +2438,11 @@ public class Quester {
// Legacy
is = new ItemStack(Material.matchMaterial(s), amounts.get(names.indexOf(s)), (short) 0);
}
if (getQuestData(quest).blocksPlaced.size() > 0) {
getQuestData(quest).blocksPlaced.set(names.indexOf(s), is);
}
}
}
if (questSec.contains("blocks-used-names")) {
List<String> names = questSec.getStringList("blocks-used-names");
List<Integer> amounts = questSec.getIntegerList("blocks-used-amounts");
@ -2449,9 +2455,11 @@ public class Quester {
// Legacy
is = new ItemStack(Material.matchMaterial(s), amounts.get(names.indexOf(s)), (short) 0);
}
if (getQuestData(quest).blocksUsed.size() > 0) {
getQuestData(quest).blocksUsed.set(names.indexOf(s), is);
}
}
}
if (questSec.contains("blocks-cut-names")) {
List<String> names = questSec.getStringList("blocks-cut-names");
List<Integer> amounts = questSec.getIntegerList("blocks-cut-amounts");
@ -2464,9 +2472,11 @@ public class Quester {
// Legacy
is = new ItemStack(Material.matchMaterial(s), amounts.get(names.indexOf(s)), (short) 0);
}
if (getQuestData(quest).blocksCut.size() > 0) {
getQuestData(quest).blocksCut.set(names.indexOf(s), is);
}
}
}
if (questSec.contains("item-craft-amounts")) {
List<Integer> craftAmounts = questSec.getIntegerList("item-craft-amounts");
for (int i = 0; i < craftAmounts.size(); i++) {