Advertisement
CaptainLepidus

removeInventoryItem

Nov 3rd, 2013
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. public void removeInventoryItem(Inventory inv,chestItem ch) {
  2.         ItemStack[] ls = inv.getContents();
  3.         for(ItemStack is : ls) {
  4.             if (compareItem(is,ch)) {
  5.                 if (is.getAmount()<=1) {
  6.                     is.setType(Material.AIR);
  7.                     is.setAmount(0);
  8.                 }
  9.                 else {
  10.                     is.setAmount(is.getAmount()-1);
  11.                 }
  12.                 break;
  13.             }
  14.         }
  15.         inv.setContents(ls);
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement