Avoid exception from misconfigured SQL table

This commit is contained in:
PikaMug 2022-01-07 06:21:38 -05:00
parent ba1aa443e3
commit 613ba96e34
1 changed files with 11 additions and 7 deletions

View File

@ -629,13 +629,17 @@ public class SqlStorage implements StorageImplementation {
string = string.replace("{", "").replace("}", "");
int index = 0;
for (final String section : string.split(",")) {
final int amt = Integer.parseInt(section);
final ItemStack is = objective.get(index);
final ItemStack temp = new ItemStack(is.getType(), amt, is.getDurability());
temp.addUnsafeEnchantments(is.getEnchantments());
temp.setItemMeta(is.getItemMeta());
list.add(temp);
index++;
if (index < objective.size()) {
final int amt = Integer.parseInt(section);
final ItemStack is = objective.get(index);
final ItemStack temp = new ItemStack(is.getType(), amt, is.getDurability());
temp.addUnsafeEnchantments(is.getEnchantments());
temp.setItemMeta(is.getItemMeta());
list.add(temp);
index++;
} else {
break;
}
}
}
return list;