[API reference](https://jsprismarine.dev/api/index.md) / [@jsprismarine/prismarine](https://jsprismarine.dev/api/@jsprismarine/prismarine/index.md) / scripting/LevelScripts

# scripting/LevelScripts

## Classes

- [LevelScripts](https://jsprismarine.dev/api/@jsprismarine/prismarine/scripting/LevelScripts/classes/LevelScripts.md)

## Interfaces

### LevelScriptsOptions

Defined in: [packages/prismarine/src/scripting/LevelScripts.ts:33](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/scripting/LevelScripts.ts#L33)

What a level's scripts need from the server.

#### Properties

##### addonConfig?

> `readonly` `optional` **addonConfig?**: [`AddonConfigStore`](https://jsprismarine.dev/api/@jsprismarine/script-host/host/addonConfig/index.md#addonconfigstore)

Defined in: [packages/prismarine/src/scripting/LevelScripts.ts:47](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/scripting/LevelScripts.ts#L47)

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

##### admin?

> `readonly` `optional` **admin?**: [`ScriptAdminServer`](https://jsprismarine.dev/api/@jsprismarine/script-host/host/world/index.md#scriptadminserver)

Defined in: [packages/prismarine/src/scripting/LevelScripts.ts:45](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/scripting/LevelScripts.ts#L45)

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](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/scripting/LevelScripts.ts#L37)

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:68](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/scripting/LevelScripts.ts#L68)

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`](https://jsprismarine.dev/api/@jsprismarine/prismarine/config/Config/index.md#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:60](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/scripting/LevelScripts.ts#L60)

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`](https://jsprismarine.dev/api/@jsprismarine/script-host/host/WorldScripts/index.md#scriptlog)

Defined in: [packages/prismarine/src/scripting/LevelScripts.ts:61](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/scripting/LevelScripts.ts#L61)

##### maxPlayers

> `readonly` **maxPlayers**: `number`

Defined in: [packages/prismarine/src/scripting/LevelScripts.ts:49](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/scripting/LevelScripts.ts#L49)

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

##### members?

> `readonly` `optional` **members?**: [`JsprismarineServerMembers`](https://jsprismarine.dev/api/@jsprismarine/script-host/host/jsprismarineMembers/index.md#jsprismarineservermembers)

Defined in: [packages/prismarine/src/scripting/LevelScripts.ts:43](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/scripting/LevelScripts.ts#L43)

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:63](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/scripting/LevelScripts.ts#L63)

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](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/scripting/LevelScripts.ts#L35)

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

##### randomSeed

> `readonly` **randomSeed**: () => `bigint`

Defined in: [packages/prismarine/src/scripting/LevelScripts.ts:54](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/scripting/LevelScripts.ts#L54)

Draws the seed the scripts' `Math.random` starts from, each time they load; see
scriptRandomSeed.

###### Returns

`bigint`

##### sources

> `readonly` **sources**: [`ScriptWorldSources`](https://jsprismarine.dev/api/@jsprismarine/prismarine/scripting/LevelScriptWorld/index.md#scriptworldsources)

Defined in: [packages/prismarine/src/scripting/LevelScripts.ts:38](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/scripting/LevelScripts.ts#L38)

##### watchdog

> `readonly` **watchdog**: [`ScriptWatchdogConfig`](https://jsprismarine.dev/api/@jsprismarine/prismarine/config/Config/index.md#scriptwatchdogconfig)

Defined in: [packages/prismarine/src/scripting/LevelScripts.ts:55](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/scripting/LevelScripts.ts#L55)

***

### ScriptPhaseWorld

Defined in: [packages/prismarine/src/scripting/LevelScripts.ts:93](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/scripting/LevelScripts.ts#L93)

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

#### Methods

##### setScriptPhase()

> **setScriptPhase**(`phase`, `replacing?`): `void`

Defined in: [packages/prismarine/src/scripting/LevelScripts.ts:95](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/scripting/LevelScripts.ts#L95)

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

###### Parameters

###### phase

(() => `void`) \| `undefined`

###### replacing?

() => `void`

###### Returns

`void`
