Skip to content

API reference / @jsprismarine/prismarine / network/playerListEntry

network/playerListEntry ​

Interfaces ​

ListedPlayer ​

Defined in: packages/prismarine/src/network/playerListEntry.ts:26

A player as every client's player list shows it, which is how every other client learns its name, its skin and the platform it plays on before it ever comes into view.

Properties ​

buildPlatform ​

readonly buildPlatform: number

Defined in: packages/prismarine/src/network/playerListEntry.ts:34

The platform the player plays on, as shownBuildPlatformOf names it.

name ​

readonly name: string

Defined in: packages/prismarine/src/network/playerListEntry.ts:30

The name the list shows, the login name unless a script set another.

platformChatId ​

readonly platformChatId: string

Defined in: packages/prismarine/src/network/playerListEntry.ts:32

runtimeId ​

readonly runtimeId: bigint

Defined in: packages/prismarine/src/network/playerListEntry.ts:28

skin ​

readonly skin: Skin

Defined in: packages/prismarine/src/network/playerListEntry.ts:35

uuid ​

readonly uuid: UUIDValue

Defined in: packages/prismarine/src/network/playerListEntry.ts:27

xuid ​

readonly xuid: string

Defined in: packages/prismarine/src/network/playerListEntry.ts:31

Functions ​

listedPlayerOf() ​

listedPlayerOf(player, name?): ListedPlayer

Defined in: packages/prismarine/src/network/playerListEntry.ts:44

A player's entry in the player list.

Parameters ​

player ​

ShownPlayer

The player to list. Its skin is required: the login handshake always sends one.

name? ​

string = ...

The name the list shows, the login name unless a script set another.

Returns ​

ListedPlayer

The entry.


setPlayerListName() ​

setPlayerListName(list, broadcast, player, uuid, name?): Promise<void>

Defined in: packages/prismarine/src/network/playerListEntry.ts:67

Replaces the name a player's entry shows: in the session manager's list, which a later joiner is sent, and on every client. A client keeps the entry it has for a UUID it already lists, so each gets a Remove for the entry and then an Add with the entry the list holds once the Remove has gone: the one built here, or a newer one a skin change or a later rename put there since, so the Add never lists what is no longer current. A player without an entry, who has not joined yet or who left while the Remove was on its way, is left alone.

Parameters ​

list ​

Map<string, ListedPlayer>

The session manager's entries, by the UUID string the session's identity holds.

broadcast ​

(packet) => Promise<void>

Sends a packet to every session.

player ​

ShownPlayer

The player whose entry changes.

uuid ​

string

The player's key in the list.

name? ​

string

The name to show, or the login name when left out.

Returns ​

Promise<void>


shownBuildPlatformOf() ​

shownBuildPlatformOf(device): number

Defined in: packages/prismarine/src/network/playerListEntry.ts:19

The platform a Bedrock client is told another player plays on: the one its own client reported, or Windows for a player with no Bedrock client, such as a Java Edition player.

Every Bedrock player reports a platform, so the only players ever sent UNKNOWN (-1) were Java players, and a Bedrock client then drew their nametag only while looking at them, where it draws every other player's always. Naming a platform makes it show them the way it shows any Bedrock player.

Parameters ​

device ​

{ os: number; } | null | undefined

The device the player's own client reported, if it reported one.

Returns ​

number