Also to go along with what arch said make sure it removes the coins before the purchase
Normally you will find something like this in a shop class. You really need to look at the code and understand what is going on and why it does what it does. Shopping is very important and if done incorrectly can cause severe dupes.
Code:
PI
int ShopValue = (int)Math.floor(getItemShopValue(removeId, 0, removeSlot));
Ruse
player.getInventory().delete(currency.getId(), value, false);
Hyperion
player.getInventory().remove(new Item(currencyForShop, amount * amountPrItem));