States are unnecessary and messy, cleanest way is:
if not attacking seagull:
attack seagull
else:
relax
That's pretty good, but:
You don't need to check if the seagull is visible and call camera.ToEntity
You should be checking if your player is already attacking a seagull before calling attackNpc, not in attackNpc
You should null check seagull, just in case there aren't any, as your code currently will throw a NullPointerException
It would be cleaner to filter a seagull that isn't under attack in the closest method(), rather than after
You should check the the "Attack" interaction is successful before sleeping.
Your condition in the ConditonalSleep is incorrect. You should check whether your player is interacting with the seagull, or the seagull is not attackable.
Take a look at the isAttackable() method for NPCs, it will perform all the checks such as exists, not under attack and has health > 0 for you.
NPC seagull = getNpcs().closest(npc -> npc.getName().equals("Seagull") && npc.isAttackable());
if (seagull != null && seagull.interact("Attack")) {
new ConditionalSleep(5000) {
@Override
public boolean condition() {
return myPlayer().isInteracting(seagull) || !seagull.isAttackable();
}
}.sleep();
}