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