You can't have the variable objectDelay in the same method; it's always going to be zero, meaning the first if-sentence will always be true. You have to save the System.currentTimeMillis() variable on the player's character and compare it then. Additionally you're missing returns.