public class Countdown extends Object
Scoreboard objects. Additionally, can run
code provided through the start(long, Runnable) method| Constructor and Description |
|---|
Countdown() |
| Modifier and Type | Method and Description |
|---|---|
Countdown |
announceAt(long time,
TimeUnit unit)
Notes to make a chat-based announcement at the specified time in the
countdown
|
Countdown |
announceAt(TimePoint point)
Notes to make a chat-based announcement at the specified time in the
countdown
|
Countdown |
announceAtRange(long min,
long max,
TimeUnit unit)
Sets an announcement at every single integer point between the specified
max and min values, inclusively. |
Countdown |
assignScoreboard(Scoreboard s)
Assigns a scoreboard to have the objective in the
DisplaySlot.SIDEBAR's title changed in accordance to the default
format |
Countdown |
assignScoreboard(Scoreboard s,
String format)
Assigns a scoreboard to have the objective in the
DisplaySlot.SIDEBAR's title changed in accordance to the format
given to this specific board. |
String |
getDefaultFormat()
Returns the default format used for all boards
|
Countdown |
setAnnouncementFormat(String format)
Sets the format for announcement messages in the chat from this
Countdown. |
Countdown |
setTimeFormat(String format)
Sets the format for the title of the sidebar scoreboard.
|
void |
start(long duration,
Runnable exec)
Starts a countdown timer that will run for as long as the specified
duration argument. |
public void start(long duration,
Runnable exec)
duration argument.duration - The amount of time in seconds to run the countdownexec - Task to run when countdown completespublic Countdown assignScoreboard(Scoreboard s, String format)
DisplaySlot.SIDEBAR's title changed in accordance to the format
given to this specific board.s - The scoreboard to modifyformat - Optional board-specific format. Can be nullfor info about the syntax
for setting a format stringpublic Countdown assignScoreboard(Scoreboard s)
DisplaySlot.SIDEBAR's title changed in accordance to the default
formats - The scoreboard to modifypublic Countdown setTimeFormat(String format)
%s and %d), but if an
additional %s is supplied it will use the first %d for
displaying hours and the following for minutes and seconds. Additionally,
%d should be the first token in the format string. So in
practice:
.* %d .* %s (optional) .* %s .*
(?!.*%[^sd])(?!.*%d.*%d)(?!.*%s.*%s.*%s)
(?!.*%s.*%d)(?=.*%s)(?=.*%d).*format - The format for the clockCountdown objectpublic Countdown setAnnouncementFormat(String format)
Countdown.format - The format to setpublic Countdown announceAt(long time, TimeUnit unit)
time - The amount of time to announce atunit - The relevant unit of timepublic Countdown announceAt(TimePoint point)
point - The relevant TimePoint to announce atpublic Countdown announceAtRange(long min, long max, TimeUnit unit)
max and min values, inclusively. E.g. a call of
announceAtRange.(5, 10, TimeUnit.MINUTES) would announce at
every minute between 5 and 10, as well as those times themselvesmin - The minimum time to announce atmax - The maximum time to announce atunit - The unit of time relevant to this rangepublic String getDefaultFormat()
Copyright © 2015. All rights reserved.