There are going to be 3 different checks which I would recommend adding;


Spoiler for 1. Check for free slots:
Code:
		if ((player.getInventory().getFreeSlots() < floorItem.getAmount()) && !floorItem.isStackable()) {
			player.getPackets().sendGameMessage("You do not have enough space in your inventory to pick up "+ (floorItem.getAmount() == 1 ? "this item": "these items")+ ".");
			return false;
		}

What this checks for is the players free slots. Usually you could have it as getFreeSlotys() == 0, and that would do the job however, if you have a problem like me in the server I am working with, that the item drop is stacked on eachother, this will solve it, because previously if you has 1 free space and didn't know that drop has 2 amounts of it, it would send you a message saying you dont have enough space and the items wouldnt get added into your inventory. Temporary fix. However this is good to have for other times, and having this instead of the other is the exact same. Also makes sure that the item isn't stackable because then you wouldn't be able to pick it up if it was and was at amount of over 28.

Spoiler for 2. Coins entering pouch priority.:
Code:
			if (floorItem.getId() == 995) {
				if (MoneyPouch.contains(player, Integer.MAX_VALUE) && player.getInventory().containsItem(995, Integer.MAX_VALUE)) {
					player.getPackets().sendGameMessage("You cannot pick up anymore coins.");
					return false;
				}
				if (MoneyPouch.contains(player, Integer.MAX_VALUE)) {
					player.getInventory().addItem(floorItem.getId(), floorItem.getAmount());
				} 
				else {
					MoneyPouch.addMoney(floorItem.getAmount(), player, false);
				}
			}


This is basically the same as my other post which i made earlier; [Only registered and activated users can see links. ] Explaination can be found in there.

Spoiler for 3. Check for items stackable items:
Code:
			int am = player.getInventory().getAmountOf(floorItem.getId());
			if (floorItem.isStackable() && (player.getInventory().containsItem(floorItem.getId(), am) && floorItem.getAmount() >= Integer.MAX_VALUE)) {
				player.getPackets().sendGameMessage("You are unable to pick up the "+floorItem.getName()+"s, as you will have more than the max value if you do.");
				return false;
			}

What this checks for it to see if the item that you are about to pickup is stackable, if you have that item in your inventory. It checks to see if you are able to pick them up without the total amount combined surpsassing max stack amount, 2147m.