There are a few options here and I would strongly suggest against having any static duration sleeps anywhere in your code.
Your first option is to try and find a condition other than animation to feed the conditionalSleep. You'll have to look through various debuggers to find this query value, if it exists.
The second option is, as Malcolm suggested, some kind of animation timer. You can either implement this in-place as Malcolm suggested, or you can run it in a concurrent thread which is my preferred method, although there are a few intricacies to Java's thread system (specifically correctly creating, running, querying and stopping the thread) which mean there are ways this can be implemented incorrectly which give unexpected behaviour. This might be a little complex for someone as new to java as you, so perhaps the basic method is sufficient for now . With that being said, there are plenty of tutorials available online so if you want a challenge you could always give this a go! The benefit to the concurrent system is it is entirely detached from the running of your main code, so you are not relying on an iteration of your onLoop not exceeding a certain time threshold.
Apa