Class Countdown
java.lang.Object
dev.bouncingelf10.timelesslib.api.countdown.Countdown
-
Method Summary
Modifier and TypeMethodDescriptionbooleancancel()Cancels the countdown.displayAllUsers(TimeFormat timeFormat, String prefix, String suffix) displayNearbyUsers(double x, double y, double z, float radius) displayNearbyUsers(double x, double y, double z, float radius, TimeFormat timeFormat, String prefix, String suffix) displayNearbyUsers(net.minecraft.core.BlockPos blockPos, float radius) displayNearbyUsers(net.minecraft.core.BlockPos blockPos, float radius, TimeFormat timeFormat, String prefix, String suffix) displayNearbyUsers(net.minecraft.server.level.ServerPlayer player, float radius) displayNearbyUsers(net.minecraft.server.level.ServerPlayer player, float radius, TimeFormat timeFormat, String prefix, String suffix) displayNearbyUsers(net.minecraft.world.phys.Vec3 position, float radius) displayNearbyUsers(net.minecraft.world.phys.Vec3 position, float radius, TimeFormat timeFormat, String prefix, String suffix) displayToUser(net.minecraft.server.level.ServerPlayer player) displayToUser(net.minecraft.server.level.ServerPlayer player, TimeFormat timeFormat, String prefix, String suffix) Adds a task to execute every time the specified interval elapses.getId()booleanbooleanbooleanisPaused()Adds a task to execute when the countdown finishes.onThreshold(Duration threshold, Consumer<Object> handler) Adds a task to execute when the countdown reaches the specified threshold.onTick(BiConsumer<Object, Duration> handler) Adds a task to execute every countdown tick specified by the tick interval.booleanpause()Pauses the countdown.booleanToggles to pause or unpause the countdown.booleanresume()Resumes a paused countdown.
-
Method Details
-
cancel
public boolean cancel()Cancels the countdown.- Returns:
- true if the countdown was cancelled, false if it was already finished or canceled
-
pause
public boolean pause()Pauses the countdown. Note: If the countdown is already paused, this method does nothing.- Returns:
- true if the countdown was paused, false if it was already finished or canceled
-
resume
public boolean resume()Resumes a paused countdown. Note: If the countdown is not paused, this method does nothing.- Returns:
- true if the countdown was resumed, false if it was already finished or canceled
-
pauseOrUnpause
public boolean pauseOrUnpause()Toggles to pause or unpause the countdown.- Returns:
- true if the countdown was changed state, false if it was already finished or canceled
-
isCancelled
public boolean isCancelled() -
isPaused
public boolean isPaused() -
isFinished
public boolean isFinished() -
remaining
-
getId
-
onTick
Adds a task to execute every countdown tick specified by the tick interval.- Parameters:
handler- Handler to execute every countdown tick.- See Also:
-
onFinish
Adds a task to execute when the countdown finishes.- Parameters:
handler- Handler to execute when the countdown finishes.
-
onThreshold
Adds a task to execute when the countdown reaches the specified threshold.- Parameters:
threshold- Duration threshold to reach.handler- Handler to execute when the threshold is reached.
-
every
Adds a task to execute every time the specified interval elapses. (LikeonTick(BiConsumer), but with a specified interval instead of the countdown tick interval)- Parameters:
interval- Interval at which to execute the handler.handler- Handler to execute every time the interval elapses.
-
displayToUser
-
displayToUser
public Countdown displayToUser(net.minecraft.server.level.ServerPlayer player, TimeFormat timeFormat, String prefix, String suffix) -
displayAllUsers
-
displayAllUsers
-
displayNearbyUsers
-
displayNearbyUsers
public Countdown displayNearbyUsers(net.minecraft.world.phys.Vec3 position, float radius, TimeFormat timeFormat, String prefix, String suffix) -
displayNearbyUsers
-
displayNearbyUsers
public Countdown displayNearbyUsers(net.minecraft.server.level.ServerPlayer player, float radius, TimeFormat timeFormat, String prefix, String suffix) -
displayNearbyUsers
-
displayNearbyUsers
public Countdown displayNearbyUsers(net.minecraft.core.BlockPos blockPos, float radius, TimeFormat timeFormat, String prefix, String suffix) -
displayNearbyUsers
-
displayNearbyUsers
public Countdown displayNearbyUsers(double x, double y, double z, float radius, TimeFormat timeFormat, String prefix, String suffix)
-