Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bd651ce38c | |||
| e2ca203450 | |||
| 90155651ab | |||
| 2e9bbaf22c | |||
| 3b902c7880 | |||
| 5e2858a25a | |||
| 59230b5389 | |||
| c189ac700a | |||
| 525e1a0865 | |||
| 24bb299869 | |||
| 26dac885cb | |||
| 7fc0c2612a | |||
| ed3c0e5077 | |||
| 3d2348dd61 | |||
| d05ac38056 |
Vendored
+6
-6
@@ -8,14 +8,14 @@
|
||||
"tagRemove": "tag ${1:target} remove ${2:tag}",
|
||||
"dataModifyStorageFromSelf": "data modify storage ${1:id} ${2:path} set from entity @s ${3:path}",
|
||||
"summonAec": "summon minecraft:area_effect_cloud ~ ~ ~ {Age: -2147483648, Duration: -1, WaitTime: -2147483648, Tags: [\"${1:tag}\"]}",
|
||||
"logFine": "execute if score fz.logger.level fz.variable.integer matches ..300 run tellraw @a [{\"nbt\": \"fz.level.fine\", \"interpret\": true, \"storage\": \"fz:logger\"}, {\"text\": \"${log_fine}\"}",
|
||||
"logDebug": "execute if score fz.logger.level fz.variable.integer matches ..400 run tellraw @a [{\"nbt\": \"fz.level.debug\", \"interpret\": true, \"storage\": \"fz:logger\"}, {\"text\": \"${1:log_debug}\"}]",
|
||||
"logInfo": "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:log_info}\"}]",
|
||||
"logAlert": "execute if score fz.logger.level fz.variable.integer matches ..600 run tellraw @a [{\"nbt\": \"fz.level.alert\", \"interpret\": true, \"storage\": \"fz:logger\"}, {\"text\": \"${1:log_alert}\"}]",
|
||||
"logError": "execute if score fz.logger.level fz.variable.integer matches ..800 run tellraw @a [{\"nbt\": \"fz.level.error\", \"interpret\": true, \"storage\": \"fz:logger\"}, {\"text\": \"${1:log_error}\"}]",
|
||||
"logFine": "execute if score fzsd.logger.level fzsd.variable.integer matches ..300 run tellraw @a [{\"nbt\": \"fzsd.level.fine\", \"interpret\": true, \"storage\": \"fzsd:logger\"}, {\"text\": \"${log_fine}\"}",
|
||||
"logDebug": "execute if score fzsd.logger.level fzsd.variable.integer matches ..400 run tellraw @a [{\"nbt\": \"fzsd.level.debug\", \"interpret\": true, \"storage\": \"fzsd:logger\"}, {\"text\": \"${1:log_debug}\"}]",
|
||||
"logInfo": "execute if score fzsd.logger.level fzsd.variable.integer matches ..500 run tellraw @a [{\"nbt\": \"fzsd.level.info\", \"interpret\": true, \"storage\": \"fzsd:logger\"}, {\"text\": \"${1:log_info}\"}]",
|
||||
"logAlert": "execute if score fzsd.logger.level fzsd.variable.integer matches ..600 run tellraw @a [{\"nbt\": \"fzsd.level.alert\", \"interpret\": true, \"storage\": \"fzsd:logger\"}, {\"text\": \"${1:log_alert}\"}]",
|
||||
"logError": "execute if score fzsd.logger.level fzsd.variable.integer matches ..800 run tellraw @a [{\"nbt\": \"fzsd.level.error\", \"interpret\": true, \"storage\": \"fzsd:logger\"}, {\"text\": \"${1:log_error}\"}]",
|
||||
"TEXT": "{\"text\": \"${1:TEXT}\", \"color\": \"${2:COLOR}\"}",
|
||||
"storageText": "{\"nbt\": \"${1:NBT}\", \"interpret\": true, \"storage\": \"${2:A namespaced ID}\"}",
|
||||
"ifInstalled": "execute if data storage fz:installed fz.module{${1:module_name}:1b} run ${tellraw}"
|
||||
"ifInstalled": "execute if data storage fzsd:installed fzsd.module{${1:module_name}:1b} run ${tellraw}"
|
||||
},
|
||||
"datapack.env.cmdVersion": "1.19",
|
||||
"datapack.env.jsonVersion": "1.19",
|
||||
|
||||
@@ -5,23 +5,22 @@
|
||||
- `函数`,指数据包`<命名空间>/functions`目录下的`.mcfunction`文件
|
||||
- `标签`,指数据包`<命名空间>/tags`目录下的`.json`文件
|
||||
- `覆盖标签并填入函数`时,`replace`为`true`
|
||||
``` json
|
||||
{
|
||||
"replace": true,
|
||||
"values": ...
|
||||
}
|
||||
```
|
||||
``` json
|
||||
{
|
||||
"replace": true,
|
||||
"values": ...
|
||||
}
|
||||
```
|
||||
- `向标签中注册函数`时,`replace`为`false`
|
||||
``` json
|
||||
{
|
||||
"replace": false,
|
||||
"values": ...
|
||||
}
|
||||
```
|
||||
``` json
|
||||
{
|
||||
"replace": false,
|
||||
"values": ...
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## 基本要求
|
||||
- 接口逻辑和模块逻辑分离
|
||||
- 函数由两个以上的函数调用,或由不同包下的函数调用,或需要作为接口开放给下游数据包时,应改用标签调用!
|
||||
- 函数调用尽量不要使用`function`命令,应改在标签中按顺序调用!
|
||||
|
||||
@@ -61,7 +60,7 @@
|
||||
- 使用方法:`execute if score fzsd.logger.level fzsd.variable.integer matches ..600 run tellraw @a [{"nbt": "fzsd.level.alert", "interpret": true, "storage": "fzsd:logger"}, {"text": "你的日志"}`
|
||||
|
||||
#### 意外 Exception
|
||||
###### 暂不提供
|
||||
- 暂不提供
|
||||
|
||||
#### 错误 Error
|
||||
- 等级:800
|
||||
@@ -73,18 +72,16 @@
|
||||
### 交互器模块
|
||||
|
||||
#### 按钮操作
|
||||
1. 定义一个显示按钮时执行的函数,使用形如`tellraw @s {"text": "[按钮]", "clickEvent": {"action": "run_command", "value": "/trigger fzsd.module.config.trigger set <触发器分数>"}}`的指令定义按钮。
|
||||
- 触发器分数为正数会重新向玩家发送交互按钮,如不想重新发送,请使用负数
|
||||
1. 定义一个显示按钮时执行的函数,使用形如`tellraw @s {"text": "[按钮]", "clickEvent": {"action": "run_command", "value": "/trigger fzsd.module.interactor.trigger set <触发器分数>"}}`的指令定义按钮。
|
||||
- *触发器分数为正数会重新向玩家发送交互按钮,如不想重新发送,请使用负数*
|
||||
- 大多数情况下这里的触发器分数必须是独一无二的
|
||||
- 建议使用`>10000`的随机数作为自定义按钮的触发器分数
|
||||
2. 在[`#fzsd:module/config/display`](data/fzsd/tags/functions/module/config/display.json)标签中注册上述函数
|
||||
3. 定义一个点击按钮时执行的函数,使用形如`execute if score @s fzsd.module.config.trigger matches <min>..<max> run ...`的指令判断玩家的触发器分数,并执行你的操作
|
||||
4. 如需在点击后重新显示一遍配置页面,请在上述函数中调用一次[`#fzsd:module/config/display`](data/fzsd/tags/functions/module/config/display.json)标签,**请不要将此标签直接注册到[`#fzsd:module/config/on_click`](data/fzsd/tags/functions/module/config/on_click.json)标签中**
|
||||
5. 在[`#fzsd:module/config/on_click`](data/fzsd/tags/functions/module/config/on_click.json)标签中注册上述函数
|
||||
2. 在[`#fzsd:module/interactor/display`](data/fzsd/tags/functions/module/interactor/display.json)标签中注册上述函数
|
||||
3. 定义一个点击按钮时执行的函数,使用形如`execute if score @s fzsd.module.interactor.trigger matches <min>..<max> run ...`的指令判断玩家的触发器分数,并执行你的操作
|
||||
4. 在[`#fzsd:module/interactor/event/on_click`](data/fzsd/tags/functions/module/interactor/event/on_click.json)标签中注册上述函数
|
||||
|
||||
#### 其他接口
|
||||
- 标签[`#fzsd:module/config/timeout`](data/fzsd/tags/functions/module/config/timeout.json):超时时的操作
|
||||
- 标签[`#fzsd:module/config/reset_trigger`](data/fzsd/tags/functions/module/config/reset_trigger.json):重置玩家`@s`的触发器计分板
|
||||
#### 其他标签
|
||||
- 标签[`#fzsd:module/interactor/reset_trigger`](data/fzsd/tags/functions/module/interactor/reset_trigger.json):重置玩家`@s`的触发器计分板
|
||||
|
||||
### 计分板模块
|
||||
|
||||
@@ -109,6 +106,10 @@
|
||||
|
||||
## 自定义模块
|
||||
|
||||
### 排除假人
|
||||
- 如果您不想对假人执行您的命令,请将以下语句添加在您要执行的命令之前:
|
||||
<pre><code><font color=ee82ee>execute </font><font color=1e90ff>if predicate </font><font color=f0e68c>fzsd:is_real_player</font></code></pre>
|
||||
|
||||
#### 注册安装、卸载、加载函数
|
||||
- 在下列标签中注册你的安装、卸载、加载函数:
|
||||
- [`#fzsd:system/install/module`](data/fzsd/tags/functions/system/install/module.json)
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
## 安装教程
|
||||
|
||||
1. 兼容性
|
||||
- `数据包 v3.0.x` 暂时只支持 `Minecraft 1.19+`
|
||||
- `数据包 v2.2.x` 支持 `Minecraft 1.19+`
|
||||
- `数据包 v3.0.x` 支持 `Minecraft 1.19.x`(*由于使用了1.18.x不支持的操作,撤销对MC1.18.x的支持*)
|
||||
- `数据包 v2.2.x` 支持 `Minecraft 1.19.x`
|
||||
- `数据包 v2.1.x` 支持 `Minecraft 1.17.x-1.18.x`
|
||||
- `数据包 v2.0.x` 支持 `Minecraft 1.16.3-1.16.5`
|
||||
2. 前往[发行页面](https://gitee.com/harvey-husky/FZ-sDatapack/releases)下载对应MC版本的数据包
|
||||
@@ -25,7 +25,9 @@
|
||||
|
||||
# FZ生存数据包 3.0
|
||||
|
||||
[](https://gitee.com/harvey-husky/FZ-sDatapack/releases/v3.0.0) [](https://minecraft.net/)
|
||||
## *目前仍在测试阶段,请先备份服务器再使用!*
|
||||
|
||||
[](https://gitee.com/harvey-husky/FZ-sDatapack/releases/v3.0-beta.8) [](https://minecraft.net/)
|
||||
|
||||
> 其他版本见[发行页面](https://gitee.com/harvey-husky/FZ-sDatapack/releases)
|
||||
|
||||
@@ -62,9 +64,11 @@
|
||||
- 可避免Carpet假人污染计分板
|
||||
- 执行 `reload` 指令后自动生效
|
||||
- 子命令( `/fzsd_score <子命令>` ):
|
||||
- `merge_old`:用于从 `数据包2.x` 升级后恢复计分板数据
|
||||
- `update_from <version>`:用于从给定的数据包版本恢复计分板数据(需要测试!)
|
||||
- `recalculate_total`:重新计算总分
|
||||
|
||||
### 其他
|
||||
- 见游戏内交互器按钮
|
||||
|
||||
## 开发者相关
|
||||
- 参见[开发文档](/DEVDOC.md)
|
||||
@@ -0,0 +1,35 @@
|
||||
tellraw @s {"text": "管理员页面:", "color": "red"}
|
||||
|
||||
|
||||
tellraw @s [{"text": "全局:"}, [{"text": "", "color": "dark_gray"}, [{"text": "[", "clickEvent": {"action": "run_command", "value": "/reload"}, "hoverEvent": {"action": "show_text", "contents": {"text": "重载", "color": "yellow"}}}, {"text": "重载", "color": "yellow"}, {"text": "]"}], [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function #fzsd:install"}, "hoverEvent": {"action": "show_text", "contents": [{"text": "安装:", "color": "dark_green"}, {"text": "仅安装上次卸载前已安装的模块", "color": "red"}]}}, {"text": "安装", "color": "dark_green"}, {"text": "]"}], [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function #fzsd:uninstall"}, "hoverEvent": {"action": "show_text", "contents": [{"text": "卸载:", "color": "dark_red"}, {"text": "将保留模块安装记录", "color": "red"}]}}, {"text": "卸载", "color": "dark_red"}, {"text": "]"}], [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function #fzsd:reinstall"}, "hoverEvent": {"action": "show_text", "contents": [{"text": "重装:", "color": "gold"}, {"text": "可能可以修复一些奇怪问题,", "color": "white"}, {"text": "将保留模块安装记录", "color": "red"}]}}, {"text": "重装", "color": "gold"}, {"text": "]"}], [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function #fzsd:deep_install"}, "hoverEvent": {"action": "show_text", "contents": [{"text": "深度安装:", "color": "dark_green"}, {"text": "将安装所有模块", "color": "red"}]}}, {"text": "深度安装", "color": "dark_green"}, {"text": "]"}], [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function #fzsd:deep_uninstall"}, "hoverEvent": {"action": "show_text", "contents": [{"text": "深度卸载:", "color": "dark_red"}, {"text": "将清除模块安装记录", "color": "red"}]}}, {"text": "深度卸载", "color": "dark_red"}, {"text": "]"}], [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function #fzsd:deep_reinstall"}, "hoverEvent": {"action": "show_text", "contents": [{"text": "深度重装:", "color": "gold"}, {"text": "可能可以修复一些奇怪问题,", "color": "white"}, {"text": "将清除模块安装记录", "color": "red"}]}}, {"text": "深度重装", "color": "gold"}, {"text": "]"}]]]
|
||||
|
||||
|
||||
tellraw @s [{"text": "日志等级:"}, [{"text": "", "color": "dark_gray"}, [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function fzsd:logger/level/fine"}, "hoverEvent": {"action": "show_text", "contents": {"text": "详细", "color": "gray"}}}, {"text": "详细", "color": "gray"}, {"text": "]"}], [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function fzsd:logger/level/debug"}, "hoverEvent": {"action": "show_text", "contents": {"text": "调试", "color": "dark_aqua"}}}, {"text": "调试", "color": "dark_aqua"}, {"text": "]"}], [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function fzsd:logger/level/info"}, "hoverEvent": {"action": "show_text", "contents": {"text": "信息", "color": "green"}}}, {"text": "信息", "color": "green"}, {"text": "]"}]]]
|
||||
|
||||
|
||||
tellraw @s [{"text": "血量显示:"}, [{"text": "", "color": "dark_gray"}, [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function #fzsd:module/health/install"}, "hoverEvent": {"action": "show_text", "contents": {"text": "安装", "color": "dark_green"}}}, {"text": "安装", "color": "dark_green"}, {"text": "]"}], [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function #fzsd:module/health/uninstall"}, "hoverEvent": {"action": "show_text", "contents": {"text": "卸载", "color": "dark_red"}}}, {"text": "卸载", "color": "dark_red"}, {"text": "]"}]]]
|
||||
|
||||
tellraw @s [{"text": "- 名牌下方:", "color": "gray"}, [{"text": "", "color": "dark_gray"}, [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function admin.fzsd:module/health/below_name/on"}, "hoverEvent": {"action": "show_text", "contents": {"text": "显示", "color": "dark_green"}}}, {"text": "显示", "color": "dark_green"}, {"text": "]"}], [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function admin.fzsd:module/health/below_name/off"}, "hoverEvent": {"action": "show_text", "contents": {"text": "隐藏", "color": "dark_red"}}}, {"text": "隐藏", "color": "dark_red"}, {"text": "]"}]]]
|
||||
|
||||
tellraw @s [{"text": "- 玩家列表内:", "color": "gray"}, [{"text": "", "color": "dark_gray"}, [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function admin.fzsd:module/health/list/on"}, "hoverEvent": {"action": "show_text", "contents": {"text": "显示", "color": "dark_green"}}}, {"text": "显示", "color": "dark_green"}, {"text": "]"}], [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function admin.fzsd:module/health/list/off"}, "hoverEvent": {"action": "show_text", "contents": {"text": "隐藏", "color": "dark_red"}}}, {"text": "隐藏", "color": "dark_red"}, {"text": "]"}]]]
|
||||
|
||||
|
||||
tellraw @s [{"text": "玩家位置:"}, [{"text": "", "color": "dark_gray"}, [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function #fzsd:module/here/install"}, "hoverEvent": {"action": "show_text", "contents": {"text": "安装", "color": "dark_green"}}}, {"text": "安装", "color": "dark_green"}, {"text": "]"}], [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function #fzsd:module/here/uninstall"}, "hoverEvent": {"action": "show_text", "contents": {"text": "卸载", "color": "dark_red"}}}, {"text": "卸载", "color": "dark_red"}, {"text": "]"}]]]
|
||||
|
||||
|
||||
tellraw @s [{"text": "交互器:"}, [{"text": "", "color": "dark_gray"}, [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function #fzsd:module/interactor/install"}, "hoverEvent": {"action": "show_text", "contents": {"text": "安装", "color": "dark_green"}}}, {"text": "安装", "color": "dark_green"}, {"text": "]"}], [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function #fzsd:module/interactor/uninstall"}, "hoverEvent": {"action": "show_text", "contents": {"text": "卸载", "color": "dark_red"}}}, {"text": "卸载", "color": "dark_red"}, {"text": "]"}]]]
|
||||
|
||||
|
||||
tellraw @s [{"text": "登录消息:"}, [{"text": "", "color": "dark_gray"}, [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function #fzsd:module/join_message/install"}, "hoverEvent": {"action": "show_text", "contents": {"text": "安装", "color": "dark_green"}}}, {"text": "安装", "color": "dark_green"}, {"text": "]"}], [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function #fzsd:module/join_message/uninstall"}, "hoverEvent": {"action": "show_text", "contents": {"text": "卸载", "color": "dark_red"}}}, {"text": "卸载", "color": "dark_red"}, {"text": "]"}]]]
|
||||
|
||||
|
||||
tellraw @s [{"text": "上一死亡点:"}, [{"text": "", "color": "dark_gray"}, [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function #fzsd:module/last_death/install"}, "hoverEvent": {"action": "show_text", "contents": {"text": "安装", "color": "dark_green"}}}, {"text": "安装", "color": "dark_green"}, {"text": "]"}], [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function #fzsd:module/last_death/uninstall"}, "hoverEvent": {"action": "show_text", "contents": {"text": "卸载", "color": "dark_red"}}}, {"text": "卸载", "color": "dark_red"}, {"text": "]"}]]]
|
||||
|
||||
|
||||
tellraw @s [{"text": "上次穿出的下界传送门:"}, [{"text": "", "color": "dark_gray"}, [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function #fzsd:module/last_nether_portal/install"}, "hoverEvent": {"action": "show_text", "contents": {"text": "安装", "color": "dark_green"}}}, {"text": "安装", "color": "dark_green"}, {"text": "]"}], [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function #fzsd:module/last_nether_portal/uninstall"}, "hoverEvent": {"action": "show_text", "contents": {"text": "卸载", "color": "dark_red"}}}, {"text": "卸载", "color": "dark_red"}, {"text": "]"}]]]
|
||||
|
||||
|
||||
tellraw @s [{"text": "上一出生点:"}, [{"text": "", "color": "dark_gray"}, [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function #fzsd:module/last_spawn_point/install"}, "hoverEvent": {"action": "show_text", "contents": {"text": "安装", "color": "dark_green"}}}, {"text": "安装", "color": "dark_green"}, {"text": "]"}], [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function #fzsd:module/last_spawn_point/uninstall"}, "hoverEvent": {"action": "show_text", "contents": {"text": "卸载", "color": "dark_red"}}}, {"text": "卸载", "color": "dark_red"}, {"text": "]"}]]]
|
||||
|
||||
|
||||
tellraw @s [{"text": "计分板:"}, [{"text": "", "color": "dark_gray"}, [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function #fzsd:module/scoreboard/install"}, "hoverEvent": {"action": "show_text", "contents": {"text": "安装", "color": "dark_green"}}}, {"text": "安装", "color": "dark_green"}, {"text": "]"}], [{"text": "[", "clickEvent": {"action": "run_command", "value": "/function #fzsd:module/scoreboard/uninstall"}, "hoverEvent": {"action": "show_text", "contents": {"text": "卸载", "color": "dark_red"}}}, {"text": "卸载", "color": "dark_red"}, {"text": "]"}]]]
|
||||
@@ -1 +0,0 @@
|
||||
function #fzsd:deep_install
|
||||
@@ -1 +0,0 @@
|
||||
function #fzsd:deep_reinstall
|
||||
@@ -1 +0,0 @@
|
||||
function #fzsd:deep_uninstall
|
||||
@@ -1 +0,0 @@
|
||||
function #fzsd:install
|
||||
@@ -1 +0,0 @@
|
||||
function #fzsd:load
|
||||
@@ -1 +0,0 @@
|
||||
function fzsd:logger/level/debug
|
||||
@@ -1 +0,0 @@
|
||||
function fzsd:logger/level/fine
|
||||
@@ -1 +0,0 @@
|
||||
function fzsd:logger/level/info
|
||||
+1
@@ -1 +1,2 @@
|
||||
data modify storage fzsd:config fzsd.module.health.display.below_name set value 0b
|
||||
function #fzsd:module/health/try_load
|
||||
+1
@@ -1 +1,2 @@
|
||||
data modify storage fzsd:config fzsd.module.health.display.below_name set value 1b
|
||||
function #fzsd:module/health/try_load
|
||||
+1
@@ -1 +1,2 @@
|
||||
data modify storage fzsd:config fzsd.module.health.display.list set value 0b
|
||||
function #fzsd:module/health/try_load
|
||||
+1
@@ -1 +1,2 @@
|
||||
data modify storage fzsd:config fzsd.module.health.display.list set value 1b
|
||||
function #fzsd:module/health/try_load
|
||||
@@ -1 +0,0 @@
|
||||
function #fzsd:reinstall
|
||||
@@ -1 +0,0 @@
|
||||
function #fzsd:uninstall
|
||||
@@ -1,4 +1,4 @@
|
||||
execute store success storage fzsd:version fzsd.need_update int 1 run data merge storage fzsd:version {fzsd: {version: '3.0.0-beta.6'}}
|
||||
execute store success storage fzsd:version fzsd.need_update int 1 run data merge storage fzsd:version {fzsd: {version: '3.0.0-beta.9'}}
|
||||
execute if data storage fzsd:version fzsd{need_update: 1} run function fzsd:system/update
|
||||
function fzsd:system/carpet/try_load_fzsd_score
|
||||
function #fzsd:load
|
||||
|
||||
@@ -2,3 +2,6 @@ execute unless data storage fzsd:config fzsd.module.health.display{below_name: 0
|
||||
execute if data storage fzsd:config fzsd.module.health.display{below_name: 0b} run scoreboard objectives setdisplay belowName
|
||||
execute unless data storage fzsd:config fzsd.module.health.display{list: 0b} run scoreboard objectives setdisplay list fzsd.module.health
|
||||
execute if data storage fzsd:config fzsd.module.health.display{list: 0b} run scoreboard objectives setdisplay list
|
||||
|
||||
## 日志
|
||||
execute if score fzsd.logger.level fzsd.variable.integer matches ..500 run tellraw @a [{"nbt": "fzsd.level.info", "interpret": true, "storage": "fzsd:logger"}, {"text": "已加载组件:玩家血量显示"}]
|
||||
@@ -0,0 +1,2 @@
|
||||
## 判断是否安装,如果安装则加载
|
||||
execute if data storage fzsd:install fzsd.module{health:1b} run function #fzsd:module/health/load
|
||||
@@ -2,8 +2,6 @@
|
||||
execute store result storage fzsd:here fzsd.x int 1 run data get entity @s Pos[0]
|
||||
execute store result storage fzsd:here fzsd.y int 1 run data get entity @s Pos[1]
|
||||
execute store result storage fzsd:here fzsd.z int 1 run data get entity @s Pos[2]
|
||||
data modify storage fzsd:here fzsd.message.dimension set from storage fzsd:global fzsd.api.dimension.name
|
||||
data modify storage fzsd:here fzsd.message.position set value '[{"text": "[", "color": "green"}, {"nbt": "fzsd.x", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.y", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.z", "storage": "fzsd:here"}, {"text": "]"}]'
|
||||
data modify storage fzsd:here fzsd.message.append set value ''
|
||||
|
||||
## 调试
|
||||
|
||||
@@ -1 +1 @@
|
||||
tellraw @a [{"text": "", "color": "white"}, {"selector": "@s"}, {"text": "说:"}, {"text": "我在"}, {"nbt": "fzsd.message.dimension", "interpret": true, "storage": "fzsd:here"}, {"nbt": "fzsd.message.position", "interpret": true, "storage": "fzsd:here"}, {"nbt": "fzsd.message.append", "interpret": true, "storage": "fzsd:here"}]
|
||||
tellraw @a [{"selector": "@s"}, [{"text": "说:我在", "color": "white"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": " [", "color": "green"}, {"nbt": "fzsd.x", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.y", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.z", "storage": "fzsd:here"}, {"text": "]"}], {"nbt": "fzsd.message.append", "interpret": true, "storage": "fzsd:here"}]]
|
||||
@@ -1 +1 @@
|
||||
tellraw @s [{"text": "你在", "color": "white"}, {"nbt": "fzsd.message.dimension", "interpret": true, "storage": "fzsd:here"}, {"nbt": "fzsd.message.position", "interpret": true, "storage": "fzsd:here"}, {"nbt": "fzsd.message.append", "interpret": true, "storage": "fzsd:here"}]
|
||||
tellraw @s [{"text": "你在", "color": "white"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": " [", "color": "green"}, {"nbt": "fzsd.x", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.y", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.z", "storage": "fzsd:here"}, {"text": "]"}], {"nbt": "fzsd.message.append", "interpret": true, "storage": "fzsd:here"}]
|
||||
@@ -0,0 +1,2 @@
|
||||
## 判断是否安装,如果安装则加载
|
||||
execute if data storage fzsd:install fzsd.module{interactor:1b} run function #fzsd:module/interactor/load
|
||||
@@ -1,2 +1,2 @@
|
||||
execute if data entity @s LastDeathLocation run tellraw @s [{"text": "你上次死亡于"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": "[", "color": "green"}, {"nbt": "fzsd.x", "storage": "fzsd:last_death"}, {"text": ", "}, {"nbt": "fzsd.y", "storage": "fzsd:last_death"}, {"text": ", "}, {"nbt": "fzsd.z", "storage": "fzsd:last_death"}, {"text": "]"}]]
|
||||
execute if data entity @s LastDeathLocation run tellraw @s [{"text": "你上次死亡于"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": " [", "color": "green"}, {"nbt": "fzsd.x", "storage": "fzsd:last_death"}, {"text": ", "}, {"nbt": "fzsd.y", "storage": "fzsd:last_death"}, {"text": ", "}, {"nbt": "fzsd.z", "storage": "fzsd:last_death"}, {"text": "]"}]]
|
||||
execute unless data entity @s LastDeathLocation run tellraw @s {"text": "你从未死亡!"}
|
||||
@@ -1,2 +1,2 @@
|
||||
execute if score @s fzsd.module.last_nether_portal.dimension matches -2147483648..2147483647 run tellraw @a [{"selector": "@s"}, [{"text": "说:我上次穿出的下界传送门位于", "color": "white"}, {"nbt": "fzsd.message", "interpret": true, "storage": "fzsd:last_nether_portal"}]]
|
||||
execute if score @s fzsd.module.last_nether_portal.dimension matches -2147483648..2147483647 run tellraw @a [{"selector": "@s"}, [{"text": "说:我上次穿出的下界传送门位于", "color": "white"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": " [", "color": "green"}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.x"}}, {"text": ", "}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.z"}}, {"text": ", "}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.z"}}, {"text": "]"}]]]
|
||||
execute unless score @s fzsd.module.last_nether_portal.dimension matches -2147483648..2147483647 run tellraw @s {"text": "你从未穿出过下界传送门!"}
|
||||
@@ -2,7 +2,6 @@ scoreboard objectives add fzsd.module.last_nether_portal.dimension dummy
|
||||
scoreboard objectives add fzsd.module.last_nether_portal.x dummy
|
||||
scoreboard objectives add fzsd.module.last_nether_portal.y dummy
|
||||
scoreboard objectives add fzsd.module.last_nether_portal.z dummy
|
||||
data modify storage fzsd:last_nether_portal fzsd.message set value '[{"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": "[", "color": "green"}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.x"}}, {"text": ", "}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.z"}}, {"text": ", "}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.z"}}, {"text": "]"}]]'
|
||||
|
||||
## 标记为已安装
|
||||
data modify storage fzsd:install fzsd.module.last_nether_portal set value 1b
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
execute if score @s fzsd.module.last_nether_portal.dimension matches -2147483648..2147483647 run tellraw @s [{"text": "你上次穿出的下界传送门位于"}, {"nbt": "fzsd.message", "interpret": true, "storage": "fzsd:last_nether_portal"}]
|
||||
execute if score @s fzsd.module.last_nether_portal.dimension matches -2147483648..2147483647 run tellraw @s [{"text": "你上次穿出的下界传送门位于"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": " [", "color": "green"}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.x"}}, {"text": ", "}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.z"}}, {"text": ", "}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.z"}}, {"text": "]"}]]
|
||||
execute unless score @s fzsd.module.last_nether_portal.dimension matches -2147483648..2147483647 run tellraw @s {"text": "你从未穿出过下界传送门!"}
|
||||
@@ -1,2 +1,2 @@
|
||||
execute if data entity @s SpawnDimension run tellraw @s [{"text": "你的上个出生点位于"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": "[x: ", "color": "green"}, {"nbt": "fzsd.x", "storage": "fzsd:last_spawn_point"}, {"text": ", y: "}, {"nbt": "fzsd.y", "storage": "fzsd:last_spawn_point"}, {"text": ", z: "}, {"nbt": "fzsd.z", "storage": "fzsd:last_spawn_point"}, {"text": "]"}]]
|
||||
execute if data entity @s SpawnDimension run tellraw @s [{"text": "你的上个出生点位于"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": " [", "color": "green"}, {"nbt": "fzsd.x", "storage": "fzsd:last_spawn_point"}, {"text": ", "}, {"nbt": "fzsd.y", "storage": "fzsd:last_spawn_point"}, {"text": ", "}, {"nbt": "fzsd.z", "storage": "fzsd:last_spawn_point"}, {"text": "]"}]]
|
||||
execute unless data entity @s SpawnDimension run tellraw @s {"text": "你从未设置过出生点!"}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
## 删除计分板
|
||||
### 总榜
|
||||
scoreboard objectives remove fzsd.module.scoreboard.assign.general
|
||||
scoreboard objectives remove fzsd.module.scoreboard.display.general
|
||||
### 活跃度
|
||||
scoreboard objectives remove fzsd.module.scoreboard.display.activation
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
## 判断是否安装,如果安装则加载
|
||||
execute if data storage fzsd:install fzsd.module{scoreboard:1b} run function #fzsd:module/scoreboard/load
|
||||
@@ -1,6 +0,0 @@
|
||||
# 调用者:#fzsd:module/try_load
|
||||
|
||||
## 判断是否安装,如果安装则加载
|
||||
execute if data storage fzsd:install fzsd.module{health:1b} run function #fzsd:module/health/load
|
||||
execute if data storage fzsd:install fzsd.module{interactor:1b} run function #fzsd:module/interactor/load
|
||||
execute if data storage fzsd:install fzsd.module{scoreboard:1b} run function #fzsd:module/scoreboard/load
|
||||
@@ -1,2 +1,2 @@
|
||||
## 将模块安装记录缓存,因为模块的卸载函数会覆盖该记录
|
||||
data modify storage fzsd:installed fzsd.cache set from storage fzsd:installed fzsd.module
|
||||
data modify storage fzsd:install fzsd.cache set from storage fzsd:install fzsd.module
|
||||
@@ -1,3 +1,3 @@
|
||||
## 恢复模块安装记录
|
||||
data modify storage fzsd:installed fzsd.module set from storage fzsd:installed fzsd.cache
|
||||
data remove storage fzsd:installed fzsd.cache
|
||||
data modify storage fzsd:install fzsd.module set from storage fzsd:install fzsd.cache
|
||||
data remove storage fzsd:install fzsd.cache
|
||||
@@ -1,2 +1,2 @@
|
||||
execute if data storage fzsd:installed fzsd{global: 1b} run function #fzsd:uninstall
|
||||
execute if data storage fzsd:install fzsd{global: 1b} run function #fzsd:uninstall
|
||||
function #fzsd:install
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"fzsd:module/health/try_load"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"fzsd:module/interactor/try_load"
|
||||
]
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
"replace": false,
|
||||
"values": [
|
||||
"fzsd:module/scoreboard/display/reset_id",
|
||||
"fzsd:module/scoreboard/display/register_id",
|
||||
"#fzsd:module/scoreboard/display/register_id",
|
||||
"#fzsd:module/scoreboard/display/set_text",
|
||||
"fzsd:module/scoreboard/display/carousel/loop",
|
||||
"fzsd:module/scoreboard/load"
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"fzsd:module/scoreboard/try_load"
|
||||
]
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
"__comment": "调用者:fzsd:load",
|
||||
"replace": false,
|
||||
"values": [
|
||||
"fzsd:module/try_load"
|
||||
"#fzsd:module/health/try_load",
|
||||
"#fzsd:module/interactor/try_load",
|
||||
"#fzsd:module/scoreboard/try_load"
|
||||
]
|
||||
}
|
||||
@@ -5,8 +5,8 @@
|
||||
"#fzsd:system/uninstall/before",
|
||||
"fzsd:system/uninstall/cache_module_install_data",
|
||||
"#fzsd:system/uninstall/module",
|
||||
"fzsd:system/uninstall/restore_module_install_data",
|
||||
"#fzsd:system/uninstall/system",
|
||||
"fzsd:system/uninstall/restore_module_install_data",
|
||||
"#fzsd:system/uninstall/after"
|
||||
]
|
||||
}
|
||||
+129
-96
@@ -1,7 +1,7 @@
|
||||
// 计分板模块扩展插件
|
||||
// 忽略假人分数
|
||||
// **请勿修改文件名!!**
|
||||
global_app_version = '1.0-beta.4';
|
||||
global_app_version = '1.0-beta.7';
|
||||
|
||||
__config() -> {
|
||||
'scope' -> 'global',
|
||||
@@ -13,148 +13,177 @@ __config() -> {
|
||||
'commands' -> {
|
||||
'' -> 'help',
|
||||
'help' -> 'help',
|
||||
'delete_old' -> 'delete_old',
|
||||
'merge_old' -> 'restore_merge_old',
|
||||
'delete_old <fzsd_version>' -> 'delete_old',
|
||||
'update_from <fzsd_version>' -> 'update_from',
|
||||
'restore_from_stats' -> 'restore_from_stats',
|
||||
'recalculate_total' -> 'recalculate_total_scores'
|
||||
'recalculate_total' -> 'recalculate_total_scores',
|
||||
'commandPlayer <boolean>' -> 'command_player'
|
||||
},
|
||||
'arguments' -> {
|
||||
'boolean' -> {
|
||||
'type' -> 'bool'
|
||||
},
|
||||
'fzsd_version' -> {
|
||||
'type' -> 'term',
|
||||
'suggest' -> [
|
||||
'2.x',
|
||||
'3.0-beta.4'
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
__on_start() -> (
|
||||
global_team_cache = read_file('team_cache', 'json');
|
||||
debug(global_team_cache);
|
||||
if(global_team_cache == null, // carpet 1.4.69 兼容
|
||||
global_team_cache = {};
|
||||
);
|
||||
print(player('all'), 'fzsd_score.sc已加载!');
|
||||
);
|
||||
|
||||
__on_close() -> (
|
||||
debug(global_team_cache);
|
||||
delete_file('team_cache', 'json');
|
||||
write_file('team_cache', 'json', global_team_cache);
|
||||
);
|
||||
|
||||
__on_player_connects(player) -> (
|
||||
debug(player ~ 'name');
|
||||
debug(player ~ 'player_type');
|
||||
debug(player ~ 'team');
|
||||
debug(global_team_cache);
|
||||
if(player ~ 'player_type' == 'fake' && player ~ 'team' != 'fz.module.scoreboard.fake',
|
||||
player_type = player ~ 'player_type';
|
||||
player_team = player ~ 'team';
|
||||
player_name = player ~ 'name';
|
||||
if(player_type == 'fake' && player_team != 'fzsd.module.scoreboard.fake',
|
||||
(
|
||||
debug('1~');
|
||||
global_team_cache:(player ~ 'name') = player ~ 'team';
|
||||
debug(global_team_cache);
|
||||
team_add('fz.module.scoreboard.fake', player);
|
||||
global_team_cache:player_name = player_team;
|
||||
team_add('fzsd.module.scoreboard.fake', player);
|
||||
),
|
||||
player ~ 'player_type' == 'shadow' && player ~ 'team' != 'fz.module.scoreboard.shadow',
|
||||
player_type == 'shadow' && player_team != 'fzsd.module.scoreboard.shadow',
|
||||
(
|
||||
debug('2~');
|
||||
global_team_cache:(player ~ 'name') = player ~ 'team';
|
||||
team_add('fz.module.scoreboard.shadow', player);
|
||||
global_team_cache:player_name = player_team;
|
||||
team_add('fzsd.module.scoreboard.shadow', player);
|
||||
),
|
||||
try_restore_team_from_cache(player);
|
||||
);
|
||||
debug(global_team_cache);
|
||||
);
|
||||
|
||||
__on_player_disconnects(player, reason) -> (
|
||||
debug(player ~ 'name');
|
||||
debug(player ~ 'player_type');
|
||||
debug(player ~ 'team');
|
||||
debug(global_team_cache);
|
||||
try_restore_team_from_cache(player);
|
||||
);
|
||||
|
||||
try_restore_team_from_cache(player) -> (
|
||||
player_team = player ~ 'team';
|
||||
player_name = player ~ 'name';
|
||||
debug('restore_team_from_cache');
|
||||
if(player ~ 'team' == 'fz.module.scoreboard.fake'
|
||||
|| player ~ 'team' == 'fz.module.scoreboard.shadow',
|
||||
debug(global_team_cache);
|
||||
if(global_team_cache:(player ~ 'name') == null,
|
||||
if(player_team == 'fzsd.module.scoreboard.fake'
|
||||
|| player_team == 'fzsd.module.scoreboard.shadow',
|
||||
if(global_team_cache:player_name == null,
|
||||
(
|
||||
debug('global_team_cache:(player ~ \'name\') == null');
|
||||
team_leave(player);
|
||||
),
|
||||
debug('global_team_cache:(player ~ \'name\') != null');
|
||||
team_add(global_team_cache:(player ~ 'name') , player);
|
||||
delete(global_team_cache:(player ~ 'name'));
|
||||
team_add(global_team_cache:player_name , player);
|
||||
delete(global_team_cache:player_name);
|
||||
);
|
||||
);
|
||||
);
|
||||
|
||||
help() -> (
|
||||
print('这是一条帮助');
|
||||
print('暂未开发');
|
||||
return(0);
|
||||
);
|
||||
|
||||
delete_old() -> (
|
||||
old_scoreboards = [
|
||||
'usedDiaAxe', 'usedDiaPickaxe', 'usedDiaShovel', 'usedDiaHoe', 'usedIroAxe', 'usedIroPickaxe',
|
||||
'usedIroShovel', 'usedIroHoe', 'usedStoAxe', 'usedStoPickaxe', 'usedStoShovel', 'usedStoHoe',
|
||||
'usedWooAxe', 'usedWooPickaxe', 'usedWooShovel', 'usedWooHoe', 'usedGolAxe', 'usedGolPickaxe',
|
||||
'usedGolShovel', 'usedGolHoe', 'usedNetAxe', 'usedNetPickaxe', 'usedNetShovel', 'usedNetHoe',
|
||||
'usedShears', 'damageTaken', '10xDamageTaken', 'deathCounter', 'deathTester', 'digCounter',
|
||||
'fishingCounter', 'fishingTester', 'killCounter', 'tradingCounter', 'totalList',
|
||||
'bedrockBreaked', 'fz.bbl', 'fz.aviate1m', 'fz.aviateCounter', 'fz.aviateOneTime', 'Health',
|
||||
'carpetBot', 'parameter'
|
||||
];
|
||||
delete_old(fzsd_version) -> (
|
||||
old_scoreboards = [];
|
||||
if(fzsd_version == '2.x',
|
||||
(
|
||||
old_scoreboards = ['usedDiaAxe', 'usedDiaPickaxe', 'usedDiaShovel', 'usedDiaHoe', 'usedIroAxe','usedIroPickaxe', 'usedIroShovel', 'usedIroHoe', 'usedStoAxe', 'usedStoPickaxe', 'usedStoShovel', 'usedStoHoe', 'usedWooAxe', 'usedWooPickaxe', 'usedWooShovel', 'usedWooHoe', 'usedGolAxe', 'usedGolPickaxe', 'usedGolShovel', 'usedGolHoe', 'usedNetAxe', 'usedNetPickaxe', 'usedNetShovel', 'usedNetHoe', 'usedShears', 'damageTaken', '10xDamageTaken', 'deathCounter', 'deathTester', 'digCounter', 'fishingCounter', 'fishingTester', 'killCounter', 'tradingCounter', 'totalList', 'bedrockBreaked', 'fz.bbl', 'fz.aviate1m', 'fz.aviateCounter', 'fz.aviateOneTime', 'Health', 'carpetBot', 'parameter'];
|
||||
team_remove('carpetBot');
|
||||
team_remove('shadowedPlayer');
|
||||
),
|
||||
fzsd_version == '3.0-beta.4',
|
||||
(
|
||||
old_scoreboards = ['fz.module.scoreboard.display.activation', 'fz.module.scoreboard.display.damage_taken', 'fz.module.scoreboard.display.death_count', 'fz.module.scoreboard.display.dig_count', 'fz.module.scoreboard.display.fishing_count', 'fz.module.scoreboard.display.kill_count', 'fz.module.scoreboard.display.trade_count', 'fz.module.scoreboard.display.bedrock_broke_count', 'fz.module.scoreboard.display.aviating_distance', 'fz.module.scoreboard.display.placement_count', 'fz.module.scoreboard.assign.general', 'fz.module.scoreboard.display.general', 'fz.module.scoreboard.interactor'];
|
||||
team_remove('fz.module.scoreboard.fake');
|
||||
team_remove('fz.module.scoreboard.shadow');
|
||||
)
|
||||
);
|
||||
for(old_scoreboards, scoreboard_remove(_));
|
||||
team_remove('carpetBot');
|
||||
team_remove('shadowedPlayer');
|
||||
print('已清除旧版计分板!');
|
||||
return(0);
|
||||
);
|
||||
|
||||
restore_merge_old() -> (
|
||||
|
||||
merge_score('activation', 'fz.module.scoreboard.display.activation');
|
||||
merge_score('damageTaken', 'fz.module.scoreboard.display.damage_taken');
|
||||
merge_score('deathCounter', 'fz.module.scoreboard.display.death_count');
|
||||
merge_score('digCounter', 'fz.module.scoreboard.display.dig_count');
|
||||
merge_score('fishingCounter', 'fz.module.scoreboard.display.fishing_count');
|
||||
merge_score('killCounter', 'fz.module.scoreboard.display.kill_count');
|
||||
merge_score('tradingCounter', 'fz.module.scoreboard.display.trade_count');
|
||||
merge_score('bedrockBreaked', 'fz.module.scoreboard.display.bedrock_broke_count');
|
||||
merge_score('fz.aviate1m', 'fz.module.scoreboard.display.aviating_distance');
|
||||
// restore_score('fz.module.scoreboard.display.placement_count', );
|
||||
update_from(fzsd_version) -> (
|
||||
params = [];
|
||||
if(fzsd_version == '2.x',
|
||||
(
|
||||
params = [
|
||||
['activation', 'fzsd.module.scoreboard.display.activation'],
|
||||
['damageTaken', 'fzsd.module.scoreboard.display.damage_taken'],
|
||||
['deathCounter', 'fzsd.module.scoreboard.display.death_count'],
|
||||
['digCounter', 'fzsd.module.scoreboard.display.dig_count'],
|
||||
['fishingCounter', 'fzsd.module.scoreboard.display.fishing_count'],
|
||||
['killCounter', 'fzsd.module.scoreboard.display.kill_count'],
|
||||
['tradingCounter', 'fzsd.module.scoreboard.display.trade_count'],
|
||||
['bedrockBreaked', 'fzsd.module.scoreboard.display.bedrock_broke_count'],
|
||||
['fz.aviate1m', 'fzsd.module.scoreboard.display.aviating_distance']
|
||||
['fz.bbl', 'fzsd.extra.bbl.display']
|
||||
]
|
||||
),
|
||||
fzsd_version == '3.0-beta.4',
|
||||
(
|
||||
params = [
|
||||
['fz.module.scoreboard.display.activation', 'fzsd.module.scoreboard.display.activation'],
|
||||
['fz.module.scoreboard.display.damage_taken', 'fzsd.module.scoreboard.display.damage_taken'],
|
||||
['fz.module.scoreboard.display.death_count', 'fzsd.module.scoreboard.display.death_count'],
|
||||
['fz.module.scoreboard.display.dig_count', 'fzsd.module.scoreboard.display.dig_count'],
|
||||
['fz.module.scoreboard.display.fishing_count', 'fzsd.module.scoreboard.display.fishing_count'],
|
||||
['fz.module.scoreboard.display.kill_count', 'fzsd.module.scoreboard.display.kill_count'],
|
||||
['fz.module.scoreboard.display.trade_count', 'fzsd.module.scoreboard.display.trade_count'],
|
||||
['fz.module.scoreboard.display.bedrock_broke_count', 'fzsd.module.scoreboard.display.bedrock_broke_count'],
|
||||
['fz.module.scoreboard.display.aviating_distance', 'fzsd.module.scoreboard.display.aviating_distance'],
|
||||
['fz.module.scoreboard.display.placement_count', 'fzsd.module.scoreboard.display.placement_count']
|
||||
]
|
||||
)
|
||||
);
|
||||
for(params, merge_score(..._, fzsd_version));
|
||||
|
||||
// 清除旧计分板
|
||||
delete_old();
|
||||
delete_old(fzsd_version);
|
||||
|
||||
print('完成!');
|
||||
return(0);
|
||||
);
|
||||
|
||||
merge_score(from, to) -> (
|
||||
merge_score(from, to, fzsd_version) -> (
|
||||
// 如果目标计分板不存在则创建
|
||||
if(scoreboard() ~ to == null, scoreboard_add(to));
|
||||
|
||||
// 旧版数据包的假人列表
|
||||
fake_players = team_list('carpetBot');
|
||||
// new_players = [];
|
||||
|
||||
if(fzsd_version == '2.x',
|
||||
(
|
||||
// 2.x数据包的假人列表
|
||||
fake_players = team_list('carpetBot');
|
||||
|
||||
// 新数据包的计分板中存储的玩家列表
|
||||
new_players = scoreboard('fzsd.module.interactor.trigger');
|
||||
|
||||
for(fake_players, delete(new_players, _));
|
||||
),
|
||||
fzsd_version == '3.0-beta.4',
|
||||
(
|
||||
new_players = scoreboard('fz.module.interactor.trigger');
|
||||
)
|
||||
);
|
||||
|
||||
// 新数据包的计分板中存储的玩家列表
|
||||
new_players = scoreboard('fz.module.interactor.trigger');
|
||||
debug('2' + new_players);
|
||||
for(scoreboard(from),
|
||||
debug('3' + _);
|
||||
debug('3.1' + contains(fake_players, _));
|
||||
debug('3.2' + contains(new_players, _));
|
||||
debug('3.3' + str(_ != total_name_old));
|
||||
debug('3.4' + str((!contains(fake_players, _)
|
||||
|| contains(new_players, _)
|
||||
) && !(_ ~ '\\W')));
|
||||
if((!contains(fake_players, _)
|
||||
|| contains(new_players, _)
|
||||
) && !(_ ~ '\\W'),
|
||||
debug('4' + _);
|
||||
debug('from' + scoreboard(from, _));
|
||||
debug('to' + scoreboard(to, _));
|
||||
if(!(_ ~ '\\W'),
|
||||
scoreboard(to, _, scoreboard(to, _) + scoreboard(from, _));
|
||||
);
|
||||
);
|
||||
|
||||
print('已合并:' + to);
|
||||
|
||||
// 重新计算总分
|
||||
recalculate_total_score(to, get_total_score_name_new(to));
|
||||
|
||||
print('已合并:' + to);
|
||||
return(0);
|
||||
);
|
||||
|
||||
@@ -167,10 +196,10 @@ get_total_score_name_new(scoreboard) -> (
|
||||
|
||||
// 将系统总榜分数加上最小int值,使其成为最低分
|
||||
scoreboard(
|
||||
'fz.module.scoreboard.assign.general',
|
||||
'fzsd.module.scoreboard.assign.general',
|
||||
system_total_name,
|
||||
scoreboard(
|
||||
'fz.module.scoreboard.assign.general',
|
||||
'fzsd.module.scoreboard.assign.general',
|
||||
system_total_name
|
||||
) + INT_MIN
|
||||
);
|
||||
@@ -189,15 +218,14 @@ get_total_score_name_new(scoreboard) -> (
|
||||
last_min_player = _;
|
||||
)
|
||||
);
|
||||
debug(_);
|
||||
);
|
||||
|
||||
// 恢复总榜分数
|
||||
scoreboard(
|
||||
'fz.module.scoreboard.assign.general',
|
||||
'fzsd.module.scoreboard.assign.general',
|
||||
system_total_name,
|
||||
scoreboard(
|
||||
'fz.module.scoreboard.assign.general',
|
||||
'fzsd.module.scoreboard.assign.general',
|
||||
system_total_name
|
||||
) - INT_MIN
|
||||
);
|
||||
@@ -209,15 +237,15 @@ get_total_score_name_new(scoreboard) -> (
|
||||
|
||||
recalculate_total_scores() -> (
|
||||
scoreboards = [
|
||||
'fz.module.scoreboard.display.activation',
|
||||
'fz.module.scoreboard.display.damage_taken',
|
||||
'fz.module.scoreboard.display.death_count',
|
||||
'fz.module.scoreboard.display.dig_count',
|
||||
'fz.module.scoreboard.display.fishing_count',
|
||||
'fz.module.scoreboard.display.kill_count',
|
||||
'fz.module.scoreboard.display.trade_count',
|
||||
'fz.module.scoreboard.display.bedrock_broke_count',
|
||||
'fz.module.scoreboard.display.aviating_distance'
|
||||
'fzsd.module.scoreboard.display.activation',
|
||||
'fzsd.module.scoreboard.display.damage_taken',
|
||||
'fzsd.module.scoreboard.display.death_count',
|
||||
'fzsd.module.scoreboard.display.dig_count',
|
||||
'fzsd.module.scoreboard.display.fishing_count',
|
||||
'fzsd.module.scoreboard.display.kill_count',
|
||||
'fzsd.module.scoreboard.display.trade_count',
|
||||
'fzsd.module.scoreboard.display.bedrock_broke_count',
|
||||
'fzsd.module.scoreboard.display.aviating_distance'
|
||||
];
|
||||
for(scoreboards,recalculate_total_score(_, get_total_score_name_new(_)));
|
||||
print('完成!');
|
||||
@@ -234,7 +262,7 @@ recalculate_total_score(scoreboard, total_score_name_new) -> (
|
||||
);
|
||||
// 赋值总分到系统总分计分板
|
||||
scoreboard(
|
||||
'fz.module.scoreboard.assign.general',
|
||||
'fzsd.module.scoreboard.assign.general',
|
||||
replace(scoreboard, 'display', 'total'),
|
||||
total_score
|
||||
);
|
||||
@@ -248,12 +276,11 @@ display_total_score(scoreboard) -> (
|
||||
str_1 = split('\\.', scoreboard);
|
||||
function_name = str_1:(length(str_1) - 1);
|
||||
// 运行函数,将分数赋值到显示计分板上
|
||||
run('function #fz:module/scoreboard/assign/scoreboard/general/' + function_name);
|
||||
run('function #fzsd:module/scoreboard/assign/scoreboard/general/' + function_name);
|
||||
return(0);
|
||||
);
|
||||
|
||||
restore_from_stats() -> (
|
||||
|
||||
print('暂未开发');
|
||||
return(0);
|
||||
);
|
||||
@@ -263,6 +290,12 @@ merge_stat(scoreboard, ...stats) -> (
|
||||
return(0);
|
||||
);
|
||||
|
||||
command_player(boolean) -> (
|
||||
print(run('carpet setDefault commandPlayer ' + str(boolean)):1:0);
|
||||
);
|
||||
|
||||
// 工具函数
|
||||
|
||||
contains(list, value) -> (
|
||||
return(list ~ value != null);
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user