Hi! Tell me pls, why it gives the entire amount at once, although not all items were in the inventory. Code (Text): number = 0; ItemStack is = inv.getItem(i); ///////////////////////////// if (is == null || is.getType() == Material.WOOD_SWORD) { number += 150; } if (is == null || is.getType() == Material.STONE_SWORD){ number += 175; }if (is == null || is.getType() == Material.IRON_SWORD) { number += 225; } if (is == null || is.getType() == Material.DIAMOND_SWORD) { number += 300; } if (is == null || is.getType() == Material.GOLD_SWORD) { number += 200; } if (is == null || is.getType() == Material.DIAMOND_HOE) { number += 50; }
Pls: if(is == null){return}; switch(is.getType()) case... default: break; return; Or use a Map<Material, Integer> and use #get(Material)