Sorry, previous answer was completely wrong, not sure why I wrote that, try storing the seagull in a global variable, and checking like this:
private NPC seagull;
@Override
public final int onLoop() throws InterruptedException {
if (seagull == null || !myPlayer().isInteracting(seagull)) {
attackNpc();
}
return random(100,300);
}
And of course assign seagull in your attackNPC method