Well instead of having this, you don't need anything in this case at all.
new ConditionalSleep(50000) {
@Override
public boolean condition() throws InterruptedException {
return (!combat.isFighting() || lowHealth() || loot != null && loot.isVisible());
}
}.sleep();
I would do it like this
if (HP<int) {
//eat
} else if (loot.exists) {
//loot
} else {
if (!combat.isFighting()) {
enemy.interact("Attack");
state = "Fighting a enemy.";
new ConditionalSleep(5000) {
@Override
public boolean condition() throws InterruptedException {
return (myPlayer().isFighting());
}
}.sleep();
}
else {
}
}
Or you could do it like this. It will return state nothing when you are fighting since it is the last one that is true.
if (HP<int) {
return state.EAT;
}
if (loot.exists) {
return state.LOOT;
}
if (!combat.isFighting) {
return state.ATTACK;
}
return state.NOTHING;
now in your loop you have
case ATTACK;
//Attack NPC
//sleep until in
enemy.interact("Attack");
state = "Fighting a enemy.";
new ConditionalSleep(5000) {
@Override
public boolean condition() throws InterruptedException {
return (myPlayer().isFighting());
}
}.sleep();
break;