Skip to content

Commit 9eea28d

Browse files
committed
3.2.5 自定义节点权限
1 parent f9d485f commit 9eea28d

4 files changed

Lines changed: 23 additions & 7 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>cn.handyplus.chat</groupId>
88
<artifactId>PlayerChat</artifactId>
9-
<version>3.2.4</version>
9+
<version>3.2.5</version>
1010
<description>一款有点好用的聊天插件</description>
1111

1212
<properties>

src/main/java/cn/handyplus/chat/core/ChatUtil.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ public synchronized static void sendTextMsg(BcUtil.BcMessageParam param, boolean
118118
Set<String> keySet = HandyConfigUtil.getKey(ConfigUtil.CHAT_CONFIG, "chat." + channelEnable + ".format");
119119
List<ChatChildParam> childList = new ArrayList<>();
120120
for (String key : keySet) {
121+
// 节点权限
122+
String permission = ConfigUtil.CHAT_CONFIG.getString("chat." + channelEnable + ".format." + key + ".permission");
123+
if (StrUtil.isNotEmpty(permission) && !player.hasPermission(permission)) {
124+
continue;
125+
}
121126
String text = ConfigUtil.CHAT_CONFIG.getString("chat." + channelEnable + ".format." + key + ".text");
122127
List<String> hover = ConfigUtil.CHAT_CONFIG.getStringList("chat." + channelEnable + ".format." + key + ".hover");
123128
String click = ConfigUtil.CHAT_CONFIG.getString("chat." + channelEnable + ".format." + key + ".click");

src/main/resources/chat.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ chat:
3030
default:
3131
# 是否开启
3232
enable: true
33-
# 频道名称 1.0.6+
33+
# 频道名称
3434
name: "&7[&a默认频道&7]"
35-
# 聊天格式 支持变量
35+
# 聊天自定义节点 你可以自定义无数节点 支持变量
3636
format:
37-
# 聊天前缀
37+
# 自定义的前缀节点
3838
prefix:
3939
text: '${channel}%playerTitle_use%'
4040
# 1.16+可用hover
@@ -43,14 +43,25 @@ chat:
4343
- '&8▪ &6点击可执行命令/spawn'
4444
# 点击后执行的命令
4545
click: '/spawn'
46-
# 聊天玩家名
46+
# 自定义的需要权限的前缀节点
47+
vipPrefix:
48+
# 该节点的权限 每个节点都可以自定义对应的权限,如果不配置默认不需要权限
49+
permission: "playerChat.chat.default.vipPrefix"
50+
text: '${channel}%playerTitle_use%'
51+
# 1.16+可用hover
52+
hover:
53+
- '&8▪ &6所在聊天频道: ${channel}'
54+
- '&8▪ &6点击可执行命令/spawn'
55+
# 点击后执行的命令
56+
click: '/spawn'
57+
# 自定义的玩家名节点
4758
player:
4859
text: '&f${head}${player}&7: '
4960
hover:
5061
- '快点击tpa我啦~'
5162
# 点击后执行的命令
5263
click: '/tpa ${player}'
53-
# 聊天内容
64+
# 自定义的聊天内容节点
5465
msg:
5566
text: '&f${message}'
5667
hover:

src/main/resources/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: PlayerChat
22
main: cn.handyplus.chat.PlayerChat
3-
version: 3.2.4
3+
version: 3.2.5
44
author: handy
55
api-version: 1.13
66
softdepend: [ PlaceholderAPI, DiscordSRV, AuthMe, CatSeedLogin, OauthLogin ]

0 commit comments

Comments
 (0)