Skip to content

API reference / @jsprismarine/prismarine / scripting/LevelScripts

scripting/LevelScripts ​

Classes ​

Interfaces ​

LevelScriptsOptions ​

Defined in: packages/prismarine/src/scripting/LevelScripts.ts:33

What a level's scripts need from the server.

Properties ​

addonConfig? ​

readonly optional addonConfig?: AddonConfigStore

Defined in: packages/prismarine/src/scripting/LevelScripts.ts:47

The packs' config files, which @jsprismarine/server's config reaches. The module leaves it out when absent.

admin? ​

readonly optional admin?: ScriptAdminServer

Defined in: packages/prismarine/src/scripting/LevelScripts.ts:45

The server @minecraft/server-admin's dedicatedServer and its functions reach. They do nothing when absent.

configDirectory ​

readonly configDirectory: string | undefined

Defined in: packages/prismarine/src/scripting/LevelScripts.ts:37

BDS's config/ folder, which permissions.json and the rest are read from, when there is one.

debugger? ​

readonly optional debugger?: object

Defined in: packages/prismarine/src/scripting/LevelScripts.ts:65

The script debugger's settings, and whether the server replays a recorded session, when the debugger never opens a socket. Every connection is refused when absent.

replay ​

readonly replay: boolean

settings ​

readonly settings: ScriptDebuggerConfig

sleep? ​

readonly optional sleep?: (seconds) => Promise<void>

Resolves after a number of seconds, for auto-attach; a timer when absent.

Parameters ​
seconds ​

number

Returns ​

Promise<void>

experiments? ​

readonly optional experiments?: readonly string[]

Defined in: packages/prismarine/src/scripting/LevelScripts.ts:57

The experiments the level has on, by their level.dat names. Beta APIs lets a pack declare a beta Script API version. None when absent.

log ​

readonly log: ScriptLog

Defined in: packages/prismarine/src/scripting/LevelScripts.ts:58

maxPlayers ​

readonly maxPlayers: number

Defined in: packages/prismarine/src/scripting/LevelScripts.ts:49

How many players may be online at once, which jsprismarine.maxPlayers tells the packs.

members? ​

readonly optional members?: JsprismarineServerMembers

Defined in: packages/prismarine/src/scripting/LevelScripts.ts:43

What @jsprismarine/server's performance, getPing, bossBars and playerList reach of the server. The module leaves them out when absent.

onShutdown ​

readonly onShutdown: () => void

Defined in: packages/prismarine/src/scripting/LevelScripts.ts:60

Asked to stop the server after a critical exception the watchdog does not let pass.

Returns ​

void

packDirectories ​

readonly packDirectories: readonly string[]

Defined in: packages/prismarine/src/scripting/LevelScripts.ts:35

The behavior pack directories the level loads; the ones with a script module run.

seed ​

readonly seed: bigint

Defined in: packages/prismarine/src/scripting/LevelScripts.ts:51

The level's seed, which Math.random is seeded from.

sources ​

readonly sources: ScriptWorldSources

Defined in: packages/prismarine/src/scripting/LevelScripts.ts:38

watchdog ​

readonly watchdog: ScriptWatchdogConfig

Defined in: packages/prismarine/src/scripting/LevelScripts.ts:52


ScriptPhaseWorld ​

Defined in: packages/prismarine/src/scripting/LevelScripts.ts:90

A world whose tick runs the level's script flush.

Methods ​

setScriptPhase() ​

setScriptPhase(phase, replacing?): void

Defined in: packages/prismarine/src/scripting/LevelScripts.ts:92

Sets the flush phase; with replacing, only while that phase is the world's current one.

Parameters ​
phase ​

(() => void) | undefined

replacing? ​

() => void

Returns ​

void