Перейти к основному содержимому

Interface: System

Scheduler in QuestScript's final server-thread scripting phase.

Properties

afterEvents

readonly afterEvents: SystemAfterEvents

Observational system event streams.


beforeEvents

readonly beforeEvents: SystemBeforeEvents

Synchronous lifecycle events fired before teardown completes.


currentTick

readonly currentTick: number

Current Minecraft server tick.

Methods

clearJob()

clearJob(jobId): void

Cancel a cooperative generator job.

A queued step that has not accessed the generator is skipped. A generator step already executing is not preempted.

Parameters

jobId

number

Returns

void


clearRun()

clearRun(runId): void

Cancel a callback scheduled by run, run_timeout, or run_interval.

A queued callback that has not entered guest code is skipped. An invocation already executing and detached asynchronous work already started by a callback are not interrupted.

Parameters

runId

number

Returns

void


run()

run(cb): number

Schedule a callback for the next available final scripting phase.

The callback result is ignored. A returned Promise or awaitable is detached from this run handle.

Parameters

cb

() => void

Returns

number


runInterval()

runInterval(cb, interval?): number

Run a callback on a fixed Minecraft-tick interval.

A schedule point is skipped when the previous invocation is still queued or running. A returned Promise or awaitable is not part of the invocation and does not delay the next schedule point.

Parameters

cb

() => void

interval?

number | null

Returns

number


runJob()

runJob(generator): number

Advance a generator cooperatively in budgeted steps.

Parameters

generator

Generator<any, any, any>

Returns

number


runTimeout()

runTimeout(cb, timeout?): number

Schedule a one-shot callback after at least a number of ticks.

A timeout of zero is eligible again in the current final scripting phase. Soft tick-budget exhaustion may defer execution. The callback result is ignored; returned asynchronous work is detached from this run handle.

Parameters

cb

() => void

timeout?

number | null

Returns

number


waitTicks()

waitTicks(ticks): Promise<void>

Return an awaitable resolved no earlier than the selected server tick.

Parameters

ticks

number

Returns

Promise<void>