Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Map<Material, Integer> getItemsAmount(Crafting values, String listOfItems, Inventory inventory) {
- Map<Material, Integer> map = new HashMap<>();
- int amountFirst = 0;
- int amountSecond = 0;
- int amountThird = 0;
- for (ItemStack itemStacks : inventory) {
- if (listOfItems.equals(values.toString()) && itemStacks != null) {
- if (itemStacks.getType().toString().equals(values.getmatrialName())) {
- amountFirst += itemStacks.getAmount();
- map.put(itemStacks.getType(), amountFirst);
- } else if (itemStacks.getType().toString().equals(values.getmatrialNames1())) {
- amountSecond += itemStacks.getAmount();
- map.put(itemStacks.getType(), amountSecond);
- } else if (itemStacks.getType().toString().equals(values.getmatrialNames2())) {
- amountThird += itemStacks.getAmount();
- map.put(itemStacks.getType(), amountThird);
- }
- }
- }
- return map;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement