Advertisement
broken-arrow

Untitled

Jun 24th, 2021
909
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.90 KB | None | 0 0
  1.     public Map<Material, Integer> getItemsAmount(Crafting values, String listOfItems, Inventory inventory) {
  2.         Map<Material, Integer> map = new HashMap<>();
  3.         int amountFirst = 0;
  4.         int amountSecond = 0;
  5.         int amountThird = 0;
  6.  
  7.         for (ItemStack itemStacks : inventory) {
  8.             if (listOfItems.equals(values.toString()) && itemStacks != null) {
  9.                 if (itemStacks.getType().toString().equals(values.getmatrialName())) {
  10.                     amountFirst += itemStacks.getAmount();
  11.                     map.put(itemStacks.getType(), amountFirst);
  12.  
  13.                 } else if (itemStacks.getType().toString().equals(values.getmatrialNames1())) {
  14.                     amountSecond += itemStacks.getAmount();
  15.                     map.put(itemStacks.getType(), amountSecond);
  16.  
  17.                 } else if (itemStacks.getType().toString().equals(values.getmatrialNames2())) {
  18.                     amountThird += itemStacks.getAmount();
  19.                     map.put(itemStacks.getType(), amountThird);
  20.                 }
  21.             }
  22.         }
  23.         return map;
  24.     }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement