Cooldown.@Deprecated @NonnullByDefault public class Cooldown extends Object implements LongSupplier, Cooldown
| Modifier and Type | Field and Description |
|---|---|
protected long |
lastTested
Deprecated.
|
protected long |
timeout
Deprecated.
|
| Modifier | Constructor and Description |
|---|---|
protected |
Cooldown(long amount,
TimeUnit unit)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
Cooldown |
copy()
Deprecated.
Copies the properties of this cooldown to a new instance
|
long |
elapsed()
Deprecated.
Returns the elapsed time in milliseconds since the cooldown was last reset, or since creation time
|
long |
getAsLong()
Deprecated.
|
OptionalLong |
getLastTested()
Deprecated.
Return the time in milliseconds when this cooldown was last
test()ed. |
long |
getTimeout()
Deprecated.
Gets the timeout in milliseconds for this cooldown
|
static Cooldown |
of(long amount,
TimeUnit unit)
Deprecated.
|
static Cooldown |
ofTicks(long ticks)
Deprecated.
|
long |
remainingMillis()
Deprecated.
Gets the time in milliseconds until the cooldown will become inactive.
|
long |
remainingTime(TimeUnit unit)
Deprecated.
Gets the time until the cooldown will become inactive.
|
void |
reset()
Deprecated.
Resets the cooldown
|
void |
setLastTested(long time)
Deprecated.
Sets the time in milliseconds when this cooldown was last tested.
|
boolean |
test()
Deprecated.
Returns true if the cooldown is not active, and then resets the timer
|
boolean |
testSilently()
Deprecated.
Returns true if the cooldown is not active
|
protected long lastTested
protected final long timeout
@Deprecated protected Cooldown(long amount, TimeUnit unit)
@Deprecated public static Cooldown ofTicks(long ticks)
@Deprecated public static Cooldown of(long amount, TimeUnit unit)
public boolean test()
If the cooldown is currently active, the timer is not reset.
public boolean testSilently()
testSilently in interface Cooldownpublic long elapsed()
public long remainingMillis()
If the cooldown is not active, this method returns 0.
remainingMillis in interface Cooldownpublic long remainingTime(TimeUnit unit)
If the cooldown is not active, this method returns 0.
remainingTime in interface Cooldownunit - the unit to return inpublic long getAsLong()
getAsLong in interface LongSupplierpublic long getTimeout()
getTimeout in interface Cooldownpublic Cooldown copy()
public OptionalLong getLastTested()
test()ed.getLastTested in interface Cooldownpublic void setLastTested(long time)
Note: this should only be used when re-constructing a cooldown
instance. Use test() otherwise.
setLastTested in interface Cooldowntime - the timeCopyright © 2017. All rights reserved.