Skip to content

Commit a690a82

Browse files
committed
1.2.6 新增玩家第一次登录后的默认频道配置
1 parent f795669 commit a690a82

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66

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

1212
<properties>
1313
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1414
<spigot-api.vesion>1.21.4-R0.1-SNAPSHOT</spigot-api.vesion>
1515
<lombok.version>1.18.36</lombok.version>
16-
<HandyLib.version>3.17.3</HandyLib.version>
16+
<HandyLib.version>3.17.7</HandyLib.version>
1717
<placeholderapi.version>2.11.6</placeholderapi.version>
1818
<annotations.version>24.1.0</annotations.version>
1919
</properties>

src/main/java/cn/handyplus/chat/listener/PlayerJoinEventListener.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import cn.handyplus.chat.enter.ChatPlayerChannelEnter;
66
import cn.handyplus.chat.service.ChatPlayerChannelService;
77
import cn.handyplus.lib.annotation.HandyListener;
8+
import cn.handyplus.lib.constants.BaseConstants;
89
import cn.handyplus.lib.core.StrUtil;
910
import cn.handyplus.lib.expand.adapter.HandySchedulerUtil;
1011
import cn.handyplus.lib.util.BcUtil;
@@ -35,7 +36,8 @@ public void onEvent(PlayerJoinEvent event) {
3536
Player player = event.getPlayer();
3637
HandySchedulerUtil.runTaskAsynchronously(() -> {
3738
Optional<ChatPlayerChannelEnter> enterOptional = ChatPlayerChannelService.getInstance().findByUid(player.getUniqueId());
38-
String channel = ChatConstants.DEFAULT;
39+
String defaultChannel = BaseConstants.CONFIG.getString("firstLoginChatDefault", ChatConstants.DEFAULT);
40+
String channel = defaultChannel;
3941
if (!enterOptional.isPresent()) {
4042
ChatPlayerChannelEnter enter = new ChatPlayerChannelEnter();
4143
enter.setPlayerName(player.getName());
@@ -47,7 +49,7 @@ public void onEvent(PlayerJoinEvent event) {
4749
channel = enterOptional.get().getChannel();
4850
// 判断是否有权限
4951
if (!enterOptional.get().getIsApi() && !player.hasPermission(ChatConstants.PLAYER_CHAT_USE + channel)) {
50-
ChatPlayerChannelService.getInstance().setChannel(player.getUniqueId(), ChatConstants.DEFAULT);
52+
ChatPlayerChannelService.getInstance().setChannel(player.getUniqueId(), defaultChannel);
5153
return;
5254
}
5355
}

src/main/java/cn/handyplus/chat/util/ConfigUtil.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ public static void upConfig() {
4747
HandyConfigUtil.setPathIsNotContains(BaseConstants.LANG_CONFIG, "sendTellErrorMsg", "&8[&c✘&8] &7不能发送私信给自己", null, language);
4848
HandyConfigUtil.setPathIsNotContains(BaseConstants.LANG_CONFIG, "blacklistMsg", "&8[&c✘&8] &7请文明用语", null, language);
4949
HandyConfigUtil.loadLangConfig(true);
50-
5150
// 1.0.7 添加聊天频率配置和黑名单配置
5251
HandyConfigUtil.setPathIsNotContains(BaseConstants.CONFIG, "blacklist", Arrays.asList("操", "草", "cao"), Collections.singletonList("黑名单,关键字替换成*"), "config.yml");
5352
HandyConfigUtil.setPathIsNotContains(BaseConstants.CONFIG, "chatTime.default", 0, Collections.singletonList("聊天冷却时间(单位秒)(可无限扩展和修改子节点,权限格式: playerChat.chatTime.vip1)"), "config.yml");
5453
HandyConfigUtil.setPathIsNotContains(BaseConstants.CONFIG, "chatTime.vip1", 0, null, "config.yml");
5554
HandyConfigUtil.setPathIsNotContains(BaseConstants.CONFIG, "chatTime.vip2", 0, null, "config.yml");
5655
HandyConfigUtil.setPathIsNotContains(BaseConstants.CONFIG, "chatTime.vip3", 0, null, "config.yml");
56+
// 1.2.6 增加登录后默认频道设置
57+
HandyConfigUtil.setPathIsNotContains(BaseConstants.CONFIG, "firstLoginChatDefault", "default", Collections.singletonList("玩家第一次登录后的默认频道"), "config.yml");
5758
BaseConstants.CONFIG = HandyConfigUtil.load("config.yml");
58-
5959
// 1.0.9 at功能
6060
HandyConfigUtil.setPathIsNotContains(CHAT_CONFIG, "at.enable", true, Collections.singletonList("是否开启"), "chat.yml");
6161
HandyConfigUtil.setPathIsNotContains(CHAT_CONFIG, "at.sound", "BLOCK_ANVIL_LAND", Collections.singletonList("音效列表 https://bukkit.windit.net/javadoc/org/bukkit/Sound.html"), "chat.yml");

src/main/resources/config.yml

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ isCheckUpdate: true
1414
# op登录时候是否发送更新提醒
1515
isCheckUpdateToOpMsg: true
1616

17+
# 玩家第一次登录后的默认频道
18+
# 注意 如果修改为其他频道,请把对应的权限提前给予 查看: playerChat.chat.频道名 使用: playerChat.use.频道名
19+
firstLoginChatDefault: "default"
20+
1721
# 聊天冷却时间(单位秒)(可无限扩展和修改子节点,权限格式: playerChat.chatTime.vip1)
1822
# 0为关闭状态
1923
chatTime:

src/main/resources/plugin.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: PlayerChat
22
main: cn.handyplus.chat.PlayerChat
3-
version: 1.2.5
3+
version: 1.2.6
44
author: handy
55
api-version: 1.13
66
softdepend: [ PlaceholderAPI ]

0 commit comments

Comments
 (0)