File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
src/main/kotlin/com/github/yufiriamazenta/deathmsg/listener Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ plugins {
88}
99
1010group = " com.github.yufiriamazenta"
11- version = " 1.2.2 "
11+ version = " 1.2.3 "
1212
1313repositories {
1414 mavenLocal()
Original file line number Diff line number Diff line change @@ -99,19 +99,24 @@ class DeathHandler: Listener {
9999 // 组装成完整的死亡消息组件
100100 val deathMsgComponent = TranslatableComponent (TextUtil .color(message), * objList.toTypedArray())
101101
102+ // 当为all时直接让其为null,下面判断两种方式都发送
102103 val chatMessageTypeStr = DEATH_MESSAGE .config.getString(" death_message_type" , " chat" )!! .uppercase()
103- val chatMessageType = try {
104- ChatMessageType .valueOf(chatMessageTypeStr)
105- } catch (e: Exception ) {
106- ChatMessageType .CHAT
104+ val chatMessageType = if (chatMessageTypeStr != " ALL" ) {
105+ try {
106+ ChatMessageType .valueOf(chatMessageTypeStr)
107+ } catch (e: Exception ) {
108+ ChatMessageType .CHAT
109+ }
110+ } else {
111+ null
107112 }
108113
109114 // 发送死亡消息给没有屏蔽死亡消息的玩家
110115 for (onlinePlayer in Bukkit .getOnlinePlayers()) {
111116 if (deadPlayer != onlinePlayer) {
112117 if (DEATH_MESSAGE .isPlayerDeathMsgFilterOn(onlinePlayer)) continue
113118 }
114- if (chatMessageTypeStr != " ALL " )
119+ if (chatMessageType != null )
115120 onlinePlayer.spigot().sendMessage(chatMessageType, deathMsgComponent)
116121 else {
117122 onlinePlayer.spigot().sendMessage(ChatMessageType .CHAT , deathMsgComponent)
You can’t perform that action at this time.
0 commit comments