public void condSleep(int timeout,boolean statement)
{
new ConditionalSleep(timeout)
{
@Override
public boolean condition() throws InterruptedException
{
return statement;
}
}.sleep();
}
condSleep(7000,ctx.getInventory().getAmount("Plank") > amountOfPlankInInventory);
The method receives a boolean 'statement', which is evaluated to either true or false at the time of the method call. It's not going to magically change during the execution of the conditional sleep. So either you sleep the full time, or not at all.