Skip to content
On this page

Athena.systems.storage

Interfaces

Functions

closeOnDisconnect

Usage

Athena.systems.storage.closeOnDisconnect(player, id): boolean

Marks the storage instance as closed if the player disconnects.

Automatically removes the player when removeAsOpen is called.

Returns false if a player binding is already present.

Parameters

NameTypeDescription
playerPlayerAn alt:V Player Entity
idstring

Returns

boolean

Defined in

server/systems/storage.ts:178


create

Usage

Athena.systems.storage.create(items): Promise<string>

Creates a new storage, and returns the '_id' of the storage from the database.

Use the ID returned to fetch the data with the other storage functions.

Parameters

NameType
itemsStoredItem[]

Returns

Promise<string>

Defined in

server/systems/storage.ts:42


get

Usage

Athena.systems.storage.get<CustomData>(id): Promise<player<CustomData>[]>

Fetches stored items from a storage array.

Type parameters

NameType
CustomData{}

Parameters

NameType
idstring

Returns

Promise<player<CustomData>[]>

Defined in

server/systems/storage.ts:80


isOpen

Usage

Athena.systems.storage.isOpen(id): boolean

Checks if a storage identifier is currently in use.

Parameters

NameType
idstring

Returns

boolean

Defined in

server/systems/storage.ts:124


override

Usage

Athena.systems.storage.override(functionName, callback): any

Used to override storage functions.

Parameters

NameType
functionName"create"
callback(items: StoredItem[]) => Promise<string>

Returns

any

Defined in

server/systems/storage.ts:215

Usage

Athena.systems.storage.override(functionName, callback): any

Used to override storage functions.

Parameters

NameType
functionName"set"
callback(id: string, items: StoredItem[]) => Promise<boolean>

Returns

any

Defined in

server/systems/storage.ts:216

Usage

Athena.systems.storage.override(functionName, callback): any

Used to override storage functions.

Parameters

NameType
functionName"get"
callback<CustomData>(id: string) => Promise<player<CustomData>[]>

Returns

any

Defined in

server/systems/storage.ts:217

Usage

Athena.systems.storage.override(functionName, callback): any

Used to override storage functions.

Parameters

NameType
functionName"setAsOpen"
callback(id: string) => boolean

Returns

any

Defined in

server/systems/storage.ts:218

Usage

Athena.systems.storage.override(functionName, callback): any

Used to override storage functions.

Parameters

NameType
functionName"isOpen"
callback(id: string) => boolean

Returns

any

Defined in

server/systems/storage.ts:219

Usage

Athena.systems.storage.override(functionName, callback): any

Used to override storage functions.

Parameters

NameType
functionName"removeAsOpen"
callback(id: string) => boolean

Returns

any

Defined in

server/systems/storage.ts:220

Usage

Athena.systems.storage.override(functionName, callback): any

Used to override storage functions.

Parameters

NameType
functionName"closeOnDisconnect"
callback(player: Player, id: string) => boolean

Returns

any

Defined in

server/systems/storage.ts:221


removeAsOpen

Usage

Athena.systems.storage.removeAsOpen(id): boolean

Removes the storage identifier from in-use status.

Returns true if the value was successfully removed.

Parameters

NameType
idstring

Returns

boolean

Defined in

server/systems/storage.ts:141


set

Usage

Athena.systems.storage.set(id, items): Promise<boolean>

Stores items into a database instance by providing the storage identifier, and the modified items array.

Parameters

NameType
idstring
itemsStoredItem[]

Returns

Promise<boolean>

Defined in

server/systems/storage.ts:64


setAsOpen

Usage

Athena.systems.storage.setAsOpen(id): boolean

Sets a storage identifier as in use.

Returns true if the value was set to in-use, and didn't already exist.

Parameters

NameType
idstring

Returns

boolean

Defined in

server/systems/storage.ts:103

Created by Stuyk | Est. 2020