Skip to content

@pumpkin-plugins/apple-skin-pumpkin API / sync / SyncTracker

Class: SyncTracker ​

Defined in: packages/apple-skin-pumpkin/src/sync.ts:27

Remembers what each player was last sent, so a tick where nothing moved costs no packets. A player is keyed by the id the host adapter derives from their UUID, and forgetting one is what makes their next tick send both values again.

Accessors ​

size ​

Get Signature ​

get size(): number

Defined in: packages/apple-skin-pumpkin/src/sync.ts:81

How many players are being tracked.

Returns ​

number

Methods ​

forget() ​

forget(id): void

Defined in: packages/apple-skin-pumpkin/src/sync.ts:68

Forgets a player, so their values are sent again the next time they are read.

Parameters ​

id ​

string

The player's id.

Returns ​

void


retain() ​

retain(online): void

Defined in: packages/apple-skin-pumpkin/src/sync.ts:76

Drops the players who are no longer online, for the times no leave event reaches us.

Parameters ​

online ​

ReadonlySet<string>

The ids of the players on the server right now.

Returns ​

void


update() ​

update(id, saturation, exhaustion): SyncUpdate

Defined in: packages/apple-skin-pumpkin/src/sync.ts:37

Records a player's values and reports the ones worth sending.

Parameters ​

id ​

string

The player's id.

saturation ​

number

The player's saturation level now.

exhaustion ​

number

The player's exhaustion level now.

Returns ​

SyncUpdate

The values to send, which is nothing when neither has moved far enough.

Pumpkin Plugins documentation