Language

WhatsUp

WhatsUp

Modrinth

Allows datapacks to query external APIs and run functions based on the result

1.3k downloads 6 followers updated 34mo ago
latest v1.2.0 Modrinth
Forge Quilt 1.19.4 – 1.20.1 LibraryManagementUtility

WhatsUp

Quilt version requires: QSL and GroovyDuvet

Forge version requires: GML

WhatsUp is a tool for datapacks that allows servers to query a provided web endpoint at a given frequency, and execute
functions (the normal .mcfunction type) based on the results returned by that endpoint.

WhatsUp defines both listeners and predicates. listeners are defined at data/<namespace>/whatsup/listeners/<name>.json,
and take the following structure:

  • endpoint - The URL to be queried by the listener
  • frequency - An integer representing how many seconds should pass between queries of the endpoint
  • actions - A list of actions to do based on the returned result of the endpoint. Each takes the following form:
    • predicate - The resource location of a predicate to check against the endpoint's result
    • function - The resource location of a function to execute if the predicate passes
    • levels - (Optional; defaults to ["overworld"]) A list of dimensions to run the provided function in
    • then - (Optional) a list of locations of other listeners to chain after this listener
    • storage - (Optional) a map of property names to resource locations specifying command data storage that the predicate has access to

Predicates are stored at data/<namespace>/whatsup/predicates/<name>.groovy, and are groovy scripts. The groovy environment
the predicates run in has access to the context variable, which has the following properties:

  • text - The unprocessed response text
  • json - The a Map of the response parsed as JSON, or null if the response is not a JSON object
  • storage - Contains a property for every command data storage specified in the action; data storages can be queried and mutated.
    This context object is also available as the delegate of the script, so a leading context. to access these properties is optional.

An example datapack can be found on the GitHub releases.

The mod also provides the /whatsup command for easily testing datapacks; this can be used to run any listener immediately.

Versions

Release
1.2.0
forge · 1.20.1 · 34mo ago
No changelog was specified.
148
Release
1.2.0
quilt · 1.20.1 · 34mo ago
No changelog was specified.
132
Release
1.1.0
forge · 1.20.1 · 36mo ago
No changelog was specified.
122
Release
1.1.0
quilt · 1.20.1 · 36mo ago
No changelog was specified.
108
Release
1.0.0
quilt · 1.19.4 · 36mo ago
No changelog was specified.
113
Release
1.0.0
forge · 1.19.4 · 36mo ago
No changelog was specified.
136
Release
0.1.2
quilt · 1.19.4 · 36mo ago
No changelog was specified.
92
Release
0.1.2
forge · 1.19.4 · 36mo ago
No changelog was specified.
103
Release
0.1.1
quilt · 1.19.4 · 36mo ago
No changelog was specified.
93
Release
0.1.1
forge · 1.19.4 · 36mo ago
No changelog was specified.
108
Release
0.1.0
quilt · 1.19.4 · 36mo ago
No changelog was specified.
104
Release
0.1.0
forge · 1.19.4 · 36mo ago
No changelog was specified.
102

Comments 0

No comments yet. Be the first to share your thoughts.