Without too much extra stuff it would be this
Don't use static sleeps, Use Conditional sleeps to speed it up
if (getInventory().isItemSelected()) {
object.interact("Use");
} else {
getInventory().interact("Use", ITEM_NAME);
}
Ran for about 2 hours, didn't notice any issues on my side...
Tried restarting your client? Especially on mirror mode, it breaks a lot and the only way to fix is to restart the whole client. Also make sure you are logged out when you hook mirror