mirror of
https://github.com/PlaceholderAPI/Javascript-Expansion.git
synced 2025-05-23 18:42:44 +00:00
Started storing data section
parent
dde586999f
commit
26aac237bf
@ -70,4 +70,21 @@ function getMotd() {
|
||||
getMotd();
|
||||
```
|
||||
|
||||
Produces:  when the server's MOTD is "A Minecraft Server".
|
||||
Produces:  when the server's MOTD is "A Minecraft Server".
|
||||
|
||||
## Storing Data
|
||||
|
||||
Storing data from within the placeholder script is quite easy. When a placeholder script is called, a `Data` object is passed to it. Whenever the script modifies the object, it is modified in Javascript-Expansion as well, and then saved to a data file.
|
||||
|
||||
Here is an example script that...
|
||||
|
||||
**Valid Methods**:
|
||||
- `Data.getData()` returns a `Map<String, Object>` of the entire placeholder script's data.
|
||||
- `Data.clear()` removes all data.
|
||||
- `Data.exists(key)` returns true if a key exists; else false.
|
||||
- `Data.get(key)` returns the value stored under `key`.
|
||||
- `Data.remove(key)` removes a key from the data.
|
||||
- `Data.set(key, value)` stores a `value` under `key`.
|
||||
- `Data.isEmpty()` returns true if the data is empty; else false.
|
||||
|
||||
// IN PROGRESS
|
Loading…
x
Reference in New Issue
Block a user