Search in sources :

Example 1 with Utility

use of org.bukkit.Utility in project Bukkit by Bukkit.

the class ItemStack method serialize.

@Utility
public Map<String, Object> serialize() {
    Map<String, Object> result = new LinkedHashMap<String, Object>();
    result.put("type", getType().name());
    if (getDurability() != 0) {
        result.put("damage", getDurability());
    }
    if (getAmount() != 1) {
        result.put("amount", getAmount());
    }
    ItemMeta meta = getItemMeta();
    if (!Bukkit.getItemFactory().equals(meta, null)) {
        result.put("meta", meta);
    }
    return result;
}
Also used : ItemMeta(org.bukkit.inventory.meta.ItemMeta) LinkedHashMap(java.util.LinkedHashMap) Utility(org.bukkit.Utility)

Aggregations

LinkedHashMap (java.util.LinkedHashMap)1 Utility (org.bukkit.Utility)1 ItemMeta (org.bukkit.inventory.meta.ItemMeta)1