August 10, 20196 yr 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, 20196 yr by Chris050999
August 10, 20196 yr 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, 20196 yr by Ragboys is back
August 10, 20196 yr 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:
August 11, 20196 yr Author 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 😃
Create an account or sign in to comment