Think about it like this. You have a variable called lastAction;
Right now this variables hasn't be initialized, meaning it have no value. What i'm about to do is make it equal to the current time translated into milliseconds.
Code:
lastAction = System.currentTimeMillis();
What you want to know is if enough time has passed so the player can continue doing an action. There is an easy way to do start doing this, subtract the time of the last action, with the current time.
Code:
long difference = System.currentTimeMillis() - lastAction
At this point we know how long it has been, in milliseconds since the last action. We have a variable that is storing this information. Now compare the difference to some value like so;
Code:
if(difference > (1000 * 30))
doAction();
Hope this helps.