fz-survival-datapack/data/fz/functions/logger/install.mcfunction

28 lines
2.0 KiB
Mcfunction
Raw Normal View History

##### 使用方式形如tellraw @a [{"nbt": "fz.exception.load_without_install_exception", "interpret": true, "storage": "fz:logger"}, {"text": "计分板"}]
## 根
data modify storage fz:logger fz.root set value '[{"text": "", "color": "white"}, {"text": "[", "color": "dark_gray"}, {"text": "FZD", "color": "gold"}, {"text": "]", "color": "dark_gray"}]'
## 不同日志等级
### error 800
data modify storage fz:logger fz.level.error set value '[{"text": "", "color": "red"}, {"nbt": "root", "interpret": true, "storage": "fz:logger"}, {"text": "[错误]"}]'
### alert 600
data modify storage fz:logger fz.level.alert set value '[{"text": "", "color": "yellow"}, {"nbt": "fz.root", "interpret": true, "storage": "fz:logger"}, {"text": "[提醒]"}]'
### info 500
data modify storage fz:logger fz.level.info set value '[{"text": "", "color": "green"}, {"nbt": "fz.root", "interpret": true, "storage": "fz:logger"}, {"text": "[信息]"}]'
### debug 400
data modify storage fz:logger fz.level.debug set value '[{"text": "", "color": "dark_aqua"}, {"nbt": "fz.root", "interpret": true, "storage": "fz:logger"}, {"text": "[调试]"}]'
### fine 300
data modify storage fz:logger fz.level.fine set value '[{"text": "", "color": "gray"}, {"nbt": "fz.root", "interpret": true, "storage": "fz:logger"}, {"text": "[详细]"}]'
## 异常
data modify storage fz:logger fz.exception.load_without_install_exception set value '[{"nbt": "fz.level.error", "interpret": true, "storage": "fz:logger"}, {"text": "模块在未安装时被加载:"}]'
## 首次安装时日志等级默认为一般消息
execute unless data storage fz:logger fz.levels.current run data modify storage fz:logger fz.levels.current set value 500
## 标记为已安装
data modify storage fz:installed fz.logger 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": "已安装系统组件:日志"}]