I don't think that's going to stop your player from keeping on mining while your rock changed in smoking rock.
Maybe you should try something with states: (I'm just writing this now and I never wrote a mining script so it could be wrong)
private Enum State { MINING,WAITING}
private State state = State.MINING;
private RS2Object currentRock = null;
private int rockId = <ROCK_ID>;// replace with your rock id
switch (state){
case WAITING:
if(currentRock.getId() == rockId){// currentRock still is normal rock (I don't know what to check for, could be id or modelHeight or something)
// sleep or antiban or w/e
}else{
currentRock = null;
state = State.MINING;
}
break;
case MINING:
currentRock = closestObject(rockId);
if(currentRock!=null){
currentRock.interact("Mine");
}
break;
}