Class CountdownManager<T>
java.lang.Object
dev.bouncingelf10.timelesslib.api.countdown.CountdownManager<T>
- Direct Known Subclasses:
AbstractCooldownManager,ClientCountdownManager
-
Constructor Summary
ConstructorsConstructorDescriptionCountdownManager(Supplier<T> contextProvider) CountdownManager(Supplier<T> contextProvider, int poolSize) CountdownManager(Supplier<T> contextProvider, BiConsumer<T, Runnable> mainThreadDispatcher) CountdownManager(Supplier<T> contextProvider, BiConsumer<T, Runnable> mainThreadDispatcher, int poolSize) -
Method Summary
Modifier and TypeMethodDescriptionvoidshutdown()If you're getting the countdown manager throughTimelessLib.getServerCountdownManager()or the client counterpart you should NOT call this method.voidshutdownGracefully(long timeout, TimeUnit unit) If you're getting the countdown manager throughTimelessLib.getServerCountdownManager()or the client counterpart you should NOT call this method.Starts a countdown with a tick interval of 50ms and the game time source.start(Duration totalDuration, Duration tickInterval, TimeSource timeSource) Starts a countdown with the specified tick interval and time source.startRealtime(Duration totalDuration) Starts a countdown with a tick interval of 50ms and the real time source.
-
Constructor Details
-
CountdownManager
-
CountdownManager
public CountdownManager(Supplier<T> contextProvider, BiConsumer<T, Runnable> mainThreadDispatcher, int poolSize) -
CountdownManager
-
CountdownManager
-
-
Method Details
-
start
Starts a countdown with a tick interval of 50ms and the game time source.- Parameters:
totalDuration- Duration of the countdown.- Returns:
Countdown- See Also:
-
startRealtime
Starts a countdown with a tick interval of 50ms and the real time source.- Parameters:
totalDuration- Duration of the countdown.- Returns:
Countdown- See Also:
-
start
Starts a countdown with the specified tick interval and time source.- Parameters:
totalDuration- Duration of the countdown.tickInterval- Tick interval of the countdown.timeSource- Time source to use.- Returns:
Countdown- See Also:
-
get
-
shutdown
public void shutdown()If you're getting the countdown manager throughTimelessLib.getServerCountdownManager()or the client counterpart you should NOT call this method. -
shutdownGracefully
If you're getting the countdown manager throughTimelessLib.getServerCountdownManager()or the client counterpart you should NOT call this method.- Throws:
InterruptedException
-