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 ​
| Name | Type | Description |
|---|---|---|
player | Player | An alt:V Player Entity |
id | string |
Returns ​
boolean
Defined in ​
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 ​
| Name | Type |
|---|---|
items | StoredItem[] |
Returns ​
Promise<string>
Defined in ​
get ​
Usage
Athena.systems.storage.get<CustomData>(id): Promise<player<CustomData>[]>
Fetches stored items from a storage array.
Type parameters ​
| Name | Type |
|---|---|
CustomData | {} |
Parameters ​
| Name | Type |
|---|---|
id | string |
Returns ​
Promise<player<CustomData>[]>
Defined in ​
isOpen ​
Usage
Athena.systems.storage.isOpen(id): boolean
Checks if a storage identifier is currently in use.
Parameters ​
| Name | Type |
|---|---|
id | string |
Returns ​
boolean
Defined in ​
override ​
Usage
Athena.systems.storage.override(functionName, callback): any
Used to override storage functions.
Parameters ​
| Name | Type |
|---|---|
functionName | "create" |
callback | (items: StoredItem[]) => Promise<string> |
Returns ​
any
Defined in ​
Usage
Athena.systems.storage.override(functionName, callback): any
Used to override storage functions.
Parameters ​
| Name | Type |
|---|---|
functionName | "set" |
callback | (id: string, items: StoredItem[]) => Promise<boolean> |
Returns ​
any
Defined in ​
Usage
Athena.systems.storage.override(functionName, callback): any
Used to override storage functions.
Parameters ​
| Name | Type |
|---|---|
functionName | "get" |
callback | <CustomData>(id: string) => Promise<player<CustomData>[]> |
Returns ​
any
Defined in ​
Usage
Athena.systems.storage.override(functionName, callback): any
Used to override storage functions.
Parameters ​
| Name | Type |
|---|---|
functionName | "setAsOpen" |
callback | (id: string) => boolean |
Returns ​
any
Defined in ​
Usage
Athena.systems.storage.override(functionName, callback): any
Used to override storage functions.
Parameters ​
| Name | Type |
|---|---|
functionName | "isOpen" |
callback | (id: string) => boolean |
Returns ​
any
Defined in ​
Usage
Athena.systems.storage.override(functionName, callback): any
Used to override storage functions.
Parameters ​
| Name | Type |
|---|---|
functionName | "removeAsOpen" |
callback | (id: string) => boolean |
Returns ​
any
Defined in ​
Usage
Athena.systems.storage.override(functionName, callback): any
Used to override storage functions.
Parameters ​
| Name | Type |
|---|---|
functionName | "closeOnDisconnect" |
callback | (player: Player, id: string) => boolean |
Returns ​
any
Defined in ​
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 ​
| Name | Type |
|---|---|
id | string |
Returns ​
boolean
Defined in ​
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 ​
| Name | Type |
|---|---|
id | string |
items | StoredItem[] |
Returns ​
Promise<boolean>
Defined in ​
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 ​
| Name | Type |
|---|---|
id | string |
Returns ​
boolean
V5 Docs