Usage Example
Behavior
- The timer starts immediately upon creation.
- At the end of the time:
- The
FINISH
event is triggered IF the timer is NOT stopped manually. - The timer is automatically destroyed after the time set in ticks_hide_after_ending has elapsed.
- The
- You can pause, stop, or modify it using other API methods (documented on separate pages)
Parameters
The time in HH:MM:SS format.
- Example: “00:05:30” (5 minutes, 30 seconds)
- If the value is “00:00:00” or does not comply with the format, the timer will not be created
Unique identifier for the timer.
- If a timer with the same timerId already exists, the plugin will assign one of them to that ID and the other will remain on standby
- It is recommended to use unique IDs to avoid conflicts
Reference to the player who performed the action.
- If a player passes, they will receive a message indicating that the timer was created
- It is usually not necessary to use it directly in the API
Returns
This
Timer
instance represents the active timer and usually exposes useful methods such as:String getTimerId()
— returns the timerIdboolean isActive()
— true if the timer exists AND is not pausedboolean isPaused()
— true if the timer is pausedint getInitialSeconds()
— returns the total seconds of the timerint getRemainingSeconds()
— returns the seconds remaining until the timer endsvoid refreshTimerText()
— refresh and get the new settingsString getTimeLeft()
— returns the remaining time in HH:MM:SSString getTimeLeftHH()
/String getTimeLeftMM()
/String getTimeLeftSS()
— returns the remaining time in HH, MM, or SS formats
If any of the above requirements fail, it will return
null
.