Skip to content

Commit f0d7579

Browse files
committed
更新自述文件, 添加使用量统计
1 parent c7ec9bc commit f0d7579

File tree

6 files changed

+924
-48
lines changed

6 files changed

+924
-48
lines changed

README.md

+18-23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
## useTranslatedNames `v0.4.1`
2-
内置获取翻译名功能的JSON字符串替换插件, 主要用于翻译 CoreProtect 插件的消息
1+
## useTranslatedNames
2+
内置获取翻译名功能的JSON字符串替换插件, 可用于翻译 CoreProtect 等插件的消息
33

44
![](https://github.com/ApliNi/useTranslatedNames/blob/main/_img/%E6%95%88%E6%9E%9C%E5%9B%BE.png)
55

@@ -17,42 +17,37 @@
1717

1818
### 配置
1919
```yaml
20-
config-version: 1
21-
20+
config-version: 2
2221
list:
2322

2423
# 翻译实体名 :: 24.03/m 前 #**苦力怕** 破坏 草方块
2524
- inspect-length: 1024
26-
inspect-prefix: '{"extra":[{"hov'
27-
replace-regex: '\{"color":"#31b0e8","text":"#([a-z0-9_]+)§f'
25+
replace-regex: '\{"text":"#([a-z0-9_]+)§f([^"]+)","color":"#31B0E8"\}'
2826
replace-to: >-
29-
{"color":"#31b0e8","text":"#"},
30-
{"color":"#31b0e8","translate":"__TranslatedName__"},
31-
{"text":"
27+
{"text":"§8#"},
28+
{"translate":"_$1:TranslatedName_","color":"#31b0e8"},
29+
{"text":"§f_$2_","color":"#31B0E8"}
3230
3331
3432
# 翻译物品 :: 24.03/m 前 #苦力怕 破坏 **草方块**
3533
- inspect-length: 1024 # 检查消息长度是否小于此值
36-
inspect-prefix: '{"extra":[{"hov' # 检查消息是否以此字符串开头
3734
# 替换, 使用正则表达式匹配
38-
replace-regex: '\{"color":"#31b0e8","text":"([a-z0-9_]+)(?:§f.{0,3})?"\}'
39-
# 替换为
40-
# {"translate":"__TranslatedName__"}
41-
# __ItemName__ = 正则匹配到的实体/物品/方块名
42-
# __TranslatedName__ = 转换后用于翻译的名称 "entity.minecraft.allay"
43-
# __ItemType_show__ = 提供给 JSON hoverEvent 使用的物品类型 show_entity, show_item(block)
35+
replace-regex: '\{"text":"([a-z0-9_]+)(?:§f.{0,3})?","color":"#31B0E8"\}'
36+
# _$1_ = 正则匹配到的变量 1, 也可以是 `_$2_` (第 2 个变量)...
37+
# _$1:ItemType_ = 将 _$1_ 用于获取物品类型, 提供给 JSON hoverEvent 使用的物品类型 show_entity, show_item(block)
38+
# _$1:TranslatedName_ = 将 _$1_ 用于名称翻译, 返回与语言路径对应的 KEY, 例如 `entity.minecraft.allay`
4439
replace-to: >-
45-
{"color":"#31b0e8","extra":[
46-
{"translate":"__TranslatedName__"},
47-
{"text":" §8__ItemName__",
40+
{"extra":[
41+
{"translate":"_$1:TranslatedName_"},
42+
{"text":" §8_$1_",
4843
"hoverEvent":{
4944
"action":"show_text",
50-
"contents":{"text":"§7点击复制ID\n§8minecraft:__ItemName__"}
45+
"contents":{"text":"§7点击复制ID\n§8minecraft:_$1_"}
5146
},
52-
"clickEvent":{"action":"copy_to_clipboard","value":"__ItemName__"}
47+
"clickEvent":{"action":"copy_to_clipboard","value":"_$1_"}
5348
}
54-
],"text":""}
49+
],"color":"#31b0e8","text":""}
5550
```
5651
5752
### 依赖
58-
- ProtocolLib 5.0.0
53+
- ProtocolLib 5.2.0

DOCS/MCBBS.md.txt renamed to README_MCBBS.txt

+18-23
Original file line numberDiff line numberDiff line change
@@ -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
![](https://github.com/ApliNi/useTranslatedNames/blob/main/_img/%E6%95%88%E6%9E%9C%E5%9B%BE.png)
1111

@@ -23,45 +23,40 @@ https://github.com/ApliNi/useTranslatedNames
2323

2424
### 配置
2525
```yaml
26-
config-version: 1
27-
26+
config-version: 2
2827
list:
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
---

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.github.aplini</groupId>
88
<artifactId>useTranslatedNames</artifactId>
9-
<version>0.4.1</version>
9+
<version>1.0</version>
1010

1111
<name>useTranslatedNames</name>
1212

0 commit comments

Comments
 (0)