public class Cooldown extends Object
Constructor and Description |
---|
Cooldown(long cooldownMillis) |
Cooldown(long cooldownTime,
TimeUnit timeUnit) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Cools down totally.
|
long |
getRemainingTime()
How much time we need to wait before the effect will cool down.
|
boolean |
isCool()
Whether you may use the effect, i.e., it was never used before or has cooled down.
|
boolean |
isHot()
Whether we're not
isCool() . |
boolean |
tryUse()
Check whether it is
isCool() , if so, save current time as the time of the use and returns true,
otherwise (== effect needs more cooldown, see getRemainingTime() ) returns false. |
void |
use()
Force use of the effect == sets
lastUsedMillis to current time. |
public Cooldown(long cooldownMillis)
public Cooldown(long cooldownTime, TimeUnit timeUnit)
public boolean tryUse()
isCool()
, if so, save current time as the time of the use and returns true,
otherwise (== effect needs more cooldown, see getRemainingTime()
) returns false.public void use()
lastUsedMillis
to current time.public boolean isCool()
public boolean isHot()
isCool()
.public long getRemainingTime()
public void clear()
Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.