Skip to content
On this page

Athena.session.player

Functions

clearAll

Usage

Athena.session.player.clearAll(player): void

Clear all keys, and remove all data for a session.

Export

Parameters

NameType
playerPlayer

Returns

void

Defined in

server/session/player.ts:122


clearKey

Usage

Athena.session.player.clearKey(player, key): void

Clear a key from the player.

Export

Parameters

NameType
playerany
keykeyof Player

Returns

void

Defined in

server/session/player.ts:100


get

Usage

Athena.session.player.get<K>(player, key): AthenaSession.Player[K] | undefined

Retrieve data from a player's session storage.

Type parameters

NameType
Kextends keyof Player

Parameters

NameTypeDescription
playerPlayer
keyKThe value you want to get from the player.

Returns

AthenaSession.Player[K] | undefined

Defined in

server/session/player.ts:59


getAll

Usage

Athena.session.player.getAll<K>(key): AthenaSession.Player[K][]

Get all player's that have a specific key.

Export

Type parameters

NameType
Kextends keyof Player

Parameters

NameType
keyK

Returns

AthenaSession.Player[K][]

Defined in

server/session/player.ts:148


has

Usage

Athena.session.player.has(player, key): boolean

Returns true, if it has any value set for a given key.

Export

Parameters

NameType
playerPlayer
keykeyof Player

Returns

boolean

Defined in

server/session/player.ts:81


set

Usage

Athena.session.player.set<K>(player, key, value): void

Set data for a player's session

This data is not persistent, and automatically clears on disconnect / player destroy

Example

ts
declare global {
    namespace AthenaSession {
        export interface Player {
            myCustomValue: boolean;
        }
    }
}

Athena.session.player.set(somePlayer, 'myCustomValue', true);

Type parameters

NameType
Kextends keyof Player

Parameters

NameTypeDescription
playerPlayer
keykeyof PlayerThe key you want to put the value under
valuePlayer[K]The value you want to set

Returns

void

Defined in

server/session/player.ts:36

Created by Stuyk | Est. 2020