rallostar Posted July 16, 2017 Posted July 16, 2017 Hi I'm fairly new to this so please don't shoot me What I'm trying to accomplish is to check if my script has at least two or more of an item, if not, it should bank. I currently have this boolean: private boolean hasRequiredItems() { if(!getInventory().contains("Plank") || !getInventory().contains("Hammer") || !getInventory().contains("Saw") || !getInventory().contains("Steel nails")) { return false; } return true; } Would it be something like if(getInventory().contains("Plank", 1) (which is the only number less than 2) But what if I wanna check if the inventory contains at least 10 steel nails. Appreciate the help in advance, I've looked through the API but I find it a bit hard to read
Butters Posted July 16, 2017 Posted July 16, 2017 if (inventory.contains("Steel nails") && inventory.getAmount("Steel nails") >= 10) { do something funky } 1
rallostar Posted July 16, 2017 Author Posted July 16, 2017 1 hour ago, nosepicker said: if (inventory.contains("Steel nails") && inventory.getAmount("Steel nails") >= 10) { do something funky } Thanks bro! Appreciate it