Correctly serialize and deserialize ItemMeta (Previously not working) #414
This commit is contained in:
@@ -18,6 +18,7 @@ import org.bukkit.craftbukkit.libs.org.apache.commons.io.IOUtils;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@@ -1158,4 +1159,18 @@ public class ReflectionManager {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ItemMeta getDeserializedItemMeta(Map<String, Object> meta) {
|
||||
try {
|
||||
Method method = getCraftMethod(getCraftClass("inventory.CraftMetaItem$SerializableMeta"), "deserialize",
|
||||
Map.class);
|
||||
|
||||
return (ItemMeta) method.invoke(null, meta);
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user