public static final boolean has(Inventory inventory, ItemStack item) {
        ItemStack itemClone = clone(item);
        ItemStack[] items = inventory.getContents();
        for (ItemStack t : items) {
            if (t == null)
                continue;
            if (t.getTypeId() == itemClone.getTypeId()
                    && itemClone.getDurability() == -1) {
                itemClone.setDurability(t.getDurability());
                item.setDurability(t.getDurability());
            }
            if (t.getTypeId() == itemClone.getTypeId()
                    && t.getDurability() == itemClone.getDurability()
                    && t.getEnchantments().size() == 0) {
                if (t.getAmount() >= itemClone.getAmount())
                    return true;
                else
                    itemClone.setAmount(itemClone.getAmount() - t.getAmount());
            }
        }
        if (itemClone.getAmount() <= 0)
            return true;

        return false;
    }