Skip to content

API reference / @jsprismarine/prismarine / world/PlayerPersistence

world/PlayerPersistence ​

Classes ​

Interfaces ​

PlayerPersistenceOptions ​

Defined in: packages/prismarine/src/world/PlayerPersistence.ts:14

What the service needs from the level that owns it.

Properties ​

folder ​

readonly folder: string

Defined in: packages/prismarine/src/world/PlayerPersistence.ts:18

The level folder, which holds the fallback JSON records.

isClosed ​

readonly isClosed: () => boolean

Defined in: packages/prismarine/src/world/PlayerPersistence.ts:24

Whether the level has closed, after which nothing is written.

Returns ​

boolean

levelName ​

readonly levelName: string

Defined in: packages/prismarine/src/world/PlayerPersistence.ts:16

The level's name, for log lines and errors.

logger ​

readonly logger: () => Logger

Defined in: packages/prismarine/src/world/PlayerPersistence.ts:22

Where read and write failures are logged.

Returns ​

Logger

pendingCommit? ​

readonly optional pendingCommit?: () => Promise<void>

Defined in: packages/prismarine/src/world/PlayerPersistence.ts:30

Settles once a save pass whose cut is taken has committed. A record written to the fallback JSON while one is pending is written after it, so the older record the pass hands over once it commits never lands on top of it.

Returns ​

Promise<void>

provider ​

readonly provider: Pick<BaseProvider, "readPlayerData" | "writePlayerData">

Defined in: packages/prismarine/src/world/PlayerPersistence.ts:20

The level's provider, which stores records itself when it implements player storage.