Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void removeItems(Player player, Material material, int _price){
- int price = _price;
- for(ItemStack is : player.getInventory().getContents()){
- if(is.getType() != material){
- continue;
- }
- if(is.getAmount() - price >= 0){
- player.getInventory().remove(is);
- price -= is.getAmount();
- }else{
- price -= is.getAmount() - price;
- is.setAmount(is.getAmount() - price);
- }
- if(price <= 0){
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement