@SuppressWarnings("unchecked")
  @Override
  public String toInfo(Object value) {
    List<SerializeableItemStack> list = (List<SerializeableItemStack>) value;
    Iterator<SerializeableItemStack> iterator = list.iterator();

    StringBuilder builder = new StringBuilder();

    while (iterator.hasNext()) {
      SerializeableItemStack is = iterator.next();

      builder.append("id:" + is.getMaterial().name() + " ");
      builder.append("data:" + is.getData() + " ");
      builder.append("amount:" + is.getAmount() + " ");

      if (iterator.hasNext()) {
        builder.append(", ");
      }
    }

    return getName() + ": " + builder.toString();
  }
  @Override
  public void putElement(Player player, String input, List<SerializeableItemStack> existing) {
    String[] inputParts = splitStringSafely(input, " ");

    Material material;
    byte data = 0;
    int amount = 1;
    String displayName = null;
    List<String> lore = null;

    if (inputParts.length < 1) {
      return;
    }

    String[] itemData = inputParts[0].split(":");

    if (Util.isNumber(itemData[0])) {
      material = Material.getMaterial(Integer.parseInt(itemData[0]));
    } else {
      try {
        material = Material.valueOf(itemData[0].toUpperCase());
      } catch (Exception e) {
        player.sendMessage(getHelp());
        return;
      }
    }

    if (itemData.length > 1) {
      if (Util.isNumber(itemData[1])) {
        data = Byte.parseByte(itemData[1]);
      } else {
        player.sendMessage(getHelp());
        return;
      }
    }

    if (inputParts.length > 1) {
      if (Util.isNumber(inputParts[1])) {
        amount = Integer.parseInt(inputParts[1]);
      } else {
        player.sendMessage(getHelp());
        return;
      }
    }

    if (inputParts.length > 2) {
      // DisplayName
      displayName = ChatColor.translateAlternateColorCodes('&', inputParts[2]);
    }

    if (inputParts.length > 3) {
      // Lore
      String[] lines = inputParts[3].split("//");
      for (int i = 0; i < lines.length; i++) {
        lines[i] = ChatColor.translateAlternateColorCodes('&', lines[i]);
      }

      lore = Arrays.asList(lines);
    }

    SerializeableItemStack itemstack = new SerializeableItemStack(material, amount);
    itemstack.setData(data);
    itemstack.setDisplayName(displayName);
    itemstack.setLore(lore);

    existing.add(itemstack);
  }