From 26aac237bf5d8b2f4763dc4183fa9aba4b22b160 Mon Sep 17 00:00:00 2001 From: Nathan Glover Date: Thu, 8 Mar 2018 21:13:10 -0500 Subject: [PATCH] Started storing data section --- Advanced-Scripts.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Advanced-Scripts.md b/Advanced-Scripts.md index 41e1422..e0410e9 100644 --- a/Advanced-Scripts.md +++ b/Advanced-Scripts.md @@ -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". \ No newline at end of file +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` 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 \ No newline at end of file