Skip to content

Commit 14aaad1

Browse files
committed
Added permission ess.chat.mention.all for mention all players.
Signed-off-by: Pavel Erokhin (MairwunNx) <MairwunNx@gmail.com>
1 parent ce10f79 commit 14aaad1

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

src/main/kotlin/com/mairwunnx/projectessentials/chat/EntryPoint.kt

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,25 @@ class EntryPoint : EssBase() {
172172
if (mentions.isNotEmpty()) {
173173
if (mentionSettings.mentionsEnabled && mentionSettings.mentionInActionBar) {
174174
if ("@all" in mentions) {
175-
event.player.server.playerList.players.forEach {
176-
it.sendStatusMessage(
177-
TextComponentUtils.toTextComponent {
178-
mentionSettings.mentionMessage.replace(
179-
"%player",
180-
event.player.name.string
181-
).replace("&", "§")
182-
}, true
175+
if (hasPermission(event.player, "ess.chat.mention.all", 2)) {
176+
event.player.server.playerList.players.forEach {
177+
it.sendStatusMessage(
178+
TextComponentUtils.toTextComponent {
179+
mentionSettings.mentionMessage.replace(
180+
"%player",
181+
event.player.name.string
182+
).replace("&", "§")
183+
}, true
184+
)
185+
}
186+
return
187+
} else {
188+
sendMsg(
189+
"chat",
190+
event.player.commandSource,
191+
"chat.mention_all_aborted"
183192
)
184193
}
185-
return
186194
}
187195
event.player.server.playerList.players.forEach {
188196
if ("@${it.name.string}" in mentions) {

src/main/resources/assets/projectessentialschat/lang/en_us.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"project_essentials_chat.chat.color_restricted": "§cYou §7don't have permission §cto use chat colors.",
55
"project_essentials_chat.chat.blocked_word": "§cMessage not sent, your message contains blocked word: \"§7%s\".",
66
"project_essentials_chat.chat.blocked_char": "§cMessage not sent, your message contains blocked symbol.",
7-
"project_essentials_chat.chat.message_maxlength": "§cMessage not sent, your message length exceeds maximum allowed length."
7+
"project_essentials_chat.chat.message_maxlength": "§cMessage not sent, your message length exceeds maximum allowed length.",
8+
"project_essentials_chat.chat.mention_all_aborted": "§cMention not sent to all players, you §7don't have permission§c to mention all players."
89
}

src/main/resources/assets/projectessentialschat/lang/ru_ru.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"project_essentials_chat.chat.color_restricted": "§cУ вас §7нет прав §cна использование цветов в чате.",
55
"project_essentials_chat.chat.blocked_word": "§cСообщение не отправлено, ваше сообщение содержит заблокированное слово: \"§7%s\".",
66
"project_essentials_chat.chat.blocked_char": "§cСообщение не отправлено, ваше сообщение содержит заблокированный символ.",
7-
"project_essentials_chat.chat.message_maxlength": "§cСообщение не отправлено, ваше сообщение превышает максимально допустимую длину."
7+
"project_essentials_chat.chat.message_maxlength": "§cСообщение не отправлено, ваше сообщение превышает максимально допустимую длину.",
8+
"project_essentials_chat.chat.mention_all_aborted": "§cОповещение не было отправлено всем игрокам, у вас §7нет прав§c на оповещение всех игроков."
89
}

0 commit comments

Comments
 (0)