@SuppressWarnings("deprecation")
	@EventHandler
	public void handleItemPurchase(InventoryClickEvent event) {
		if (event.getClick() == ClickType.LEFT) {
			
			Player player = (Player) event.getWhoClicked();
			Inventory inventory = event.getInventory();
			Cuboid cuboid = Cuboid.getCuboid(player.getLocation());
			
			if (!Level.canUse(UserManager.getInstance().getUser(player.getName()), Level.USER))
				return;
			
			if (cuboid != null) {
				
				Shop shop = ShopHandler.getInstance().getShop(cuboid);
				
				if (shop == null)
					return;
				
				if (inventory.getName().equals(shop.getGui().getName())) {
					
					event.setCancelled(true);
					player.updateInventory();
					
					if (EdgeConomyAPI.economyAPI().getAccount(player.getName()) == null) {
						
						EconomyPlayer ep = EdgeConomyAPI.economyAPI().getEconomyPlayer(player.getName());
						EdgeItemStack item = new EdgeItemStack(event.getCurrentItem());
						
						shop.buyItem(ep, item);
						
					} else {
						
						BankAccount acc = EdgeConomyAPI.economyAPI().getAccount(player.getName());
						EdgeItemStack item = new EdgeItemStack(event.getCurrentItem());
						
						shop.buyItem(acc, item);
						
					}
				}
			}
		}
	}