BreakManager

Scheduled breaks for this plugin, set up by the player.

Methods
7
Fields
None

Methods

MethodReturnsDescription
register(number?, number?, number?, number?, string?)()Starts this plugin's run clock, and suggests its defaults: runMin to runMax minutes of play between breaks, breakMin to breakMax mi…
unregister()()This plugin takes no more breaks until it registers again. A break this plugin owns is abandoned where it stands: an account it logged out…
active()booleanWhether a break is running, whichever plugin's it is, while this plugin is registered: when it is, sit out this tick. Always false for a…
atSafeSpot()booleanSays this is a safe spot: starts this plugin's break when one is due and the user has breaks on for it. true while a break is running, th…
format()string?The running break's format, "logout", "afk", "newWorld" or "hop"; nil when no break is running, or this plugin has not registered.
remainingSeconds()number?Seconds left in the running break, rounded up; nil when no break is running, or this plugin has not registered. Once the break's time is…
untilBreakSeconds()number?Seconds until this plugin's next break is due, rounded up; nil while breaks are off for it, this plugin has not registered, or a break is…

Method details

register

register: (number?, number?, number?, number?, string?) -> ()

Starts this plugin's run clock, and suggests its defaults: runMin to runMax minutes of play between breaks, breakMin to breakMax minutes of break, and format. Leave any of them out to take the global default for it; a window with a maximum of 0 or less is left out too. The user's saved settings win over all of these. Calling it again replaces the defaults and restarts the clock. Raises for a format other than "logout", "afk", "newWorld" or "hop".

unregister

unregister: () -> ()

This plugin takes no more breaks until it registers again. A break this plugin owns is abandoned where it stands: an account it logged out stays logged out. Call it from shutDown.

active

active: () -> boolean

Whether a break is running, whichever plugin's it is, while this plugin is registered: when it is, sit out this tick. Always false for a plugin that has not registered.

atSafeSpot

atSafeSpot: () -> boolean

Says this is a safe spot: starts this plugin's break when one is due and the user has breaks on for it. true while a break is running, this one or another plugin's, so the plugin sits out the tick. Call it wherever stopping would do no harm, such as just after banking.

format

format: () -> string?

The running break's format, "logout", "afk", "newWorld" or "hop"; nil when no break is running, or this plugin has not registered.

remainingSeconds

remainingSeconds: () -> number?

Seconds left in the running break, rounded up; nil when no break is running, or this plugin has not registered. Once the break's time is up and the client is on its way back this is nil too, while active() stays true.

untilBreakSeconds

untilBreakSeconds: () -> number?

Seconds until this plugin's next break is due, rounded up; nil while breaks are off for it, this plugin has not registered, or a break is running. It reads 0 once one is due: the break then starts at the next atSafeSpot().