@@ -4,8 +4,8 @@ https://github.com/ApliNi/useTranslatedNames
4
4
5
5
---
6
6
7
- ## useTranslatedNames `v0.4.1`
8
- 内置获取翻译名功能的JSON字符串替换插件, 主要用于翻译 CoreProtect 插件的消息
7
+ ## useTranslatedNames
8
+ 内置获取翻译名功能的JSON字符串替换插件, 可用于翻译 CoreProtect 等插件的消息
9
9
10
10

11
11
@@ -23,45 +23,40 @@ https://github.com/ApliNi/useTranslatedNames
23
23
24
24
### 配置
25
25
```yaml
26
- config-version: 1
27
-
26
+ config-version: 2
28
27
list:
29
28
30
29
# 翻译实体名 :: 24.03/m 前 #**苦力怕** 破坏 草方块
31
30
- 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"\}'
34
32
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"}
38
36
39
37
40
38
# 翻译物品 :: 24.03/m 前 #苦力怕 破坏 **草方块**
41
39
- inspect-length: 1024 # 检查消息长度是否小于此值
42
- inspect-prefix: '{"extra":[{"hov' # 检查消息是否以此字符串开头
43
40
# 替换, 使用正则表达式匹配
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`
50
45
replace-to: >-
51
- {"color":"#31b0e8"," extra":[
52
- {"translate":"__TranslatedName__ "},
53
- {"text":" §8__ItemName__ ",
46
+ {"extra":[
47
+ {"translate":"_$1:TranslatedName_ "},
48
+ {"text":" §8_$1_ ",
54
49
"hoverEvent":{
55
50
"action":"show_text",
56
- "contents":{"text":"§7点击复制ID\n§8minecraft:__ItemName__ "}
51
+ "contents":{"text":"§7点击复制ID\n§8minecraft:_$1_ "}
57
52
},
58
- "clickEvent":{"action":"copy_to_clipboard","value":"__ItemName__ "}
53
+ "clickEvent":{"action":"copy_to_clipboard","value":"_$1_ "}
59
54
}
60
- ],"text":""}
55
+ ],"color":"#31b0e8"," text":""}
61
56
```
62
57
63
58
### 依赖
64
- - ProtocolLib 5.0 .0
59
+ - ProtocolLib 5.2 .0
65
60
66
61
67
62
---
0 commit comments