完善here、last_death

This commit is contained in:
延皓 committed 2022-07-09 13:06:56 +08:00
1 parent 596ebd9d64
commit 4a69d7d927
58 files changed
+198 -85

No files matched your search

@@ -1,6 +1,5 @@
function #fz:module/config/reset_trigger
schedule clear fz:module/config/loop
execute as @a run function #fz:module/config/reset_trigger
## 日志
execute if score fz.logger.level fz.variable.integer matches ..500 run tellraw @a [{"nbt": "fz.level.info", "interpret": true, "storage": "fz:logger"}, {"text": "已加载组件:配置"}]
@@ -1,7 +1,6 @@
# 调用者:fz:module/config/trigger
## 如果分数大于0说明玩家点击了按钮
execute as @a if score @s fz.module.config.trigger matches 1.. run function #fz:module/config/on_click
execute as @a if score @s fz.module.config.trigger matches 1.. run function #fz:module/config/reset_trigger
execute as @a if score @s fz.module.config.trigger matches 1.. run function #fz:module/config/on_click/on_click
schedule function fz:module/config/loop 1t replace
@@ -1,10 +1,4 @@
# 调用者:#fz:module/config/on_click
##### 处理玩家点击,并进行下一步操作
## 调试
execute if score fz.logger.level fz.variable.integer matches ..400 run tellraw @a [{"nbt": "fz.level.debug", "interpret": true, "storage": "fz:logger"}, {"text": "玩家"}, {"selector": "@s"}, {"text": "点击了配置按钮,触发器分数为:"}, {"score": {"name": "@s", "objective": "fz.module.config.trigger"}}]
execute if score @s fz.module.config.trigger matches 1000..1999 run function #fz:module/scoreboard/config/on_click
## 重新显示一次按钮
function #fz:module/config/display
execute if score fz.logger.level fz.variable.integer matches ..400 run tellraw @a [{"nbt": "fz.level.debug", "interpret": true, "storage": "fz:logger"}, {"text": "玩家"}, {"selector": "@s"}, {"text": "点击了配置按钮,触发器分数为:"}, {"score": {"name": "@s", "objective": "fz.module.config.trigger"}}]
@@ -1,13 +1,2 @@
# 调用者:#fz:module/config/on_config
##### 玩家抬头到最高角度并蹲起后,触发此函数
## 调试
execute if score fz.logger.level fz.variable.integer matches ..400 run tellraw @a [{"nbt": "fz.level.debug", "interpret": true, "storage": "fz:logger"}, {"text": "玩家"}, {"selector": "@s"}, {"text": "触发了配置功能"}]
function fz:module/config/loop
## 显示按钮
function #fz:module/config/display
## 设置或重制超时时间
schedule function #fz:module/config/timeout 300s replace
execute if score fz.logger.level fz.variable.integer matches ..400 run tellraw @a [{"nbt": "fz.level.debug", "interpret": true, "storage": "fz:logger"}, {"text": "玩家"}, {"selector": "@s"}, {"text": "触发了配置页面"}]
@@ -0,0 +1,2 @@
## 设置或重制超时时间
schedule function #fz:module/config/timeout 300s replace
@@ -1,4 +1,3 @@
function #fz:module/health/set_health_name
execute unless data storage fz:config fz.module.health.display{below_name: 0b} run scoreboard objectives setdisplay belowName fz.module.health
execute if data storage fz:config fz.module.health.display{below_name: 0b} run scoreboard objectives setdisplay belowName
execute unless data storage fz:config fz.module.health.display{list: 0b} run scoreboard objectives setdisplay list fz.module.health
@@ -1 +0,0 @@
execute if data storage fz:data_viewer fz.here.cache{dimension:"minecraft:overworld"} run function fz:module/here/custom_dimension_message/if_in_overworld
@@ -1 +0,0 @@
execute if data storage fz:data_viewer fz.here.cache{dimension:"minecraft:the_nether"} run function fz:module/here/custom_dimension_message/if_in_the_nether
@@ -2,5 +2,4 @@ data modify storage fz:here fz.cache.nether_pos set value [0, 0]
execute store result storage fz:here fz.cache.nether_pos[0] int 0.125 run data get entity @s Pos[0]
execute store result storage fz:here fz.cache.nether_pos[1] int 0.125 run data get entity @s Pos[2]
data modify storage fz:here fz.cache.message[0] set value '{"text": "主世界", "color": "dark_green"}'
data modify storage fz:here fz.cache.message[2] set value '[{"text": ",对应", "color": "white"}, {"text": "下届", "color": "dark_red"}, {"text": ":"}, [{"text": "[", "color": "green"}, {"nbt": "fz.cache.nether_pos[0]", "storage": "fz:here"}, {"text": ", "}, {"nbt": "fz.cache.nether_pos[1]", "storage": "fz:here"}, {"text": "]"}]]'
@@ -2,5 +2,4 @@ data modify storage fz:here fz.cache.overworld_pos set value [0, 0]
execute store result storage fz:here fz.cache.overworld_pos[0] int 8 run data get entity @s Pos[0]
execute store result storage fz:here fz.cache.overworld_pos[1] int 8 run data get entity @s Pos[2]
data modify storage fz:here fz.cache.message[0] set value '{"text": "下届", "color": "dark_red"}'
data modify storage fz:here fz.cache.message[2] set value '[{"text": ",对应", "color": "white"}, {"text": "主世界", "color": "dark_green"}, {"text": ":"}, [{"text": "[", "color": "green"}, {"nbt": "fz.cache.overworld_pos[0]", "storage": "fz:here"}, {"text": ", "}, {"nbt": "fz.cache.overworld_pos[1]", "storage": "fz:here"}, {"text": "]"}]]'
@@ -0,0 +1 @@
execute if data storage fz:global fz.cache.dimension{id:"minecraft:overworld"} run function fz:module/here/get_dimension_message/if_overworld
@@ -0,0 +1 @@
execute if data storage fz:global fz.cache.dimension{id:"minecraft:the_nether"} run function fz:module/here/get_dimension_message/if_the_nether
@@ -1,9 +1,8 @@
data modify storage fz:here fz.cache.dimension set from entity @s Dimension
data modify storage fz:here fz.cache.pos set value [0, 0, 0]
## fz.cache.pos已在install中初始化
execute store result storage fz:here fz.cache.pos[0] int 1 run data get entity @s Pos[0]
execute store result storage fz:here fz.cache.pos[1] int 1 run data get entity @s Pos[1]
execute store result storage fz:here fz.cache.pos[2] int 1 run data get entity @s Pos[2]
data modify storage fz:here fz.cache.message set value ["", "", ""]
data modify storage fz:here fz.cache.message[0] set value '{"nbt": "fz.cache.dimension", "storage": "fz:here"}'
data modify storage fz:here fz.cache.message[1] set value '[{"text": "[", "color": "green"}, {"nbt": "fz.cache.pos[0]", "storage": "fz:here"}, {"text": ", "}, {"nbt": "fz.cache.pos[1]", "storage": "fz:here"}, {"text": ", "}, {"nbt": "fz.cache.pos[2]", "storage": "fz:here"}, {"text": "]"}]'
function #fz:module/here/custom_message
data modify storage fz:here fz.cache.message set value ['{"nbt": "fz.cache.dimension.name", "interpret": true, "storage": "fz:global"}', '[{"text": "[", "color": "green"}, {"nbt": "fz.cache.pos[0]", "storage": "fz:here"}, {"text": ", "}, {"nbt": "fz.cache.pos[1]", "storage": "fz:here"}, {"text": ", "}, {"nbt": "fz.cache.pos[2]", "storage": "fz:here"}, {"text": "]"}]', '']
## 调试
execute if score fz.logger.level fz.variable.integer matches ..400 run tellraw @a [{"nbt": "fz.level.debug", "interpret": true, "storage": "fz:logger"}, {"text": "玩家"}, {"selector": "@s"}, {"text": "获取了位置信息"}]
@@ -1,3 +1 @@
function fz:module/here/get_message
tellraw @a [{"text": "", "color": "white"}, {"selector": "@s"}, {"text": "说:"}, {"text": "我在"}, {"nbt": "fz.cache.message[0]", "interpret": true, "storage": "fz:here"}, {"nbt": "fz.cache.message[1]", "interpret": true, "storage": "fz:here"}, {"nbt": "fz.cache.message[2]", "interpret": true, "storage": "fz:here"}]
@@ -0,0 +1,7 @@
data modify storage fz:here fz.cache.pos set value [0, 0, 0]
## 标记为已安装
data modify storage fz:installed fz.module.here set value 1b
## 日志
execute if score fz.logger.level fz.variable.integer matches ..500 run tellraw @a [{"nbt": "fz.level.info", "interpret": true, "storage": "fz:logger"}, {"text": "已安装组件:here"}]
@@ -1,3 +1 @@
function fz:module/here/get_message
tellraw @s [{"text": "你在", "color": "white"}, {"nbt": "fz.cache.message[0]", "interpret": true, "storage": "fz:here"}, {"nbt": "fz.cache.message[1]", "interpret": true, "storage": "fz:here"}, {"nbt": "fz.cache.message[2]", "interpret": true, "storage": "fz:here"}]
@@ -1 +1,7 @@
data remove storage fz:here fz
data remove storage fz:here fz
## 标记为已卸载
data modify storage fz:installed fz.module.here set value 0b
## 日志
execute if score fz.logger.level fz.variable.integer matches ..500 run tellraw @a [{"nbt": "fz.level.info", "interpret": true, "storage": "fz:logger"}, {"text": "已卸载组件:here"}]
@@ -0,0 +1,9 @@
data modify storage fz:global fz.cache.dimension.id set from entity @s LastDeathLocation.dimension
data modify storage fz:global fz.cache.dimension.name set from entity @s LastDeathLocation.dimension
## fz.cache.pos已在install中初始化
execute store result storage fz:last_death fz.cache.pos[0] int 1 run data get entity @s LastDeathLocation.pos[0]
execute store result storage fz:last_death fz.cache.pos[1] int 1 run data get entity @s LastDeathLocation.pos[1]
execute store result storage fz:last_death fz.cache.pos[2] int 1 run data get entity @s LastDeathLocation.pos[2]
## 调试
execute if score fz.logger.level fz.variable.integer matches ..400 run tellraw @a [{"nbt": "fz.level.debug", "interpret": true, "storage": "fz:logger"}, {"text": "玩家"}, {"selector": "@s"}, {"text": "获取了死亡点"}]
@@ -0,0 +1,7 @@
data modify storage fz:last_death fz.cache.pos set value [0, 0, 0]
## 标记为已安装
data modify storage fz:installed fz.module.last_death set value 1b
## 日志
execute if score fz.logger.level fz.variable.integer matches ..500 run tellraw @a [{"nbt": "fz.level.info", "interpret": true, "storage": "fz:logger"}, {"text": "已安装组件:死亡点"}]
@@ -0,0 +1 @@
tellraw @s [{"text": "你的上次死亡位于"}, {"nbt": "fz.cache.dimension.name", "interpret": true, "storage": "fz:global"}, [{"text": "[", "color": "green"}, {"nbt": "fz.cache.pos[0]", "storage": "fz:last_death"}, {"text": ", "}, {"nbt": "fz.cache.pos[1]", "storage": "fz:last_death"}, {"text": ", "}, {"nbt": "fz.cache.pos[2]", "storage": "fz:last_death"}, {"text": "]"}]]
@@ -0,0 +1,7 @@
data remove storage fz:last_death fz
## 标记为已卸载
data modify storage fz:installed fz.module.last_death set value 0b
## 日志
execute if score fz.logger.level fz.variable.integer matches ..500 run tellraw @a [{"nbt": "fz.level.info", "interpret": true, "storage": "fz:logger"}, {"text": "已卸载组件:死亡点"}]
@@ -0,0 +1,4 @@
## 重置计分板最大id计数
scoreboard players set fz.module.scoreboard.display.highest_id fz.variable.integer -1
### 重置轮播计分板ID
scoreboard players set fz.module.scoreboard.display.current_id fz.variable.integer 0
@@ -1,8 +1,5 @@
# 调用者:#fz:module/scoreboard/load
## 异常检测
execute unless data storage fz:install_manager fz.module{scoreboard: 1b} run tellraw @a [{"nbt": "fz.exception.load_without_install_exception", "interpret": true, "storage": "fz:logger"}, {"text": "计分板"}]
## 调试
execute if score fz.logger.level fz.variable.integer matches ..400 run tellraw @a [{"nbt": "fz.level.debug", "interpret": true, "storage": "fz:logger"}, {"text": "计分板显示文本已设为:"}]
execute if score fz.logger.level fz.variable.integer matches ..400 run tellraw @a [{"text": "", "color": "green"}, {"nbt": "fz.level.debug", "interpret": true, "storage": "fz:logger"}, {"text": "fz.module.scoreboard.display.general - "}, {"nbt": "fz.scoreboard.text.general", "interpret": true, "storage": "fz:module"}]
@@ -15,17 +12,5 @@ execute if score fz.logger.level fz.variable.integer matches ..400 run tellraw @
execute if score fz.logger.level fz.variable.integer matches ..400 run tellraw @a [{"text": "", "color": "green"}, {"nbt": "fz.level.debug", "interpret": true, "storage": "fz:logger"}, {"text": "fz.module.scoreboard.display.kill_count - "}, {"nbt": "fz.scoreboard.text.kill_count", "interpret": true, "storage": "fz:module"}]
execute if score fz.logger.level fz.variable.integer matches ..400 run tellraw @a [{"text": "", "color": "green"}, {"nbt": "fz.level.debug", "interpret": true, "storage": "fz:logger"}, {"text": "fz.module.scoreboard.display.trade_count - "}, {"nbt": "fz.scoreboard.text.trade_count", "interpret": true, "storage": "fz:module"}]
## 初始化计分板显示
### 重置计分板最大id计数
scoreboard players set fz.module.scoreboard.display.highest_id fz.variable.integer -1
### 设置颜色、名称
function #fz:module/scoreboard/display/set_text
### 设置运行时计分板id,同时会计算最大id数
function fz:module/scoreboard/display/register_id
### 重置轮播计分板ID
scoreboard players set fz.module.scoreboard.display.current_id fz.variable.integer 0
### 开启轮播循环
function fz:module/scoreboard/display/carousel/loop
## 日志
execute if score fz.logger.level fz.variable.integer matches ..500 run tellraw @a [{"nbt": "fz.level.info", "interpret": true, "storage": "fz:logger"}, {"text": "已加载组件:计分板"}]
@@ -25,6 +25,24 @@ team remove fz.module.scoreboard.display.kill_count
### 交易榜
team remove fz.module.scoreboard.display.trade_count
## 关闭计分板显示
scoreboard objectives setdisplay sidebar.team.aqua
scoreboard objectives setdisplay sidebar.team.black
scoreboard objectives setdisplay sidebar.team.blue
scoreboard objectives setdisplay sidebar.team.dark_aqua
scoreboard objectives setdisplay sidebar.team.dark_blue
scoreboard objectives setdisplay sidebar.team.dark_gray
scoreboard objectives setdisplay sidebar.team.dark_green
scoreboard objectives setdisplay sidebar.team.dark_purple
scoreboard objectives setdisplay sidebar.team.dark_red
scoreboard objectives setdisplay sidebar.team.gold
scoreboard objectives setdisplay sidebar.team.gray
scoreboard objectives setdisplay sidebar.team.green
scoreboard objectives setdisplay sidebar.team.light_purple
scoreboard objectives setdisplay sidebar.team.red
scoreboard objectives setdisplay sidebar.team.white
scoreboard objectives setdisplay sidebar.team.yellow
## 询问是否清除数据
execute if score fz.logger.level fz.variable.integer matches ..600 run tellraw @s [{"nbt": "fz.level.alert", "interpret": true, "storage": "fz:logger"}, {"text": "您要删除计分板数据吗,它将会永久失去!(真的很久!)"}, {"text": "[确定]", "color": "dark_red", "clickEvent": {"action": "suggest_command", "value": "/function #fz:module/scoreboard/clear_data"}, "hoverEvent": {"action": "show_text", "contents": {"text": "将命令填入聊天框"}}}]
@@ -1,5 +0,0 @@
# 调用者:#fz:module/try_load
## 判断是否从未安装,如果是则安装
execute unless data storage fz:installed fz.module.config run function #fz:module/config/install
execute unless data storage fz:installed fz.module.scoreboard run function #fz:module/scoreboard/install