@SuppressWarnings({ "deprecation", "static-access" })
	public void loadInventory() {
		try {
			Connection conn = MineAuction.db.getConnection();
			PreparedStatement ps = conn
					.prepareStatement("SELECT * FROM ma_items WHERE playerID=? ORDER BY qty ASC LIMIT 54");

			// Prepare statement
			int playerID = DatabaseUtils.getPlayerId(this.player.getUniqueId());
			ps.setInt(1, playerID);

			// Result
			ResultSet rs = ps.executeQuery();
			int i = 0;

			// Reset inventory
			this.inventory.clear();

			// Work with result
			while (rs.next()) {
				try {
					if (rs.getInt("qty") < 1)
						continue;

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

					// Modified/Special value for chest render
					Material mat = Material.getMaterial(itemID);
					int visualQty = qty > mat.getMaxStackSize() ? mat
							.getMaxStackSize() : qty;
					String visualLore = String
							.format("%s: %d", MineAuction.lang
									.getString("auction_item_quantity"), qty);

					// get ItemStack
					ItemStack is = null;

					if (itemData != null && itemData != "") {
						// Yaml metadata
						is = WebInventoryMeta.getItemStack(itemData);
					} else {
						// No yaml metadata
						is = new ItemStack(Material.getMaterial(itemID), qty,
								itemDamage);
					}

					// setup qty lore
					List<String> tempList = new ArrayList<String>();

					if (is.getItemMeta().clone().hasLore()) {
						tempList = is.getItemMeta().getLore();
						tempList.add(visualLore);
					} else {
						tempList.add(visualLore);
					}

					// Overwrite values
					is.setAmount(visualQty);
					is.addEnchantments(itemEnch);
					
					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);
						Bukkit.broadcastMessage("Dur:" +dur);
						
					}
					else
					{
						is.setDurability(itemDamage);
					}

					// Overwrite qty lore
					ItemMeta im = is.getItemMeta().clone();
					im.setLore(tempList);
					is.setItemMeta(im);

					// Send item to inventory
					this.inventory.setItem(i, is);
					i++;

				} catch (Exception e) {
					int itemID = rs.getInt("itemID");
					ItemStack is = new ItemStack(Material.getMaterial(itemID));
					this.player
							.sendMessage(MineAuction.plugin.prefix
									+ ChatColor.RED
									+ String.format(
											"Skipping item %s, because it has some errors.",
											is.getType().name()));
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}