This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void removeInventoryItems(PlayerInventory inv, Material type, int amount) { | |
for (ItemStack is : inv.getContents()) { | |
if (is != null && is.getType() == type) { | |
int newamount = is.getAmount() - amount; | |
if (newamount > 0) { | |
is.setAmount(newamount); | |
break; | |
} else { | |
inv.remove(is); | |
amount = -newamount; |