Phoenix Posted August 10, 2019 Posted August 10, 2019 (edited) if (this.api.store.isOpen()) { //Close shop and open packs if (getInventory().isFull()) { this.api.store.close(); if (!getInventory().isItemSelected()) { getInventory().getItem(itemPack).interact("Open"); new ConditionalSleep(10000) { @Override public boolean condition() { return (!getInventory().isFull()); } }.sleep(); } } This is what im trying to implement into my script. However, (getInventory().isFull()) breaks the script and floods log with NPE error. I've found that it does this no matter where it is placed in my script. I suppose an alternative would be (inventory.contains(itemPack) && inventory.getAmount(itemPack) >= ) but this would limit the scripts capabilities of purchasing more than 1 item at a time. Help Edited August 10, 2019 by Chris050999
Ragboys is back Posted August 10, 2019 Posted August 10, 2019 (edited) Not sure if it's this but try to change public boolean condition() { return (!getInventory().isFull()); } to public boolean condition() { return !getInventory().isFull(); } AKA just remove the ( ) between the return line. Edited August 10, 2019 by Ragboys is back
liverare Posted August 10, 2019 Posted August 10, 2019 I'm assuming if you have to do this.api.store. then I'm guessing you also need to do this.api.getInventory().isFull() either way, look into this: 1
Phoenix Posted August 11, 2019 Author Posted August 11, 2019 13 hours ago, Ragboys is back said: Not sure if it's this but try to change public boolean condition() { return (!getInventory().isFull()); } to public boolean condition() { return !getInventory().isFull(); } AKA just remove the ( ) between the return line. Did not and should not make a difference? Not too sure haha. 13 hours ago, liverare said: I'm assuming if you have to do this.api.store. then I'm guessing you also need to do this.api.getInventory().isFull() either way, look into this: You are correct and I feel like a dummy for not realizing it myself. Still causes a crash even if i call it outside of the class that uses api though, cant figure out why. This'll do for now though, thanks