@@ -4,8 +4,8 @@ https://github.com/ApliNi/useTranslatedNames
44
55---
66
7- ## useTranslatedNames `v0.4.1`
8- 内置获取翻译名功能的JSON字符串替换插件, 主要用于翻译 CoreProtect 插件的消息
7+ ## useTranslatedNames
8+ 内置获取翻译名功能的JSON字符串替换插件, 可用于翻译 CoreProtect 等插件的消息
99
1010
1111
@@ -23,45 +23,40 @@ https://github.com/ApliNi/useTranslatedNames
2323
2424### 配置
2525```yaml
26- config-version: 1
27-
26+ config-version: 2
2827list:
2928
3029 # 翻译实体名 :: 24.03/m 前 #**苦力怕** 破坏 草方块
3130 - inspect-length: 1024
32- inspect-prefix: '{"extra":[{"hov'
33- replace-regex: '\{"color":"#31b0e8","text":"#([a-z0-9_]+)§f'
31+ replace-regex: '\{"text":"#([a-z0-9_]+)§f([^"]+)","color":"#31B0E8"\}'
3432 replace-to: >-
35- {"color":"#31b0e8"," text":"#"},
36- {"color ":"#31b0e8 ","translate ":"__TranslatedName__ "},
37- {"text":"
33+ {"text":"§8 #"},
34+ {"translate ":"_$1:TranslatedName_ ","color ":"#31b0e8 "},
35+ {"text":"§f_$2_","color":"#31B0E8"}
3836
3937
4038 # 翻译物品 :: 24.03/m 前 #苦力怕 破坏 **草方块**
4139 - inspect-length: 1024 # 检查消息长度是否小于此值
42- inspect-prefix: '{"extra":[{"hov' # 检查消息是否以此字符串开头
4340 # 替换, 使用正则表达式匹配
44- replace-regex: '\{"color":"#31b0e8","text":"([a-z0-9_]+)(?:§f.{0,3})?"\}'
45- # 替换为
46- # {"translate":"__TranslatedName__"}
47- # __ItemName__ = 正则匹配到的实体/物品/方块名
48- # __TranslatedName__ = 转换后用于翻译的名称 "entity.minecraft.allay"
49- # __ItemType_show__ = 提供给 JSON hoverEvent 使用的物品类型 show_entity, show_item(block)
41+ replace-regex: '\{"text":"([a-z0-9_]+)(?:§f.{0,3})?","color":"#31B0E8"\}'
42+ # _$1_ = 正则匹配到的变量 1, 也可以是 `_$2_` (第 2 个变量)...
43+ # _$1:ItemType_ = 将 _$1_ 用于获取物品类型, 提供给 JSON hoverEvent 使用的物品类型 show_entity, show_item(block)
44+ # _$1:TranslatedName_ = 将 _$1_ 用于名称翻译, 返回与语言路径对应的 KEY, 例如 `entity.minecraft.allay`
5045 replace-to: >-
51- {"color":"#31b0e8"," extra":[
52- {"translate":"__TranslatedName__ "},
53- {"text":" §8__ItemName__ ",
46+ {"extra":[
47+ {"translate":"_$1:TranslatedName_ "},
48+ {"text":" §8_$1_ ",
5449 "hoverEvent":{
5550 "action":"show_text",
56- "contents":{"text":"§7点击复制ID\n§8minecraft:__ItemName__ "}
51+ "contents":{"text":"§7点击复制ID\n§8minecraft:_$1_ "}
5752 },
58- "clickEvent":{"action":"copy_to_clipboard","value":"__ItemName__ "}
53+ "clickEvent":{"action":"copy_to_clipboard","value":"_$1_ "}
5954 }
60- ],"text":""}
55+ ],"color":"#31b0e8"," text":""}
6156```
6257
6358### 依赖
64- - ProtocolLib 5.0 .0
59+ - ProtocolLib 5.2 .0
6560
6661
6762---
0 commit comments