P
- Cooldown key providerK
- Cooldown keypublic class EasyCooldown<P,K>
extends java.lang.Object
限定符和类型 | 字段和说明 |
---|---|
protected @NotNull java.util.Map<K,java.lang.Long> |
cooldown |
protected long |
defaultDuration |
protected java.text.NumberFormat |
numberFormatter |
protected @NotNull java.util.function.Function<P,K> |
providerToKey |
构造器和说明 |
---|
EasyCooldown(@NotNull java.util.function.Function<P,K> providerToKey) |
EasyCooldown(@NotNull java.text.NumberFormat numberFormatter,
@NotNull java.util.function.Function<P,K> providerToKey) |
EasyCooldown(@NotNull java.text.NumberFormat numberFormatter,
@NotNull java.util.function.Function<P,K> providerToKey,
long defaultDuration) |
限定符和类型 | 方法和说明 |
---|---|
void |
clear(P provider) |
void |
clearCooldown(K key) |
static java.text.NumberFormat |
createFormatter(@NotNull java.util.function.Consumer<java.text.NumberFormat> consumer) |
static java.text.NumberFormat |
defaultFormatter() |
@NotNull java.lang.String |
formatSeconds(long cooldownMillis) |
long |
getCooldown(P provider) |
@NotNull java.lang.String |
getCooldownSeconds(P provider) |
long |
getDuration(P provider) |
boolean |
isCoolingDown(P provider) |
void |
updateTime(P provider) |
protected final java.text.NumberFormat numberFormatter
@NotNull protected final @NotNull java.util.Map<K,java.lang.Long> cooldown
protected long defaultDuration
public EasyCooldown(@NotNull @NotNull java.text.NumberFormat numberFormatter, @NotNull @NotNull java.util.function.Function<P,K> providerToKey)
public long getCooldown(@NotNull P provider)
@NotNull public @NotNull java.lang.String getCooldownSeconds(@NotNull P provider)
public void updateTime(@NotNull P provider)
public void clear(@NotNull P provider)
public void clearCooldown(@NotNull K key)
public boolean isCoolingDown(@NotNull P provider)
public long getDuration(@NotNull P provider)
@NotNull public @NotNull java.lang.String formatSeconds(long cooldownMillis)
public static java.text.NumberFormat createFormatter(@NotNull @NotNull java.util.function.Consumer<java.text.NumberFormat> consumer)
public static java.text.NumberFormat defaultFormatter()
Copyright © 2024. All rights reserved.