Class ServerCountdownManager
java.lang.Object
dev.bouncingelf10.timelesslib.api.countdown.ServerCountdownManager
Countdown factory running against the
Obtain the shared instance through
MinecraftServer context. Obtain the shared instance through
TimelessLib.countdowns() - this class cannot be constructed by other mods.-
Constructor Summary
ConstructorsConstructorDescriptionServerCountdownManager(InternalAccess access, Supplier<net.minecraft.server.MinecraftServer> contextProvider) ServerCountdownManager(InternalAccess access, Supplier<net.minecraft.server.MinecraftServer> contextProvider, int poolSize) -
Method Summary
Modifier and TypeMethodDescriptionintbooleanCancels every currently active countdown.get(net.minecraft.resources.ResourceLocation id) Looks up an active countdown by its ID.booleanbooleanvoidshutdown()If you're getting the countdown manager throughTimelessLib.countdowns()or the client counterpart you should NOT call this method.voidshutdownGracefully(long timeout, TimeUnit unit) If you're getting the countdown manager throughTimelessLib.countdowns()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
-
ServerCountdownManager
public ServerCountdownManager(InternalAccess access, Supplier<net.minecraft.server.MinecraftServer> contextProvider) -
ServerCountdownManager
public ServerCountdownManager(InternalAccess access, Supplier<net.minecraft.server.MinecraftServer> contextProvider, int poolSize)
-
-
Method Details
-
start
Starts a countdown with a tick interval of 50ms and the game time source.- Parameters:
totalDuration- Duration of the countdown.- Returns:
ServerCountdown- See Also:
-
startRealtime
Starts a countdown with a tick interval of 50ms and the real time source.- Parameters:
totalDuration- Duration of the countdown.- Returns:
ServerCountdown- 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:
ServerCountdown- See Also:
-
get
Looks up an active countdown by its ID.- Parameters:
id- Countdown ID- Returns:
TaskHandleor empty if no active countdown has that ID
-
activeCountdownCount
public int activeCountdownCount()- Returns:
- the number of currently active countdowns.
-
cancelAll
public boolean cancelAll()Cancels every currently active countdown.- Returns:
- true if at least one countdown was cancelled
-
shutdown
public void shutdown()If you're getting the countdown manager throughTimelessLib.countdowns()or the client counterpart you should NOT call this method. -
shutdownGracefully
If you're getting the countdown manager throughTimelessLib.countdowns()or the client counterpart you should NOT call this method.- Throws:
InterruptedException
-
isShutdown
public boolean isShutdown() -
isTerminated
public boolean isTerminated()
-