@SuppressWarnings({ "deprecation", "unused" })
	public boolean itemWithdraw(final InventoryClickEvent event)
			throws Exception {
		// Unsupported action
		if (!this.canWithdraw) {
			this.player.sendMessage(MineAuction.prefix + ChatColor.RED
					+ MineAuction.lang.getString("action_invalid_withdraw"));
			return false;
		}

		ItemStack is = event.getCurrentItem().clone();

		// Item withdraw
		Player pl = Bukkit.getPlayer(event.getWhoClicked().getName());
		int qty = event.getClick().isShiftClick() ? 1 : is.getAmount();

		// Get item stack
		try {
			ResultSet rs = DatabaseUtils.getItemFromDatabase(is);

			while (rs.next()) {
				// Get item Data
				int itemID = rs.getInt("itemID");
				short itemDamage = rs.getShort("itemDamage");
				int qnty = rs.getInt("qty");
				String itemData = rs.getString("itemMeta");
				Map<Enchantment, Integer> itemEnch = WebInventoryMeta
						.getItemEnchantmentMap(rs.getString("enchantments"));

				ItemStack stack = null;

				if (itemData != null && itemData != "") {
					// Yaml metadata
					is = WebInventoryMeta.getItemStack(itemData);
				} else {
					// No yaml metadata
					is = new ItemStack(Material.getMaterial(itemID), qnty,
							itemDamage);
				}
				
				// Overwrite values
				if(ItemUtils.canHaveDamage(is.getTypeId()))
				{
					InputStream stream = new ByteArrayInputStream(itemData.getBytes(StandardCharsets.UTF_8));
					YamlConfiguration yac = YamlConfiguration.loadConfiguration(stream);
					short dur = (short) yac.getInt("damage");
					is.setDurability(dur);
					
				}
				else
				{
					
				is.setDurability(itemDamage);				
				}
				
				is.addEnchantments(itemEnch);
				

				// Update database
				boolean success = DatabaseUtils.updateItemInDatabase(pl, is,
						qty);

				// Update player inventory
				if (!success) {
					pl.sendMessage(MineAuction.prefix + ChatColor.RED
							+ MineAuction.lang.getString("no_item_update"));
					return false;
				}
				WCInventory wci = new WCInventory(pl);
				wci.addItems(is, qty);

				if (MineAuction.config.getBool("plugin.performance.refresh"))
					this.refreshInventory();

				return true;
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;

	}