Java Code Examples for org.bukkit.inventory.meta.ItemMeta#hasLore()

The following examples show how to use org.bukkit.inventory.meta.ItemMeta#hasLore() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BonusGoodie.java    From civcraft with GNU General Public License v2.0 6 votes vote down vote up
private boolean isItemStackOurs(ItemStack stack) {
	ItemMeta meta = stack.getItemMeta();
	if (meta == null) {
		return false;
	}
	
	if (meta.hasLore() && meta.getLore().size() >= LoreIndex.values().length) {
		if (meta.getLore().get(LoreIndex.TYPE.ordinal()).equals(BonusGoodie.LORE_TYPE)) {
			String outpostLoreLoc = meta.getLore().get(LoreIndex.OUTPOSTLOCATION.ordinal());
			Location loc = CivGlobal.getLocationFromHash(outpostLoreLoc);
			
			if (loc.getBlockX() == outpost.getCorner().getX() &&
					loc.getBlockY() == outpost.getCorner().getY() &&
					loc.getBlockZ() == outpost.getCorner().getZ()) {
				// Found ya!						
				return true;
			}
		}
	}
	return false;
}
 
Example 2
Source File: ItemFactory.java    From TradePlus with GNU General Public License v3.0 6 votes vote down vote up
public ItemFactory(ItemStack stack) {
  damage = stack.getDurability();
  material = stack.getType();
  amount = stack.getAmount();
  data = stack.getData().getData();
  if (stack.hasItemMeta()) {
    ItemMeta meta = stack.getItemMeta();
    if (meta.hasDisplayName()) {
      display = meta.getDisplayName();
    }
    if (meta.hasLore()) {
      lore = meta.getLore();
    }
    if (Sounds.version != 17) flags = new ArrayList<>(meta.getItemFlags());
  }
  if (Sounds.version > 113) {
    customModelData = ItemUtils1_14.getCustomModelData(stack);
  }
}
 
Example 3
Source File: FuelManager.java    From NyaaUtils with MIT License 6 votes vote down vote up
public void updateItem(ItemStack item, int fuelID, int durability) {
    FuelItem fuel = plugin.cfg.fuelConfig.fuel.get(fuelID);
    if (fuel == null) {
        return;
    }
    String hex = toHexString(fuelID) + toHexString(durability) + toHexString(new Random().nextInt(65535));
    String str = "";
    for (int i = 0; i < hex.length(); i++) {
        str += ChatColor.COLOR_CHAR + hex.substring(i, i + 1);
    }
    str += ChatColor.COLOR_CHAR + "r";
    ItemMeta meta = fuel.getItem().getItemMeta();
    List<String> lore;
    if (meta.hasLore()) {
        lore = meta.getLore();
        lore.set(0, lore_prefix + str + lore.get(0));
        lore.add(lore_prefix + I18n.format("user.elytra_enhance.fuel_durability", durability, fuel.getMaxDurability()));
    } else {
        lore = new ArrayList<>();
        lore.add(lore_prefix + str + I18n.format("user.elytra_enhance.fuel_durability", durability, fuel.getMaxDurability()));
    }
    item.setType(fuel.getItem().getType());
    item.setData(fuel.getItem().getData());
    meta.setLore(lore);
    item.setItemMeta(meta);
}
 
Example 4
Source File: UnitMaterial.java    From civcraft with GNU General Public License v2.0 6 votes vote down vote up
public static void setOwningTown(Town town, ItemStack stack) {
	if (town == null) {
		return;
	}
	
	ItemMeta meta = stack.getItemMeta();
	if (meta != null && meta.hasLore()) {
		List<String> lore = meta.getLore();
		
		lore = stripTownLore(lore);
		
		if (lore != null) {
			lore.add("Town:"+town.getName()+" "+CivColor.Black+town.getId());
		}
		
		meta.setLore(lore);
		stack.setItemMeta(meta);
	}	
}
 
Example 5
Source File: MetadatableItemStack.java    From HeavySpleef with GNU General Public License v3.0 6 votes vote down vote up
public void setMetadata(String key, String value) {
	ItemMeta meta = getItemMeta();
	List<String> lore;
	
	if (meta.hasLore()) {
		lore = meta.getLore();
	} else {
		lore = Lists.newArrayList();
	}
	
	String loreString = HIDDEN_PREFIX + key + (value != null ? KEY_VALUE_DELIMITER + value : "");
	loreString = hideString(loreString);
	lore.add(loreString);
	
	meta.setLore(lore);
	setItemMeta(meta);
}
 
Example 6
Source File: BackpackListener.java    From Slimefun4 with GNU General Public License v3.0 6 votes vote down vote up
/**
 * This method sets the id for a backpack onto the given {@link ItemStack}.
 * 
 * @param backpackOwner
 *            The owner of this backpack
 * @param item
 *            The {@link ItemStack} to modify
 * @param line
 *            The line at which the ID should be replaced
 * @param id
 *            The id of this backpack
 */
public void setBackpackId(OfflinePlayer backpackOwner, ItemStack item, int line, int id) {
    Validate.notNull(backpackOwner, "Backpacks must have an owner!");
    Validate.notNull(item, "Cannot set the id onto null!");

    ItemMeta im = item.getItemMeta();

    if (!im.hasLore()) {
        throw new IllegalArgumentException("This backpack does not have any lore!");
    }

    List<String> lore = im.getLore();

    if (line >= lore.size() || !lore.get(line).contains("<ID>")) {
        throw new IllegalArgumentException("Specified a line that is out of bounds or invalid!");
    }

    lore.set(line, lore.get(line).replace("<ID>", backpackOwner.getUniqueId() + "#" + id));
    im.setLore(lore);
    item.setItemMeta(im);
}
 
Example 7
Source File: ItemLine.java    From Holograms with MIT License 5 votes vote down vote up
static String itemstackToRaw(ItemStack itemstack) {
    StringBuilder sb = new StringBuilder();
    sb.append(itemstack.getType().toString()); // append type
    sb.append(':').append(itemstack.getDurability()); // append durability
    sb.append(' ').append(itemstack.getAmount()); // append amount

    if (itemstack.hasItemMeta()) {
        ItemMeta meta = itemstack.getItemMeta();

        // append name
        if (meta.hasDisplayName()) {
            sb.append(' ').append("name:").append(meta.getDisplayName().replace(' ', '_'));
        }

        // append lore
        if (meta.hasLore()) {
            sb.append(' ').append("lore:");
            Iterator<String> iterator = meta.getLore().iterator();
            while (iterator.hasNext()) {
                sb.append(iterator.next().replace(' ', '_'));
                if (iterator.hasNext()) {
                    sb.append('|');
                }
            }
        }

        // append enchantments
        meta.getEnchants().forEach((ench, level) -> {
            sb.append(' ').append(ench.getName()).append(':').append(level);
        });
    }

    return sb.toString();
}
 
Example 8
Source File: LoreStoreage.java    From civcraft with GNU General Public License v2.0 5 votes vote down vote up
public static void setMatID(int id, ItemStack stack) {
	ItemMeta meta = stack.getItemMeta();
	
	List<String> lore;
	if (meta.hasLore()) {
		lore = meta.getLore();
	} else {
		lore = new ArrayList<String>();
	}
	
	lore.set(0, CivColor.Black+"MID:"+id);
	meta.setLore(lore);
	stack.setItemMeta(meta);
}
 
Example 9
Source File: ItemsListener.java    From UhcCore with GNU General Public License v3.0 5 votes vote down vote up
private void handleTeamInviteReply(UhcPlayer uhcPlayer, ItemStack item, boolean accepted){
	if (!item.hasItemMeta()){
		uhcPlayer.sendMessage("Something went wrong!");
		return;
	}

	ItemMeta meta = item.getItemMeta();

	if (!meta.hasLore()){
		uhcPlayer.sendMessage("Something went wrong!");
		return;
	}

	if (meta.getLore().size() != 2){
		uhcPlayer.sendMessage("Something went wrong!");
		return;
	}

	String line = meta.getLore().get(1).replace(ChatColor.DARK_GRAY.toString(), "");
	UhcTeam team = GameManager.getGameManager().getTeamManager().getTeamByName(line);

	if (team == null){
		uhcPlayer.sendMessage(Lang.TEAM_MESSAGE_NO_LONGER_EXISTS);
		return;
	}

	GameManager.getGameManager().getTeamManager().replyToTeamInvite(uhcPlayer, team, accepted);
}
 
Example 10
Source File: ItemBuilder.java    From EnchantmentsEnhance with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Add a lore line.
 *
 * @param line The lore line to add.
 */
public ItemBuilder addLoreLine(String line) {
    ItemMeta im = is.getItemMeta();
    List<String> lore = new ArrayList<>();
    if (im.hasLore())
        lore = new ArrayList<>(im.getLore());
    lore.add(Util.toColor(line));
    im.setLore(lore);
    is.setItemMeta(im);
    return this;
}
 
Example 11
Source File: SlimefunUtils.java    From Slimefun4 with GNU General Public License v3.0 5 votes vote down vote up
/**
 * This method checks whether the given {@link ItemStack} is considered {@link Soulbound}.
 * 
 * @param item
 *            The {@link ItemStack} to check for
 * @return Whether the given item is soulbound
 */
public static boolean isSoulbound(ItemStack item) {
    if (item == null || item.getType() == Material.AIR) {
        return false;
    }
    else {
        ItemMeta meta = item.hasItemMeta() ? item.getItemMeta() : null;

        if (meta != null && SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
            PersistentDataContainer container = meta.getPersistentDataContainer();

            if (container.has(SOULBOUND_KEY, PersistentDataType.BYTE)) {
                return true;
            }
        }

        if (SlimefunPlugin.getThirdPartySupportService().isEmeraldEnchantsInstalled()) {
            // We wanna operate on a copy now
            item = item.clone();

            for (ItemEnchantment enchantment : EmeraldEnchants.getInstance().getRegistry().getEnchantments(item)) {
                EmeraldEnchants.getInstance().getRegistry().applyEnchantment(item, enchantment.getEnchantment(), 0);
            }
        }

        SlimefunItem sfItem = SlimefunItem.getByItem(item);

        if (sfItem instanceof Soulbound) {
            return !sfItem.isDisabled();
        }
        else if (meta != null) {
            return meta.hasLore() && meta.getLore().contains(SOULBOUND_LORE);
        }

        return false;
    }
}
 
Example 12
Source File: LoreStoreage.java    From civcraft with GNU General Public License v2.0 5 votes vote down vote up
public static Map<String, String> getLoreMap(ItemStack stack) {
	HashMap<String, String> map = new HashMap<String, String>();
	
	ItemMeta meta = stack.getItemMeta();
	if (meta.hasLore()) {
		List<String> lore = meta.getLore();
		for (String str : lore) {
			String[] split = str.split(":");
			if (split.length > 2) {
				map.put(split[0], split[1]);
			}
		}
	}
	return map;
}
 
Example 13
Source File: UnitMaterial.java    From civcraft with GNU General Public License v2.0 5 votes vote down vote up
public static Town getOwningTown(ItemStack stack) {
	ItemMeta meta = stack.getItemMeta();
	if (meta == null || !meta.hasLore()) {
		return null;
	}
	
	String loreLine = null;
	List<String> lore = meta.getLore();
	for (String str : lore) {
		if (str.startsWith("Town:")) {
			loreLine = str;
			break;
		}
	}
	
	if (loreLine == null) {
		return null;
	}
	
	try {
		String[] split = loreLine.split(CivColor.Black);
		int townId = Integer.valueOf(split[1]);
		
		return CivGlobal.getTownFromId(townId);
	} catch (Exception e) {
		e.printStackTrace();
		return null;
	}
	
}
 
Example 14
Source File: GUIInventoryRequiredItems.java    From NovaGuilds with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void generateContent() {
	for(ItemStack item : requiredItems) {
		int amountInventory = InventoryUtils.getTotalAmountOfItemStackInInventory(getViewer().getPlayer().getInventory(), item);
		int amountEnderChest = InventoryUtils.getTotalAmountOfItemStackInInventory(getViewer().getPlayer().getEnderChest(), item);
		int needMore = item.getAmount() - amountEnderChest - amountInventory;

		if(needMore < 0) {
			needMore = 0;
		}

		ItemMeta itemStackMeta = item.hasItemMeta()
				? item.getItemMeta()
				: Bukkit.getItemFactory().getItemMeta(item.getType());

		List<String> lore = new ArrayList<>();

		if(itemStackMeta.hasLore()) {
			lore.addAll(itemStackMeta.getLore());
		}

		lore.addAll(Message.INVENTORY_REQUIREDITEMS_LORE
				.clone()
				.setVar(VarKey.AMOUNT_AVAILABLE, amountInventory)
				.setVar(VarKey.AMOUNT_AVAILABLE2, amountEnderChest)
				.setVar(VarKey.AMOUNT_AVAILABLE3, amountInventory + amountEnderChest)
				.setVar(VarKey.AMOUNT, item.getAmount())
				.setVar(VarKey.NEEDMORE, needMore)
				.getList());

		itemStackMeta.setLore(lore);
		item.setItemMeta(itemStackMeta);

		registerAndAdd(new EmptyExecutor(item));
	}
}
 
Example 15
Source File: Tools.java    From ce with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static Inventory getItemMenu(Player p) {
    if (!p.isOp() && !p.hasPermission("ce.item.*")) {
        Inventory lInv = Main.CEItemMenu;
        Inventory items = Bukkit.createInventory(null, lInv.getSize(), lInv.getTitle());
        items.setContents(lInv.getContents());
        for (int i = 0; i < items.getSize() - 2; i++) {
            ItemStack item = items.getItem(i);
            if (item == null || item.getType().equals(Material.AIR))
                continue;
            ItemMeta im = item.getItemMeta();
            List<String> lore = new ArrayList<String>();
            if (im.hasLore())
                lore = im.getLore();
            for (CItem ci : Main.items)
                if (item.getItemMeta().getDisplayName().equals(ci.getDisplayName())) {
                    if (!checkPermission(ci, p)) {
                        lore.add(ChatColor.RED + "You are not permitted to use this");
                        break;
                    }
                }
            im.setLore(lore);
            item.setItemMeta(im);
        }
        return items;
    }

    return Main.CEItemMenu;
}
 
Example 16
Source File: JsonItem.java    From TrMenu with MIT License 5 votes vote down vote up
public static String toJson(ItemStack item) {
    JsonObject json = new JsonObject();
    String type = item.getType().name();
    byte data = item.getData().getData();
    int amount = item.getAmount();

    json.addProperty("type", item.getType().name());
    if (data > 0) {
        json.addProperty("data", data);
    }
    if (amount > 1) {
        json.addProperty("amount", amount);
    }
    if (item.hasItemMeta()) {
        // Uncolor
        ItemMeta meta = item.getItemMeta();
        if (meta.hasDisplayName()) {
            meta.setDisplayName(meta.getDisplayName().replace('§', '&'));
        }
        if (meta.hasLore()) {
            List<String> lore = meta.getLore();
            lore.replaceAll(s -> s.replace('§', '&'));
            meta.setLore(lore);
        }
        item.setItemMeta(meta);
        json.add("meta", new JsonParser().parse(NMS.handle().loadNBT(item).toJson()));
    }
    return json.toString();
}
 
Example 17
Source File: ItemManager.java    From EnchantmentsEnhance with GNU General Public License v3.0 4 votes vote down vote up
public static boolean applyEnchantmentToItem(ItemStack item, String ench, int level) {
    if (PackageManager.getDisabled().contains(ench)) {
        return false;
    }
    ItemMeta meta = item.getItemMeta();
    List<String> newlore = (meta.hasLore() ? meta.getLore() : new ArrayList<>());
    Enchantment vanilla = Enchantment.getByName(ench.toUpperCase());

    if (vanilla != null) {
        int lvl = (item.getEnchantmentLevel(vanilla)) + level;
        if (lvl > 0) {
            item.addUnsafeEnchantment(Enchantment.getByName(ench.toUpperCase()), lvl);
        } else {
            item.removeEnchantment(vanilla);
        }
        return true;
    } else {
        if (ench.equalsIgnoreCase("random")) {
            String name = PackageManager.getEnabled().get(new Random().nextInt(PackageManager.getEnabled().size())).name();
            return applyEnchantmentToItem(item, name, level);
        }
        String enchantment = SettingsManager.lang.getString("enchantments." + ench.toLowerCase());
        int keptLevel = 0;
        if (enchantment != null) {
            String currEnch = ChatColor.stripColor(Util.toColor(enchantment));
            for (int i = 0; i < newlore.size(); i++) {
                String[] curr = ChatColor.stripColor(newlore.get(i)).split(
                        " ");
                if (curr.length == 2 && curr[0].equals(currEnch)) {
                    // Adds original level.
                    keptLevel += Util.romanToInt(curr[1]);
                    newlore.remove(i);
                    i--;
                }
            }
            int max = 1;
            try {
                max = Main.getApi().getEnchantmentMaxLevel(ench);
            } catch (NullPointerException ex) {
            }
            int finalLevel = ((level + keptLevel) > max) ? max : level + keptLevel;
            if (finalLevel > 0) {
                newlore.add(Util.UNIQUEID + Util.toColor("&7" + enchantment + " " + Util.intToRoman(finalLevel)));
                meta.setLore(newlore);
                item.setItemMeta(meta);
                if (item.getEnchantments().isEmpty()) {
                    CompatibilityManager.glow
                            .addGlow(item);
                }
                return true;
            } else {
                meta.setLore(newlore);
                item.setItemMeta(meta);
                if (item.getEnchantments().isEmpty()) {
                    CompatibilityManager.glow
                            .addGlow(item);
                }
            }
        }
        return false;
    }
}
 
Example 18
Source File: ItemData.java    From Skript with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Compares {@link ItemMeta}s for {@link #matchAlias(ItemData)}.
 * Note that this does NOT compare everything; only the most
 * important bits.
 * @param first Meta of this item.
 * @param second Meta of given item.
 * @return Match quality of metas.
 * Lowest is {@link MatchQuality#SAME_MATERIAL}.
 */
private static MatchQuality compareItemMetas(ItemMeta first, ItemMeta second) {
	MatchQuality quality = MatchQuality.EXACT; // Lowered as we go on
	
	// Display name
	String ourName = first.hasDisplayName() ? first.getDisplayName() : null;
	String theirName = second.hasDisplayName() ? second.getDisplayName() : null;
	if (!Objects.equals(ourName, theirName)) {
		quality = ourName != null ? MatchQuality.SAME_MATERIAL : quality;
	}
	
	// Lore
	List<String> ourLore = first.hasLore() ? first.getLore() : null;
	List<String> theirLore = second.hasLore() ? second.getLore() : null;
	if (!Objects.equals(ourLore, theirLore)) {
		quality = ourLore != null ? MatchQuality.SAME_MATERIAL : quality;
	}
	
	// Enchantments
	Map<Enchantment, Integer> ourEnchants = first.getEnchants();
	Map<Enchantment, Integer> theirEnchants = second.getEnchants();
	if (!Objects.equals(ourEnchants, theirEnchants)) {
		quality = !ourEnchants.isEmpty() ? MatchQuality.SAME_MATERIAL : quality;
	}
	
	// Item flags
	Set<ItemFlag> ourFlags = first.getItemFlags();
	Set<ItemFlag> theirFlags = second.getItemFlags();
	if (!Objects.equals(ourFlags, theirFlags)) {
		quality = !ourFlags.isEmpty() ? MatchQuality.SAME_MATERIAL : quality;
	}
	
	// Potion data
	if (second instanceof PotionMeta) {
		if (!(first instanceof PotionMeta)) {
			return MatchQuality.DIFFERENT; // Second is a potion, first is clearly not
		}
		// Compare potion type, including extended and level 2 attributes
		PotionData ourPotion = ((PotionMeta) first).getBasePotionData();
		PotionData theirPotion = ((PotionMeta) second).getBasePotionData();
		return !Objects.equals(ourPotion, theirPotion) ? MatchQuality.SAME_MATERIAL : quality;
	}
	
	return quality;
}
 
Example 19
Source File: ItemLine.java    From Holograms with MIT License 4 votes vote down vote up
private static ItemStack parseItem(String text) {
    Matcher matcher = linePattern.matcher(text);
    if (matcher.find()) {
        text = matcher.group(3);
    }
    String[] split = text.split(" ");
    short durability = -1;
    String data = split[0];

    if (data.contains(":")) {
        String[] datasplit = data.split(":");
        data = datasplit[0];
        durability = Short.parseShort(datasplit[1]);
    }

    Material material = data.matches("[0-9]+")
            ? Material.getMaterial(Integer.parseInt(data))
            : Material.getMaterial(data.toUpperCase());

    // Throw exception if the material provided was wrong
    if (material == null) {
        throw new IllegalArgumentException("Invalid material " + data);
    }

    int amount;
    try {
        amount = split.length == 1 ? 1 : Integer.parseInt(split[1]);
    } catch (NumberFormatException ex) {
        throw new IllegalArgumentException("Invalid amount \"" + split[1] + "\"", ex);
    }
    ItemStack item = new ItemStack(material, amount, (short) Math.max(0, durability));
    ItemMeta meta = item.getItemMeta();

    // No meta data was provided, we can return here
    if (split.length < 3) {
        return item;
    }

    // Go through all the item meta specified
    for (int i = 2 ; i < split.length ; i++) {
        String[] information = split[i].split(":");

        // Data, name, or lore has been specified
        switch (information[0].toLowerCase()) {
            case "name":
                // Replace '_' with spaces
                String name = information[1].replace(' ', ' ');
                meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
                break;
            case "lore":
                // If lore was specified 2x for some reason, don't overwrite
                List<String> lore = meta.hasLore() ? meta.getLore() : new ArrayList<>();
                String[] loreLines = information[1].split("\\|");

                // Format all the lines and add them as lore
                for (String line : loreLines) {
                    line = line.replace('_', ' '); // Replace '_' with space
                    lore.add(ChatColor.translateAlternateColorCodes('&', line));
                }

                meta.setLore(lore);
                break;
            case "data":
                short dataValue = Short.parseShort(information[1]);
                item.setDurability(dataValue);
            default:
                // Try parsing enchantment if it was nothing else
                Enchantment ench = Enchantment.getByName(information[0].toUpperCase());
                int level = Integer.parseInt(information[1]);

                if (ench != null) {
                    meta.addEnchant(ench, level, true);
                } else {
                    throw new IllegalArgumentException("Invalid enchantment " + information[0]);
                }
                break;
        }
    }

    item.setItemMeta(meta);
    return item;
}
 
Example 20
Source File: InventorySerializer.java    From civcraft with GNU General Public License v2.0 4 votes vote down vote up
private static String getSerializedItemStack(ItemStack is) {
       String serializedItemStack = new String();
       
       String isType = String.valueOf(ItemManager.getId(is.getType()));
       serializedItemStack += "t@" + isType;
      
       if (is.getDurability() != 0)
       {
           String isDurability = String.valueOf(is.getDurability());
           serializedItemStack += "&d@" + isDurability;
       }
      
       if (is.getAmount() != 1)
       {
           String isAmount = String.valueOf(is.getAmount());
           serializedItemStack += "&a@" + isAmount;
       }
      
       Map<Enchantment,Integer> isEnch = is.getEnchantments();
       if (isEnch.size() > 0)
       {
           for (Entry<Enchantment,Integer> ench : isEnch.entrySet())
           {
               serializedItemStack += "&e@" + ItemManager.getId(ench.getKey()) + "@" + ench.getValue();
           }
       }
      
       ItemMeta meta = is.getItemMeta();
       if (meta != null && meta.hasLore()) {
       	for (String lore : meta.getLore()) {
       		char[] encode = Base64Coder.encode(lore.getBytes());
       		String encodedString = new String(encode);
       		serializedItemStack += "&l@" + encodedString;
       	}
       }
       
       if (meta != null) {
       	if (meta.getDisplayName() != null) {
       		serializedItemStack += "&D@" + meta.getDisplayName();
       	}
       }
       
       LoreCraftableMaterial craftMat = LoreCraftableMaterial.getCraftMaterial(is);
       if (craftMat != null) {
       	serializedItemStack += "&C@" + craftMat.getConfigId();
       	
       	if (LoreCraftableMaterial.hasEnhancements(is)) {
   			serializedItemStack += "&Enh@" + LoreCraftableMaterial.serializeEnhancements(is);
       	}
       }
       
       AttributeUtil attrs = new AttributeUtil(is);
       if (attrs.hasColor()) {
       	serializedItemStack += "&LC@" + attrs.getColor();
       }
       
       return serializedItemStack;
}