Started storing data section

Nathan Glover 2018-03-08 21:13:10 -05:00
parent dde586999f
commit 26aac237bf

@ -70,4 +70,21 @@ function getMotd() {
getMotd();
```
Produces: ![server-info-example-picture](https://i.imgur.com/6yxjpsV.png) when the server's MOTD is "A Minecraft Server".
Produces: ![server-info-example-picture](https://i.imgur.com/6yxjpsV.png) 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