WhatsUp
The Quilt version requires: QSL and GroovyDuvet
The Forge version requires: GML
WhatsUp is a specialized tool for datapacks that enables servers to periodically query specified web endpoints and execute functions (of the standard .mcfunction type) based on the received results.
The mod introduces two main concepts: listeners and predicates. Listeners are defined in files at data/<namespace>/whatsup/listeners/<name>.json and have the following structure:
endpoint- URL address that will be queried by the listenerfrequency- integer defining the interval in seconds between endpoint queriesactions- list of actions performed based on the endpoint response. Each action contains:predicate- predicate identifier for checking the query resultfunction- function identifier that will execute if the predicate check succeedslevels- (optional parameter; default ["overworld"]) list of dimensions where the specified function will runthen- (optional) list of other listeners for sequential executionstorage- (optional) mapping of property names to command data storages available to the predicate
Predicates are located in files at data/<namespace>/whatsup/predicates/<name>.groovy and represent Groovy scripts. In the Groovy execution environment, predicates have access to the context variable containing the following properties:
text- unprocessed response textjson- Map with response data in JSON format, ornullif the response is not a JSON objectstorage- contains properties for each data storage specified in the action; storages can be queried and modified
A working datapack example is available in the GitHub releases.
The mod also provides the /whatsup command for convenient datapack testing - it allows immediate execution of any listener.