diff --git a/DEVDOC.md b/DEVDOC.md index 71d64b4..0a3d6ce 100644 --- a/DEVDOC.md +++ b/DEVDOC.md @@ -2,6 +2,6 @@ 0. 提供各种工具,位于fz.admin命名空间下,包括 0. 细化版本管理,提供不同版本之间的升级函数,由`update_manager`控制。*务必仔细测试再发布,一旦升级无法降级!* 0. 反馈、警告、报错和调试由`logger`控制。分别对应四个类:`info`、`warn`、`error`、`debug` -0. 函数调用应尽可能使用标签! +0. 函数由两个以上的函数调用,或由不同包下的函数调用,或需要作为接口开放给下游数据包时,应改用标签调用! ### 如果需要修改计分板颜色 \ No newline at end of file diff --git a/data/fz/advancements/login.json b/data/fz/advancements/login.json index c427ede..af3301c 100644 --- a/data/fz/advancements/login.json +++ b/data/fz/advancements/login.json @@ -3,10 +3,24 @@ "login": { "trigger": "tick", "conditions": { - "player": { - "" - } + "player": [ + { + "condition": "minecraft:inverted", + "term": { + "condition": "minecraft:entity_scores", + "entity": "this", + "scores": { + "fz.event.leave_game": { + "max": 0 + } + } + } + } + ] } } + }, + "rewards": { + "function": "fz:event/on_login" } } \ No newline at end of file diff --git a/data/fz/advancements/unsneak.json b/data/fz/advancements/unsneak.json index 7ae31b0..ca5569b 100644 --- a/data/fz/advancements/unsneak.json +++ b/data/fz/advancements/unsneak.json @@ -1,15 +1,10 @@ { + "parent": "fz:sneak", "criteria": { "unsneak": { "trigger": "tick", "conditions": { "player": { - "type_specific": { - "type": "player", - "advancements": { - "fz:config/sneak": true - } - }, "flags": { "is_sneaking": false } diff --git a/data/fz/functions/event/on_login.mcfunction b/data/fz/functions/event/on_login.mcfunction index f3aa2bc..07cc38c 100644 --- a/data/fz/functions/event/on_login.mcfunction +++ b/data/fz/functions/event/on_login.mcfunction @@ -1,4 +1,8 @@ function #fz:event/on_login -scoreboard players reset @s fz.event.leave_game +## 复位其他触发器 +advancement revoke @s until fz:unsneak + +## 复位进度触发器 +scoreboard players set @s fz.event.leave_game 0 advancement revoke @s only fz:login \ No newline at end of file diff --git a/data/fz/functions/event/on_unsneak.mcfunction b/data/fz/functions/event/on_unsneak.mcfunction index 2d6d16b..9c70705 100644 --- a/data/fz/functions/event/on_unsneak.mcfunction +++ b/data/fz/functions/event/on_unsneak.mcfunction @@ -2,8 +2,7 @@ ##### 当玩家蹲起后触发此事件 function #fz:event/on_unsneak -execute if entity @s[y_rotation = 90] run function #fz:module/config/trigger +execute if entity @s[y_rotation = 90] run function #fz:event/config/on_trigger ## 复位进度触发器 -advancement revoke @s only fz:sneak -advancement revoke @s only fz:unsneak \ No newline at end of file +advancement revoke @s until fz:unsneak \ No newline at end of file diff --git a/data/fz/functions/install.mcfunction b/data/fz/functions/install.mcfunction index f1f735c..e1117d1 100644 --- a/data/fz/functions/install.mcfunction +++ b/data/fz/functions/install.mcfunction @@ -1,5 +1,6 @@ # 调用者:#fz:install +function #fz:event/install function #fz:logger/install ## 整数类型 diff --git a/data/fz/functions/module/config/on_click.mcfunction b/data/fz/functions/module/config/on_click.mcfunction index c3f4812..806a5b8 100644 --- a/data/fz/functions/module/config/on_click.mcfunction +++ b/data/fz/functions/module/config/on_click.mcfunction @@ -1,9 +1,10 @@ # 调用者:#fz:module/config/on_click ##### 处理玩家点击事件,并进行下一步操作 -execute if score @s fz.module.config.trigger matches 1000..1099 run function #fz:module/scoreboard/config/on_click +execute if score @s fz.module.config.trigger matches 1000..1999 run function #fz:module/scoreboard/config/on_click ## 重置玩家的触发器分数 +function #fz:module/config/reset_trigger ## 重新显示一次按钮 function #fz:module/config/display \ No newline at end of file diff --git a/data/fz/functions/module/config/reset_trigger.mcfunction b/data/fz/functions/module/config/reset_trigger.mcfunction new file mode 100644 index 0000000..022b95e --- /dev/null +++ b/data/fz/functions/module/config/reset_trigger.mcfunction @@ -0,0 +1,3 @@ +# 调用者:#fz:module/config/reset_trigger + +scoreboard players reset @s fz.module.config.trigger \ No newline at end of file diff --git a/data/fz/functions/module/scoreboard/config/display/buttons.mcfunction b/data/fz/functions/module/scoreboard/config/display/buttons.mcfunction index a1ba100..1e78957 100644 --- a/data/fz/functions/module/scoreboard/config/display/buttons.mcfunction +++ b/data/fz/functions/module/scoreboard/config/display/buttons.mcfunction @@ -1,3 +1,3 @@ # 调用者:#fz:module/scoreboard/config/display/buttons -tellraw @s [{"text": "- "}, {"text": "[关]", "color": "dark_red", "hoverEvent": {"action": "show_text", "contents": {"text": "关", "color": "dark_red"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1000"}}, {"text": "[总榜]", "color": "dark_aqua", "hoverEvent": {"action": "show_text", "contents": {"text": "总榜", "color": "dark_aqua"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1001"}}] \ No newline at end of file +tellraw @s [{"text": "- "}, {"text": "[关]", "color": "dark_red", "hoverEvent": {"action": "show_text", "contents": {"text": "关", "color": "dark_red"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1000"}}, {"text": "[总榜]", "color": "dark_aqua", "hoverEvent": {"action": "show_text", "contents": {"text": "总榜", "color": "dark_aqua"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1010"}}, {"text": "[活跃度]", "color": "aqua", "hoverEvent": {"action": "show_text", "contents": {"text": "活跃度", "color": "aqua"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1020"}}, {"text": "[飞行距离]", "color": "light_purple", "hoverEvent": {"action": "show_text", "contents": {"text": "飞行距离", "color": "light_purple"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1030"}}] \ No newline at end of file diff --git a/data/fz/functions/uninstall.mcfunction b/data/fz/functions/uninstall.mcfunction index 2d22df8..68b02e4 100644 --- a/data/fz/functions/uninstall.mcfunction +++ b/data/fz/functions/uninstall.mcfunction @@ -5,6 +5,8 @@ function #fz:module/uninstall ## 整数类型 scoreboard objectives remove fz.variable.integer +function #fz:event/uninstall + ## 卸载日志,为避免扩展数据包在卸载时无法使用日志,故延迟1tick卸载 schedule function #fz:logger/uninstall 1t replace diff --git a/data/fz/tags/functions/event/config/on_trigger.json b/data/fz/tags/functions/event/config/on_trigger.json new file mode 100644 index 0000000..fa110b1 --- /dev/null +++ b/data/fz/tags/functions/event/config/on_trigger.json @@ -0,0 +1,7 @@ +{ + "__comment": "调用者:fz:event/on_unsneak,当玩家抬头到最高角度并蹲起后,触发此事件", + "replace": false, + "values": [ + "#fz:module/config/trigger" + ] +} \ No newline at end of file diff --git a/data/fz/tags/functions/event/install.json b/data/fz/tags/functions/event/install.json new file mode 100644 index 0000000..d53b1c2 --- /dev/null +++ b/data/fz/tags/functions/event/install.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "fz:event/install" + ] +} \ No newline at end of file diff --git a/data/fz/tags/functions/event/on_login.json b/data/fz/tags/functions/event/on_login.json index e87d3c3..ed79e07 100644 --- a/data/fz/tags/functions/event/on_login.json +++ b/data/fz/tags/functions/event/on_login.json @@ -1,6 +1,6 @@ { "replace": false, "values": [ - "fz:module/config/reset_trigger" + "#fz:module/config/reset_trigger" ] } \ No newline at end of file diff --git a/data/fz/tags/functions/event/uninstall.json b/data/fz/tags/functions/event/uninstall.json new file mode 100644 index 0000000..96a9f4b --- /dev/null +++ b/data/fz/tags/functions/event/uninstall.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "fz:event/uninstall" + ] +} \ No newline at end of file diff --git a/data/fz/tags/functions/module/config/display.json b/data/fz/tags/functions/module/config/display.json index 4608aa1..d1ccef1 100644 --- a/data/fz/tags/functions/module/config/display.json +++ b/data/fz/tags/functions/module/config/display.json @@ -1,4 +1,5 @@ { + "__comment": "调用者:fz:module/config/on_click、fz:module/config/trigger", "replace": false, "values": [ "#fz:module/scoreboard/config/display/head", diff --git a/data/fz/tags/functions/module/config/reset_trigger.json b/data/fz/tags/functions/module/config/reset_trigger.json new file mode 100644 index 0000000..e87d3c3 --- /dev/null +++ b/data/fz/tags/functions/module/config/reset_trigger.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "fz:module/config/reset_trigger" + ] +} \ No newline at end of file diff --git a/data/fz/tags/functions/module/config/trigger.json b/data/fz/tags/functions/module/config/trigger.json index b18ac4e..367f8e9 100644 --- a/data/fz/tags/functions/module/config/trigger.json +++ b/data/fz/tags/functions/module/config/trigger.json @@ -1,5 +1,4 @@ { - "__comment": "调用者:fz:event/config/on_triggered,当玩家抬头到最高角度并蹲起后,触发此事件", "replace": false, "values": [ "fz:module/config/trigger" diff --git a/data/fz/tags/functions/module/scoreboard/config/on_click.json b/data/fz/tags/functions/module/scoreboard/config/on_click.json index 5cafe16..aec410f 100644 --- a/data/fz/tags/functions/module/scoreboard/config/on_click.json +++ b/data/fz/tags/functions/module/scoreboard/config/on_click.json @@ -1,4 +1,5 @@ { + "__comment": "调用者:fz:module/config/on_click", "replace": false, "values": [ "fz:module/scoreboard/config/on_click"