Skip to content

API reference / @jsprismarine/script-host / host/jsprismarineMembers

host/jsprismarineMembers ​

Classes ​

Interfaces ​

JsprismarineServerMembers ​

Defined in: script-host/src/host/jsprismarineMembers.ts:125

What @jsprismarine/server's members that reach the running server read and show. Players are named by their entity ids, as ScriptWorld.players lists them. Boss bars are named by an id the runtime gives each bar, which no other bar of the runtime has, a reload included.

Properties ​

levels? ​

readonly optional levels?: ScriptLevelMembers

Defined in: script-host/src/host/jsprismarineMembers.ts:129

The server's levels. Without it the module leaves levels out.

permissions? ​

readonly optional permissions?: ScriptPermissionMembers

Defined in: script-host/src/host/jsprismarineMembers.ts:127

The permission files. Without it the module leaves permissions out, as an older server would.

serverList? ​

readonly optional serverList?: ScriptServerListMembers

Defined in: script-host/src/host/jsprismarineMembers.ts:131

What a server list shows. Without it the module leaves serverList out.

Methods ​

hideBossBar() ​

hideBossBar(player, bar): void

Defined in: script-host/src/host/jsprismarineMembers.ts:141

Takes a bar off a player's screen.

Parameters ​
player ​

string

bar ​

number

Returns ​

void

performance() ​

performance(): ScriptPerformance

Defined in: script-host/src/host/jsprismarineMembers.ts:133

How fast the server ticks right now.

Returns ​

ScriptPerformance

ping() ​

ping(player): number | undefined

Defined in: script-host/src/host/jsprismarineMembers.ts:135

A player's round trip time in milliseconds, or undefined while there is no sample.

Parameters ​
player ​

string

Returns ​

number | undefined

resetPlayerListName() ​

resetPlayerListName(player): void

Defined in: script-host/src/host/jsprismarineMembers.ts:145

Gives a player's player list entry its login name back.

Parameters ​
player ​

string

Returns ​

void

setPlayerListName() ​

setPlayerListName(player, name): void

Defined in: script-host/src/host/jsprismarineMembers.ts:143

Changes the name every client's player list shows for a player.

Parameters ​
player ​

string

name ​

string

Returns ​

void

showBossBar() ​

showBossBar(player, bar, state): void

Defined in: script-host/src/host/jsprismarineMembers.ts:137

Puts a new bar on a player's screen, in front of the bars they already see.

Parameters ​
player ​

string

bar ​

number

state ​

ScriptBossBarState

Returns ​

void

updateBossBar() ​

updateBossBar(player, bar, state): void

Defined in: script-host/src/host/jsprismarineMembers.ts:139

Changes what a bar on a player's screen shows, where it is.

Parameters ​
player ​

string

bar ​

number

state ​

ScriptBossBarState

Returns ​

void


ScriptBossBarState ​

Defined in: script-host/src/host/jsprismarineMembers.ts:26

What one boss bar shows.

Properties ​

color ​

readonly color: "blue" | "green" | "red" | "pink" | "yellow" | "purple" | "rebeccaPurple" | "white"

Defined in: script-host/src/host/jsprismarineMembers.ts:30

progress ​

readonly progress: number

Defined in: script-host/src/host/jsprismarineMembers.ts:29

From 0 to 1.

text ​

readonly text: string

Defined in: script-host/src/host/jsprismarineMembers.ts:27


ScriptLevelInfo ​

Defined in: script-host/src/host/jsprismarineMembers.ts:91

One level, as levels in @jsprismarine/server gives it.

Properties ​

attached ​

readonly attached: boolean

Defined in: script-host/src/host/jsprismarineMembers.ts:94

entry ​

readonly entry: boolean

Defined in: script-host/src/host/jsprismarineMembers.ts:96

Whether players join the server in it.

id ​

readonly id: string

Defined in: script-host/src/host/jsprismarineMembers.ts:92

name ​

readonly name: string

Defined in: script-host/src/host/jsprismarineMembers.ts:93

players ​

readonly players: readonly string[]

Defined in: script-host/src/host/jsprismarineMembers.ts:98

The names of the players in it.


ScriptLevelMembers ​

Defined in: script-host/src/host/jsprismarineMembers.ts:106

What levels in @jsprismarine/server reads and changes of the server's levels, for the runtime of one level. A level is named by its name or its UUID, and players by their entity ids. The operations that take a while answer a promise, which rejects with a message for a script.

Methods ​

attach() ​

attach(level): Promise<ScriptLevelInfo>

Defined in: script-host/src/host/jsprismarineMembers.ts:116

Parameters ​
level ​

string

Returns ​

Promise<ScriptLevelInfo>

create() ​

create(name, preset, seed): Promise<ScriptLevelInfo>

Defined in: script-host/src/host/jsprismarineMembers.ts:115

Parameters ​
name ​

string

preset ​

string | undefined

seed ​

string | undefined

Returns ​

Promise<ScriptLevelInfo>

current() ​

current(): ScriptLevelInfo

Defined in: script-host/src/host/jsprismarineMembers.ts:108

The level the runtime's packs run in.

Returns ​

ScriptLevelInfo

detach() ​

detach(level): Promise<void>

Defined in: script-host/src/host/jsprismarineMembers.ts:117

Parameters ​
level ​

string

Returns ​

Promise<void>

levelOf() ​

levelOf(player): ScriptLevelInfo | undefined

Defined in: script-host/src/host/jsprismarineMembers.ts:112

The level a player is in, or undefined for a player who left.

Parameters ​
player ​

string

Returns ​

ScriptLevelInfo | undefined

list() ​

list(): readonly ScriptLevelInfo[]

Defined in: script-host/src/host/jsprismarineMembers.ts:110

Every level, the attached ones first.

Returns ​

readonly ScriptLevelInfo[]

transfer() ​

transfer(player, level, toSpawn): Promise<boolean>

Defined in: script-host/src/host/jsprismarineMembers.ts:114

Moves a player to an attached level.

Parameters ​
player ​

string

level ​

string

toSpawn ​

boolean

Returns ​

Promise<boolean>

Whether the move landed.


ScriptPermissionMembers ​

Defined in: script-host/src/host/jsprismarineMembers.ts:46

What permissions in @jsprismarine/server reads and writes of the server's permission files. Players are named by their entity ids and groups by their names. A write persists on the server's own schedule; a bad argument throws before anything is written.

Methods ​

addToGroup() ​

addToGroup(player, group, expires?): void

Defined in: script-host/src/host/jsprismarineMembers.ts:61

Parameters ​
player ​

string

group ​

string

expires? ​

string

Returns ​

void

Throws ​

For a malformed expiry, a group the file lacks, or a player who left.

grant() ​

grant(player, node, expires?): void

Defined in: script-host/src/host/jsprismarineMembers.ts:55

Parameters ​
player ​

string

node ​

string

expires? ​

string

Returns ​

void

Throws ​

For a malformed node or expiry, or a player who left.

grantToGroup() ​

grantToGroup(group, node, expires?): void

Defined in: script-host/src/host/jsprismarineMembers.ts:58

Parameters ​
group ​

string

node ​

string

expires? ​

string

Returns ​

void

Throws ​

For a malformed node or expiry, or a group the file lacks.

groupsOf() ​

groupsOf(player): readonly string[]

Defined in: script-host/src/host/jsprismarineMembers.ts:49

The groups the player holds directly, heaviest first.

Parameters ​
player ​

string

Returns ​

readonly string[]

has() ​

has(player, node): boolean

Defined in: script-host/src/host/jsprismarineMembers.ts:47

Parameters ​
player ​

string

node ​

string

Returns ​

boolean

metaOf() ​

metaOf(player, key): string | undefined

Defined in: script-host/src/host/jsprismarineMembers.ts:51

Parameters ​
player ​

string

key ​

string

Returns ​

string | undefined

onChange() ​

onChange(listener): () => void

Defined in: script-host/src/host/jsprismarineMembers.ts:64

Hears of every change, however it was made.

Parameters ​
listener ​

(change) => void

Returns ​

A function that stops listening.

() => void

primaryGroupOf() ​

primaryGroupOf(player): string

Defined in: script-host/src/host/jsprismarineMembers.ts:50

Parameters ​
player ​

string

Returns ​

string

removeFromGroup() ​

removeFromGroup(player, group): void

Defined in: script-host/src/host/jsprismarineMembers.ts:62

Parameters ​
player ​

string

group ​

string

Returns ​

void

revoke() ​

revoke(player, node): void

Defined in: script-host/src/host/jsprismarineMembers.ts:56

Parameters ​
player ​

string

node ​

string

Returns ​

void

revokeFromGroup() ​

revokeFromGroup(group, node): void

Defined in: script-host/src/host/jsprismarineMembers.ts:59

Parameters ​
group ​

string

node ​

string

Returns ​

void

weightOf() ​

weightOf(player): number

Defined in: script-host/src/host/jsprismarineMembers.ts:53

The weight of the player's primary group.

Parameters ​
player ​

string

Returns ​

number


ScriptPermissionsChange ​

Defined in: script-host/src/host/jsprismarineMembers.ts:37

A permission change. target is absent after the files were read again, which may have changed anything.

Properties ​

target? ​

readonly optional target?: ScriptPermissionsTarget

Defined in: script-host/src/host/jsprismarineMembers.ts:38


ScriptServerListMembers ​

Defined in: script-host/src/host/jsprismarineMembers.ts:81

What serverList in @jsprismarine/server reads and changes of the status every transport advertises. Each change belongs to an owner, one pack's scripts, and the owner that changed a field last shows.

Methods ​

current() ​

current(): ScriptServerListStatus

Defined in: script-host/src/host/jsprismarineMembers.ts:83

What the list shows now.

Returns ​

ScriptServerListStatus

reset() ​

reset(owner): void

Defined in: script-host/src/host/jsprismarineMembers.ts:87

Takes every change an owner made back.

Parameters ​
owner ​

object

Returns ​

void

update() ​

update(owner, fields): void

Defined in: script-host/src/host/jsprismarineMembers.ts:85

Layers an owner's changes over the status, merged with its earlier ones.

Parameters ​
owner ​

object

fields ​

Partial<ScriptServerListStatus>

Returns ​

void


ScriptServerListStatus ​

Defined in: script-host/src/host/jsprismarineMembers.ts:68

What a server list shows of the server, as serverList in @jsprismarine/server reads it.

Properties ​

levelName ​

readonly levelName: string

Defined in: script-host/src/host/jsprismarineMembers.ts:71

The second name, below the MOTD.

maxPlayers ​

readonly maxPlayers: number

Defined in: script-host/src/host/jsprismarineMembers.ts:73

motd ​

readonly motd: string

Defined in: script-host/src/host/jsprismarineMembers.ts:69

onlinePlayers ​

readonly onlinePlayers: number

Defined in: script-host/src/host/jsprismarineMembers.ts:72

Type Aliases ​

PerformanceProperties ​

PerformanceProperties = typeof JSPRISMARINE_SERVER["performance"]["properties"]

Defined in: script-host/src/host/jsprismarineMembers.ts:16

The properties the performance member of @jsprismarine/server declares.


ScriptPerformance ​

ScriptPerformance = { readonly [Key in keyof PerformanceProperties]: PerformanceProperties[Key]["type"] extends "numbers" ? readonly number[] : number }

Defined in: script-host/src/host/jsprismarineMembers.ts:19

How fast the server ticks, with a value for each property performance declares.


ScriptPermissionsTarget ​

ScriptPermissionsTarget = { group: string; } | { name: string; player?: string; }

Defined in: script-host/src/host/jsprismarineMembers.ts:34

What a permission change touched: a group by name, or a user by the name their record shows and their entity id while online.

Variables ​

SERVER_PLACEHOLDER_OWNER ​

const SERVER_PLACEHOLDER_OWNER: object

Defined in: script-host/src/host/jsprismarineMembers.ts:149

The owner of the namespaces the server registers, such as perms, which outlive a reload.

Type Declaration ​

name ​

name: string = 'JSPrismarine'

Functions ​

bossBarOptions() ​

bossBarOptions(engine, value, member): Partial<ScriptBossBarState>

Defined in: script-host/src/host/jsprismarineMembers.ts:171

The properties a pack passed as BossBarOptions, checked. A property it leaves out is absent.

Parameters ​

engine ​

ScriptEngine

value ​

ScriptValue

member ​

string

The member the pack called, which an error names.

Returns ​

Partial<ScriptBossBarState>

Throws ​

When the options are not an object, or a property is not of its type.


serverListOptions() ​

serverListOptions(engine, value, member): Partial<ScriptServerListStatus>

Defined in: script-host/src/host/jsprismarineMembers.ts:211

The changes a pack's serverList.update options ask for, checked.

Parameters ​

engine ​

ScriptEngine

value ​

ScriptValue

member ​

string

Returns ​

Partial<ScriptServerListStatus>

Throws ​

JspModuleArgument for options that are not an object, a name that is not a string or holds a ;, or a count that is not a whole number from 0 to MAX_COUNT.