WhatsUp
Quilt 版本需要:QSL 和 GroovyDuvet
Forge 版本需要:GML
WhatsUp 是一个用于数据包的工具,允许服务器以指定的频率查询提供的 Web 端点,并根据该端点返回的结果执行函数(标准的 .mcfunction 类型)。
WhatsUp 定义了 listeners 和 predicates。listeners 定义在 data/<namespace>/whatsup/listeners/<name>.json 中,其结构如下:
endpoint- 监听器要查询的 URLfrequency- 一个整数,表示两次查询端点之间应经过的秒数actions- 基于端点返回结果要执行的操作列表。每个操作具有以下形式:predicate- 用于检查端点结果的谓词的资源位置function- 如果谓词检查通过,则要执行的函数的资源位置levels- (可选;默认为["overworld"])在其中运行所提供函数的维度列表then- (可选)在此监听器之后链接的其他监听器的位置列表storage- (可选)属性名称到资源位置的映射,指定谓词可访问的命令数据存储
谓词存储在 data/<namespace>/whatsup/predicates/<name>.groovy 中,是 Groovy 脚本。谓词运行的 Groovy 环境可以访问 context 变量,该变量具有以下属性:
text- 未处理的响应文本json- 将响应解析为 JSON 的 Map,如果响应不是 JSON 对象则为nullstorage- 包含在操作中指定的每个命令数据存储的属性;可以查询和修改数据存储。此上下文对象也可作为脚本的委托,因此访问这些属性时前缀context.是可选的。
示例数据包可在 GitHub releases 找到。
该模组还提供了 /whatsup 命令,以便轻松测试数据包;可用于立即运行任何监听器。
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 listenerfrequency- An integer representing how many seconds should pass between queries of the endpointactions- 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 resultfunction- The resource location of a function to execute if the predicate passeslevels- (Optional; defaults to["overworld"]) A list of dimensions to run the provided function inthen- (Optional) a list of locations of other listeners to chain after this listenerstorage- (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 textjson- The a Map of the response parsed as JSON, ornullif the response is not a JSON objectstorage- 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 leadingcontext.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.
下载 WhatsUp
下载 WhatsUp
下载 WhatsUp
下载 WhatsUp
下载 WhatsUp
下载 WhatsUp
下载 WhatsUp
下载 WhatsUp
下载 WhatsUp
下载 WhatsUp
未指定更新日志。
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
一个用于收集生物掉落物的多区块模组。
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
查看物品与配方
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
AE2:一款流行的自动化与存储模组
评论 0
登录后参与评分
还没有评论,来抢沙发吧