So why not buy a staff and auto cast? or why do you wanna cast every spell by clicking it?
Above code could be changed to something like this:
if(getMagic().isSpellSelected()){
NPC enemy = getNpcs().closest("Lesser demon");
if(enemy != null){
if(enemy.interact("Attack")){
ConditionalSleep2.sleep(2500, () -> !getMagic().isSpellSelected());
}
}
}else{
if(getMagic().castSpell(Spells.NormalSpells.FIRE_STRIKE)){
ConditionalSleep2.sleep(2500, () -> getMagic().isSpellSelected());
}
}