Athena.session.player ​
Functions ​
clearAll ​
Usage
Athena.session.player.clearAll(player
): void
Clear all keys, and remove all data for a session.
Export
Parameters ​
Name | Type |
---|---|
player | Player |
Returns ​
void
Defined in ​
clearKey ​
Usage
Athena.session.player.clearKey(player
, key
): void
Clear a key from the player.
Export
Parameters ​
Name | Type |
---|---|
player | any |
key | keyof Player |
Returns ​
void
Defined in ​
get ​
Usage
Athena.session.player.get<K
>(player
, key
): AthenaSession.Player
[K
] | undefined
Retrieve data from a player's session storage.
Type parameters ​
Name | Type |
---|---|
K | extends keyof Player |
Parameters ​
Name | Type | Description |
---|---|---|
player | Player | |
key | K | The value you want to get from the player. |
Returns ​
AthenaSession.Player
[K
] | undefined
Defined in ​
getAll ​
Usage
Athena.session.player.getAll<K
>(key
): AthenaSession.Player
[K
][]
Get all player's that have a specific key.
Export
Type parameters ​
Name | Type |
---|---|
K | extends keyof Player |
Parameters ​
Name | Type |
---|---|
key | K |
Returns ​
AthenaSession.Player
[K
][]
Defined in ​
has ​
Usage
Athena.session.player.has(player
, key
): boolean
Returns true, if it has any value set for a given key.
Export
Parameters ​
Name | Type |
---|---|
player | Player |
key | keyof Player |
Returns ​
boolean
Defined in ​
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 ​
declare global {
namespace AthenaSession {
export interface Player {
myCustomValue: boolean;
}
}
}
Athena.session.player.set(somePlayer, 'myCustomValue', true);
Type parameters ​
Name | Type |
---|---|
K | extends keyof Player |
Parameters ​
Name | Type | Description |
---|---|---|
player | Player | |
key | keyof Player | The key you want to put the value under |
value | Player [K ] | The value you want to set |
Returns ​
void