实现计分板底层逻辑

This commit is contained in:
延皓 2022-07-04 00:38:23 +08:00
parent d8d5b7b677
commit 171b19c93a
58 changed files with 143 additions and 37 deletions

View File

@ -1,12 +1,14 @@
scoreboard objectives add fz.event.play_seconds minecraft.custom:play_time
scoreboard objectives add fz.event.leave_game minecraft.custom:leave_game
scoreboard objectives add fz.event.aviating_distance minecraft.custom:aviate_one_cm scoreboard objectives add fz.event.aviating_distance minecraft.custom:aviate_one_cm
scoreboard objectives add fz.event.damage_taken minecraft.custom:damage_taken scoreboard objectives add fz.event.damage_taken minecraft.custom:damage_taken
scoreboard objectives add fz.event.fishing_count minecraft.custom:fish_caught scoreboard objectives add fz.event.fishing_count minecraft.custom:fish_caught
scoreboard objectives add fz.event.leave_game minecraft.custom:leave_game
scoreboard objectives add fz.event.play_seconds minecraft.custom:play_time
scoreboard objectives add fz.event.villager_trade minecraft.custom:traded_with_villager
## 调试 ## 调试
execute if score fz.logger.level fz.variable.integer matches ..500 run tellraw @a [{"nbt": "fz.level.info", "interpret": true, "storage": "fz:logger"}, {"text": "已初始化系统组件:事件"}] execute if score fz.logger.level fz.variable.integer matches ..500 run tellraw @a [{"nbt": "fz.level.info", "interpret": true, "storage": "fz:logger"}, {"text": "已初始化系统组件:事件"}]

View File

@ -1,4 +1,5 @@
scoreboard players operation fz.var.score fz.variable.integer = @s fz.event.aviating_distance scoreboard players operation fz.var.score fz.variable.integer = @s fz.event.aviating_distance
scoreboard players operation fz.var.score fz.variable.integer /= 200 fz.variable.integer
function #fz:event/on_aviate_one_meter function #fz:event/on_aviate_one_meter

View File

@ -1,4 +1,5 @@
scoreboard players operation fz.var.score fz.variable.integer = @s fz.event.play_seconds scoreboard players operation fz.var.score fz.variable.integer = @s fz.event.play_seconds
scoreboard players operation fz.var.score fz.variable.integer /= 3600 fz.variable.integer
function #fz:event/on_play_one_hour function #fz:event/on_play_one_hour

View File

@ -1,3 +1,2 @@
scoreboard players add @s fz.module.scoreboard.display.activation 1 scoreboard players add @s fz.module.scoreboard.display.activation 1
scoreboard players add fz.module.scoreboard.total.activation fz.module.scoreboard.assign.general 1 scoreboard players add fz.module.scoreboard.total.activation fz.module.scoreboard.assign.general 1
function #fz:module/scoreboard/assign/set_display/total_name/activation

View File

@ -1,4 +1,2 @@
scoreboard players operation fz.var.score fz.variable.integer /= 200 fz.variable.integer
scoreboard players operation @s fz.module.scoreboard.display.aviating_distance += fz.var.score fz.variable.integer scoreboard players operation @s fz.module.scoreboard.display.aviating_distance += fz.var.score fz.variable.integer
scoreboard players operation fz.module.scoreboard.total.aviating_distance fz.module.scoreboard.assign.general += fz.var.score fz.variable.integer scoreboard players operation fz.module.scoreboard.total.aviating_distance fz.module.scoreboard.assign.general += fz.var.score fz.variable.integer
function #fz:module/scoreboard/assign/set_display/total_name/aviating_distance

View File

@ -1,3 +1,2 @@
scoreboard players operation @s fz.module.scoreboard.display.damage_taken += fz.var.score fz.variable.integer scoreboard players operation @s fz.module.scoreboard.display.damage_taken += fz.var.score fz.variable.integer
scoreboard players operation fz.module.scoreboard.total.damage_taken fz.module.scoreboard.assign.general += fz.var.score fz.variable.integer scoreboard players operation fz.module.scoreboard.total.damage_taken fz.module.scoreboard.assign.general += fz.var.score fz.variable.integer
function #fz:module/scoreboard/assign/set_display/total_name/damage_taken

View File

@ -0,0 +1,2 @@
scoreboard players add @s fz.module.scoreboard.display.death_count 1
scoreboard players add fz.module.scoreboard.total.death_count fz.module.scoreboard.assign.general 1

View File

@ -0,0 +1,2 @@
scoreboard players operation @s fz.module.scoreboard.display.dig_count += fz.var.score fz.variable.integer
scoreboard players operation fz.module.scoreboard.total.dig_count fz.module.scoreboard.assign.general += fz.var.score fz.variable.integer

View File

@ -0,0 +1,2 @@
scoreboard players add @s fz.module.scoreboard.display.fishing_count 1
scoreboard players add fz.module.scoreboard.total.fishing_count fz.module.scoreboard.assign.general 1

View File

@ -0,0 +1,2 @@
scoreboard players operation 总死亡次数 fz.module.scoreboard.display.general = fz.module.scoreboard.total.death_count fz.module.scoreboard.assign.general
scoreboard players operation 总死亡次数 fz.module.scoreboard.display.death_count = fz.module.scoreboard.total.death_count fz.module.scoreboard.assign.general

View File

@ -0,0 +1,2 @@
scoreboard players operation 总挖掘量 fz.module.scoreboard.display.general = fz.module.scoreboard.total.dig_count fz.module.scoreboard.assign.general
scoreboard players operation 总挖掘量 fz.module.scoreboard.display.dig_count = fz.module.scoreboard.total.dig_count fz.module.scoreboard.assign.general

View File

@ -0,0 +1,2 @@
scoreboard players operation 总受伤害量 fz.module.scoreboard.display.general = fz.module.scoreboard.total.fishing_count fz.module.scoreboard.assign.general
scoreboard players operation 总受伤害量 fz.module.scoreboard.display.fishing_count = fz.module.scoreboard.total.fishing_count fz.module.scoreboard.assign.general

View File

@ -0,0 +1,2 @@
scoreboard players operation 总交易量 fz.module.scoreboard.display.general = fz.module.scoreboard.total.kill_count fz.module.scoreboard.assign.general
scoreboard players operation 总交易量 fz.module.scoreboard.display.kill_count = fz.module.scoreboard.total.kill_count fz.module.scoreboard.assign.general

View File

@ -0,0 +1,2 @@
scoreboard players operation 总交易量 fz.module.scoreboard.display.general = fz.module.scoreboard.total.placement_count fz.module.scoreboard.assign.general
scoreboard players operation 总交易量 fz.module.scoreboard.display.placement_count = fz.module.scoreboard.total.placement_count fz.module.scoreboard.assign.general

View File

@ -0,0 +1,2 @@
scoreboard players add @s fz.module.scoreboard.display.kill_count 1
scoreboard players add fz.module.scoreboard.total.kill_count fz.module.scoreboard.assign.general 1

View File

@ -0,0 +1,2 @@
scoreboard players add @s fz.module.scoreboard.display.placement_count 1
scoreboard players add fz.module.scoreboard.total.placement_count fz.module.scoreboard.assign.general 1

View File

@ -1,3 +1,2 @@
scoreboard players add @s fz.module.scoreboard.display.trade_count 1 scoreboard players add @s fz.module.scoreboard.display.trade_count 1
scoreboard players add fz.module.scoreboard.total.trade_count fz.module.scoreboard.assign.general 1 scoreboard players add fz.module.scoreboard.total.trade_count fz.module.scoreboard.assign.general 1
function #fz:module/scoreboard/assign/set_display/total_name/trade_count

View File

@ -1,3 +1,3 @@
# 调用者#fz:module/scoreboard/config/display/buttons # 调用者#fz:module/scoreboard/config/display/buttons
tellraw @s [[{"text": "[", "hoverEvent": {"action": "show_text", "contents": {"text": "关", "color": "dark_red"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1000"}}, {"text": "关", "color": "dark_red"}, {"text": "]"}], [{"text": "[", "hoverEvent": {"action": "show_text", "contents": {"nbt": "fz.scoreboard.text.general", "interpret": true, "storage": "fz:module"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1010"}}, {"nbt": "fz.scoreboard.text.general", "interpret": true, "storage": "fz:module"},{"text": "]"}], [{"text": "[", "hoverEvent": {"action": "show_text", "contents": {"nbt": "fz.scoreboard.text.activation", "interpret": true, "storage": "fz:module"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1020"}}, {"nbt": "fz.scoreboard.text.activation", "interpret": true, "storage": "fz:module"},{"text": "]"}], [{"text": "[", "hoverEvent": {"action": "show_text", "contents": {"nbt": "fz.scoreboard.text.aviating_distance", "interpret": true, "storage": "fz:module"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1030"}}, {"nbt": "fz.scoreboard.text.aviating_distance", "interpret": true, "storage": "fz:module"},{"text": "]"}], [{"text": "[", "hoverEvent": {"action": "show_text", "contents": {"nbt": "fz.scoreboard.text.damage_taken", "interpret": true, "storage": "fz:module"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1040"}}, {"nbt": "fz.scoreboard.text.damage_taken", "interpret": true, "storage": "fz:module"},{"text": "]"}], [{"text": "[", "hoverEvent": {"action": "show_text", "contents": {"nbt": "fz.scoreboard.text.death_count", "interpret": true, "storage": "fz:module"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1050"}}, {"nbt": "fz.scoreboard.text.death_count", "interpret": true, "storage": "fz:module"},{"text": "]"}], [{"text": "[", "hoverEvent": {"action": "show_text", "contents": {"nbt": "fz.scoreboard.text.dig_count", "interpret": true, "storage": "fz:module"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1060"}}, {"nbt": "fz.scoreboard.text.dig_count", "interpret": true, "storage": "fz:module"},{"text": "]"}], [{"text": "[", "hoverEvent": {"action": "show_text", "contents": {"nbt": "fz.scoreboard.text.fishing_count", "interpret": true, "storage": "fz:module"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1070"}}, {"nbt": "fz.scoreboard.text.fishing_count", "interpret": true, "storage": "fz:module"},{"text": "]"}], [{"text": "[", "hoverEvent": {"action": "show_text", "contents": {"nbt": "fz.scoreboard.text.kill_count", "interpret": true, "storage": "fz:module"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1080"}}, {"nbt": "fz.scoreboard.text.kill_count", "interpret": true, "storage": "fz:module"},{"text": "]"}], [{"text": "[", "hoverEvent": {"action": "show_text", "contents": {"nbt": "fz.scoreboard.text.trade_count", "interpret": true, "storage": "fz:module"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1090"}}, {"nbt": "fz.scoreboard.text.trade_count", "interpret": true, "storage": "fz:module"}, {"text": "]"}]] tellraw @s [[{"text": "[", "hoverEvent": {"action": "show_text", "contents": {"text": "关", "color": "dark_red"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1000"}}, {"text": "关", "color": "dark_red"}, {"text": "]"}], [{"text": "[", "hoverEvent": {"action": "show_text", "contents": {"nbt": "fz.scoreboard.text.carousel", "interpret": true, "storage": "fz:module"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1010"}}, {"nbt": "fz.scoreboard.text.carousel", "interpret": true, "storage": "fz:module"}, {"text": "]"}], [{"text": "[", "hoverEvent": {"action": "show_text", "contents": {"nbt": "fz.scoreboard.text.general", "interpret": true, "storage": "fz:module"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1020"}}, {"nbt": "fz.scoreboard.text.general", "interpret": true, "storage": "fz:module"},{"text": "]"}], [{"text": "[", "hoverEvent": {"action": "show_text", "contents": {"nbt": "fz.scoreboard.text.activation", "interpret": true, "storage": "fz:module"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1030"}}, {"nbt": "fz.scoreboard.text.activation", "interpret": true, "storage": "fz:module"},{"text": "]"}], [{"text": "[", "hoverEvent": {"action": "show_text", "contents": {"nbt": "fz.scoreboard.text.aviating_distance", "interpret": true, "storage": "fz:module"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1040"}}, {"nbt": "fz.scoreboard.text.aviating_distance", "interpret": true, "storage": "fz:module"},{"text": "]"}], [{"text": "[", "hoverEvent": {"action": "show_text", "contents": {"nbt": "fz.scoreboard.text.damage_taken", "interpret": true, "storage": "fz:module"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1050"}}, {"nbt": "fz.scoreboard.text.damage_taken", "interpret": true, "storage": "fz:module"},{"text": "]"}], [{"text": "[", "hoverEvent": {"action": "show_text", "contents": {"nbt": "fz.scoreboard.text.death_count", "interpret": true, "storage": "fz:module"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1060"}}, {"nbt": "fz.scoreboard.text.death_count", "interpret": true, "storage": "fz:module"},{"text": "]"}], [{"text": "[", "hoverEvent": {"action": "show_text", "contents": {"nbt": "fz.scoreboard.text.dig_count", "interpret": true, "storage": "fz:module"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1070"}}, {"nbt": "fz.scoreboard.text.dig_count", "interpret": true, "storage": "fz:module"},{"text": "]"}], [{"text": "[", "hoverEvent": {"action": "show_text", "contents": {"nbt": "fz.scoreboard.text.fishing_count", "interpret": true, "storage": "fz:module"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1080"}}, {"nbt": "fz.scoreboard.text.fishing_count", "interpret": true, "storage": "fz:module"},{"text": "]"}], [{"text": "[", "hoverEvent": {"action": "show_text", "contents": {"nbt": "fz.scoreboard.text.kill_count", "interpret": true, "storage": "fz:module"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1090"}}, {"nbt": "fz.scoreboard.text.kill_count", "interpret": true, "storage": "fz:module"},{"text": "]"}], [{"text": "[", "hoverEvent": {"action": "show_text", "contents": {"nbt": "fz.scoreboard.text.trade_count", "interpret": true, "storage": "fz:module"}}, "clickEvent": {"action": "run_command", "value": "/trigger fz.module.config.trigger set 1100"}}, {"nbt": "fz.scoreboard.text.trade_count", "interpret": true, "storage": "fz:module"}, {"text": "]"}]]

View File

@ -1,3 +1,14 @@
execute if score @s fz.module.config.trigger matches 1000 run function #fz:module/scoreboard/config/subscribe/off
execute if score @s fz.module.config.trigger matches 1010 run function #fz:module/scoreboard/config/subscribe/carousel
execute if score @s fz.module.config.trigger matches 1020 run function #fz:module/scoreboard/config/subscribe/general
execute if score @s fz.module.config.trigger matches 1030 run function #fz:module/scoreboard/config/subscribe/activation
execute if score @s fz.module.config.trigger matches 1040 run function #fz:module/scoreboard/config/subscribe/aviating_distance
execute if score @s fz.module.config.trigger matches 1050 run function #fz:module/scoreboard/config/subscribe/damage_taken
execute if score @s fz.module.config.trigger matches 1060 run function #fz:module/scoreboard/config/subscribe/death_count
execute if score @s fz.module.config.trigger matches 1070 run function #fz:module/scoreboard/config/subscribe/dig_count
execute if score @s fz.module.config.trigger matches 1080 run function #fz:module/scoreboard/config/subscribe/fishing_count
execute if score @s fz.module.config.trigger matches 1090 run function #fz:module/scoreboard/config/subscribe/kill_count
execute if score @s fz.module.config.trigger matches 1100 run function #fz:module/scoreboard/config/subscribe/trade_count
## 调试 ## 调试
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 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"}}]

View File

@ -1,4 +1,4 @@
# 调用者fz:module/scoreboard/config/on_click # 调用者fz:module/scoreboard/config/subscribe/~
team join fz.module.scoreboard.display.activation @s team join fz.module.scoreboard.display.activation @s

View File

@ -1,4 +1,4 @@
# 调用者fz:module/scoreboard/config/on_click # 调用者fz:module/scoreboard/config/subscribe/~
team join fz.module.scoreboard.display.aviating_distance @s team join fz.module.scoreboard.display.aviating_distance @s

View File

@ -1,4 +1,4 @@
# 调用者fz:module/scoreboard/config/on_click # 调用者fz:module/scoreboard/config/subscribe/~
team join fz.module.scoreboard.display.carousel @s team join fz.module.scoreboard.display.carousel @s

View File

@ -1,4 +1,4 @@
# 调用者fz:module/scoreboard/config/on_click # 调用者fz:module/scoreboard/config/subscribe/~
team join fz.module.scoreboard.display.damage_taken @s team join fz.module.scoreboard.display.damage_taken @s

View File

@ -1,4 +1,4 @@
# 调用者fz:module/scoreboard/config/on_click # 调用者fz:module/scoreboard/config/subscribe/~
team join fz.module.scoreboard.display.death_count @s team join fz.module.scoreboard.display.death_count @s

View File

@ -1,4 +1,4 @@
# 调用者fz:module/scoreboard/config/on_click # 调用者fz:module/scoreboard/config/subscribe/~
team join fz.module.scoreboard.display.dig_count @s team join fz.module.scoreboard.display.dig_count @s

View File

@ -1,4 +1,4 @@
# 调用者fz:module/scoreboard/config/on_click # 调用者fz:module/scoreboard/config/subscribe/~
team join fz.module.scoreboard.display.fishing_count @s team join fz.module.scoreboard.display.fishing_count @s

View File

@ -1,4 +1,4 @@
# 调用者fz:module/scoreboard/config/on_click # 调用者fz:module/scoreboard/config/subscribe/~
team join fz.module.scoreboard.display.general @s team join fz.module.scoreboard.display.general @s

View File

@ -1,4 +1,4 @@
# 调用者fz:module/scoreboard/config/on_click # 调用者fz:module/scoreboard/config/subscribe/~
team join fz.module.scoreboard.display.kill_count @s team join fz.module.scoreboard.display.kill_count @s

View File

@ -1,4 +1,4 @@
# 调用者fz:module/scoreboard/config/on_click # 调用者#fz:module/scoreboard/config/subscribe/~
team leave @s team leave @s

View File

@ -0,0 +1,6 @@
# 调用者fz:module/scoreboard/config/subscribe/~
team join fz.module.scoreboard.display.placement_count @s
## 调试
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": "订阅了"}, {"nbt": "fz.scoreboard.text.placement_count", "interpret": true, "storage": "fz:module"}, {"text": "计分板"}]

View File

@ -1,4 +1,4 @@
# 调用者fz:module/scoreboard/config/on_click # 调用者fz:module/scoreboard/config/subscribe/~
team join fz.module.scoreboard.display.trade_count @s team join fz.module.scoreboard.display.trade_count @s

View File

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"#fz:module/scoreboard/assign/set_display/trade_count"
]
}

View File

@ -1,6 +1,6 @@
{ {
"replace": false, "replace": false,
"values": [ "values": [
"#fz:event/module/scoreboard/on_trade" "#fz:module/scoreboard/assign/set_display/trade_count/piglin"
] ]
} }

View File

@ -1,6 +1,6 @@
{ {
"replace": false, "replace": false,
"values": [ "values": [
"#fz:event/module/scoreboard/on_trade" "#fz:module/scoreboard/assign/set_display/trade_count/villager"
] ]
} }

View File

@ -1,6 +1,7 @@
{ {
"replace": false, "replace": false,
"values": [ "values": [
"fz:module/scoreboard/assign/set_display/activation" "fz:module/scoreboard/assign/set_display/activation",
"#fz:module/scoreboard/assign/set_display/general/activation"
] ]
} }

View File

@ -1,6 +1,7 @@
{ {
"replace": false, "replace": false,
"values": [ "values": [
"fz:module/scoreboard/assign/set_display/aviating_distance" "fz:module/scoreboard/assign/set_display/aviating_distance",
"#fz:module/scoreboard/assign/set_display/general/aviating_distance"
] ]
} }

View File

@ -1,6 +1,7 @@
{ {
"replace": false, "replace": false,
"values": [ "values": [
"fz:module/scoreboard/assign/set_display/damage_taken" "fz:module/scoreboard/assign/set_display/damage_taken",
"#fz:module/scoreboard/assign/set_display/general/damage_taken"
] ]
} }

View File

@ -1,6 +1,7 @@
{ {
"replace": false, "replace": false,
"values": [ "values": [
"fz:module/scoreboard/assign/set_display/trade_count" "fz:module/scoreboard/assign/set_display/trade_count",
"#fz:module/scoreboard/assign/set_display/general/trade_count"
] ]
} }

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"fz:module/scoreboard/config/subscribe/activation"
]
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"fz:module/scoreboard/config/subscribe/aviating_distance"
]
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"fz:module/scoreboard/config/subscribe/carousel"
]
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"fz:module/scoreboard/config/subscribe/damage_taken"
]
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"fz:module/scoreboard/config/subscribe/death_count"
]
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"fz:module/scoreboard/config/subscribe/dig_count"
]
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"fz:module/scoreboard/config/subscribe/fishing_count"
]
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"fz:module/scoreboard/config/subscribe/general"
]
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"fz:module/scoreboard/config/subscribe/kill_count"
]
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"fz:module/scoreboard/config/subscribe/off"
]
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"fz:module/scoreboard/config/subscribe/placement_count"
]
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"fz:module/scoreboard/config/subscribe/trade_count"
]
}