String[] itemsStrSplit = invString.split(";;");
for (String itemStr : itemsStrSplit) {
String[] itemStrSplit = itemStr.split(";");
if (itemStrSplit.length == 5) {
ItemStack stack = new ItemStack(Integer.parseInt(itemStrSplit[0]), Integer.parseInt(itemStrSplit[1]));
stack.setData(new MaterialData(stack.getTypeId(), Byte.parseByte(itemStrSplit[3])));
short durability = (short) Integer.parseInt(itemStrSplit[2]);
stack.setDurability(durability);
// enchantments
String[] enchantmentsSplit = itemStrSplit[4].split("::");
for (String enchantmentStr : enchantmentsSplit) {
if (!enchantmentStr.equals("")) {
String[] enchantmentSplit = enchantmentStr.split(":");
int enchantId = Integer.parseInt(enchantmentSplit[0]);
int level = Integer.parseInt(enchantmentSplit[1]);
War.war.safelyEnchant(stack, Enchantment.getById(enchantId), level);
}
}
items.add(stack);
} else if (itemStrSplit.length == 4) {
ItemStack stack = new ItemStack(Integer.parseInt(itemStrSplit[0]), Integer.parseInt(itemStrSplit[1]));
stack.setData(new MaterialData(stack.getTypeId(), Byte.parseByte(itemStrSplit[3])));
short durability = (short) Integer.parseInt(itemStrSplit[2]);
stack.setDurability(durability);
items.add(stack);
} else if (itemStrSplit.length == 3) {
ItemStack stack = new ItemStack(Integer.parseInt(itemStrSplit[0]), Integer.parseInt(itemStrSplit[1]));