SkullMeta skullmeta = (SkullMeta) meta;
if(((SkullMeta) meta).hasOwner()) {
smeta.append("O" + skullmeta.getOwner() + "#");
}
} else if(meta instanceof LeatherArmorMeta) {
Color color = ((LeatherArmorMeta) meta).getColor();
smeta.append("C" + String.valueOf(color.asRGB()) + "#");
} else if(meta instanceof PotionMeta) {
if(((PotionMeta) meta).hasCustomEffects()) {
List<PotionEffect> effects = ((PotionMeta) meta).getCustomEffects();
for(PotionEffect effect : effects) {
smeta.append("P" + effect.getType().getName() + "+" + effect.getAmplifier() + "+" + effect.getDuration() + "#");
}
}
}else if(meta instanceof EnchantmentStorageMeta) {
EnchantmentStorageMeta emeta = (EnchantmentStorageMeta) meta;
if(emeta.hasStoredEnchants()) {
Set<Entry<Enchantment,Integer>> enchants = emeta.getStoredEnchants().entrySet();
for(Entry<Enchantment,Integer> enchant : enchants) {
smeta.append("E" + enchant.getKey().getName() + "+" + enchant.getValue().toString() + "#");
}
}
}else if(meta instanceof FireworkMeta) {
List<FireworkEffect> effects = ((FireworkMeta) meta).getEffects();
((FireworkMeta) meta).getPower();
for(FireworkEffect effect : effects) {
List<Color> colors = effect.getColors();
List<Color> fadecolors = effect.getFadeColors();
StringBuilder colorstring = new StringBuilder();
for(Color color : colors) {
if(colorstring.length() > 0) {
colorstring.append("-");
}
colorstring.append(Integer.toString(color.asRGB()));
}
StringBuilder fadecolorstring = new StringBuilder();
for(Color color : fadecolors) {
if(fadecolorstring.length() > 0) {
fadecolorstring.append("-");
}
fadecolorstring.append(Integer.toString(color.asRGB()));
}
smeta.append("F" + effect.getType().name() + "+" + colorstring.toString() + "+" + fadecolorstring.toString() + "+" +
effect.hasFlicker() + "+" + effect.hasTrail() + "#");
}
smeta.append("G" + Integer.toString(((FireworkMeta) meta).getPower()) + "#");
}else if(meta instanceof FireworkEffectMeta) {
FireworkEffect effect = ((FireworkEffectMeta) meta).getEffect();
if(effect != null) {
List<Color> colors = effect.getColors();
List<Color> fadecolors = effect.getFadeColors();
StringBuilder colorstring = new StringBuilder();
for(Color color : colors) {
if(colorstring.length() > 0) {
colorstring.append("-");
}
colorstring.append(Integer.toString(color.asRGB()));
}
StringBuilder fadecolorstring = new StringBuilder();
for(Color color : fadecolors) {
if(fadecolorstring.length() > 0) {
fadecolorstring.append("-");
}
fadecolorstring.append(Integer.toString(color.asRGB()));
}
smeta.append("F" + effect.getType().name() + "+" + colorstring.toString() + "+" + fadecolorstring.toString() + "+" +
effect.hasFlicker() + "+" + effect.hasTrail() + "#");
}
}