if(data != null) {
int color = Integer.parseInt(data);
((LeatherArmorMeta) ismeta).setColor(Color.fromRGB(color));
}
} else if(ismeta instanceof PotionMeta) {
PotionMeta pmeta = (PotionMeta) ismeta;
for(int i = 0; (data = itemdata.get("P" + String.valueOf(i))) != null; i++) {
String[] potion = data.split("\\+");
PotionEffectType type = PotionEffectType.getByName(potion[0]);
int amplifier = Integer.parseInt(potion[1]);
int duration = Integer.parseInt(potion[2]);
PotionEffect pe = new PotionEffect(type, duration, amplifier);
pmeta.addCustomEffect(pe, true);
}
}else if(ismeta instanceof EnchantmentStorageMeta) {
EnchantmentStorageMeta emeta = (EnchantmentStorageMeta) ismeta;
for(int i = 0; (data = itemdata.get("E" + String.valueOf(i))) != null; i++) {
String[] enchant = data.split("\\+");
Enchantment enchantenum = Enchantment.getByName(enchant[0]);
if(enchantenum != null) {
int value = Integer.parseInt(enchant[1]);
emeta.addStoredEnchant(enchantenum, value, true);
}
}
}else if(ismeta instanceof FireworkMeta) {
FireworkMeta fmmeta = (FireworkMeta) ismeta;
for(int i = 0; (data = itemdata.get("F" + String.valueOf(i))) != null; i++) {
String[] fedata = data.split("\\+");
Type effect = FireworkEffect.Type.valueOf(fedata[0]);
Builder ef = FireworkEffect.builder();
ef.with(effect);
if(effect != null) {
String[] colors = fedata[1].split("-");
for(String color : colors) {
try {
ef.withColor(Color.fromRGB(Integer.parseInt(color)));
}catch (Exception e) {
}
}
String[] fadecolors = fedata[2].split("-");
for(String fadecolor : fadecolors) {
try {
ef.withFade(Color.fromRGB(Integer.parseInt(fadecolor)));
}catch (Exception e) {
}
}
ef.flicker(Boolean.parseBoolean(fedata[3]));
ef.trail(Boolean.parseBoolean(fedata[4]));
fmmeta.addEffect(ef.build());
}
}
data = itemdata.get("G");
try {
fmmeta.setPower(Integer.parseInt(data));
}catch (Exception e) {
}
}else if(ismeta instanceof FireworkEffectMeta) {
data = itemdata.get("F0");
if(data != null) {
String[] fedata = data.split("\\+");
Type effect = FireworkEffect.Type.valueOf(fedata[0]);
Builder ef = FireworkEffect.builder();
ef.with(effect);
if(effect != null) {
String[] colors = fedata[1].split("-");
for(String color : colors) {
try {
ef.withColor(Color.fromRGB(Integer.parseInt(color)));
}catch (Exception e) {
}
}
String[] fadecolors = fedata[2].split("-");
for(String fadecolor : fadecolors) {
try {
ef.withFade(Color.fromRGB(Integer.parseInt(fadecolor)));
}catch (Exception e) {
}
}
ef.flicker(Boolean.parseBoolean(fedata[3]));
ef.trail(Boolean.parseBoolean(fedata[4]));
((FireworkEffectMeta) ismeta).setEffect(ef.build());
}
}
}
if(ismeta instanceof Repairable) {
data = itemdata.get("R");
if(data != null) {
Repairable rmeta = (Repairable) ismeta;
rmeta.setRepairCost(Integer.parseInt(data));
}
}
}else {
//Old item meta here
int repairableindex = 2;
if(msplit.length > 1) {
if(!msplit[0].equals("")) {
ismeta.setDisplayName(base64Decode(msplit[0]));
}
if(!msplit[1].equals("")) {
ismeta.setLore(decodeLore(msplit[1]));
}
if(ismeta instanceof SkullMeta) {
if(!msplit[2].isEmpty()) {
((SkullMeta) ismeta).setOwner(msplit[2]);
}
repairableindex = 3;
} else if(ismeta instanceof LeatherArmorMeta) {
if(!msplit[2].equals("")) {
int color = Integer.parseInt(msplit[2]);
((LeatherArmorMeta) ismeta).setColor(Color.fromRGB(color));
}
repairableindex = 3;
} else if(ismeta instanceof PotionMeta) {
if(msplit.length > repairableindex) {
boolean ispotion = true;
if(msplit[repairableindex].contains("+")) {
PotionMeta pmeta = (PotionMeta) ismeta;
for(; repairableindex < msplit.length && ispotion; repairableindex++) {
if(msplit[repairableindex].contains("+")) {
String[] potion = msplit[repairableindex].split("\\+");
PotionEffectType type = PotionEffectType.getByName(potion[0]);
int amplifier = Integer.parseInt(potion[1]);
int duration = Integer.parseInt(potion[2]);
PotionEffect pe = new PotionEffect(type, duration, amplifier);
pmeta.addCustomEffect(pe, true);
} else {
ispotion = false;
repairableindex--;
}
}