SteamWar/BungeeCore
Archiviert
13
2

Fix empty messages
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2022-07-17 17:31:11 +02:00
Ursprung b80827ed1e
Commit 3053d5d301
3 geänderte Dateien mit 10 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -82,11 +82,10 @@ public class ChatListener extends BasicListener {
} }
public static void sendChat(ChatSender sender, Stream<ChatSender> receivers, String format, ChatSender msgReceiver, String message) { public static void sendChat(ChatSender sender, Stream<ChatSender> receivers, String format, ChatSender msgReceiver, String message) {
if(chatFilter(sender, message))
return;
SteamwarUser user = sender.user(); SteamwarUser user = sender.user();
String coloredMessage = (user.getUserGroup() != UserGroup.Member || coloredTeams.contains(user.getTeam())) ? ChatColor.translateAlternateColorCodes('&', message) : message; final String coloredMessage = (user.getUserGroup() != UserGroup.Member || coloredTeams.contains(user.getTeam())) ? ChatColor.translateAlternateColorCodes('&', message) : message;
if(chatFilter(sender, coloredMessage))
return;
AtomicBoolean noReceiver = new AtomicBoolean(true); AtomicBoolean noReceiver = new AtomicBoolean(true);
receivers.filter(ChatSender::chatShown).forEach(player -> { receivers.filter(ChatSender::chatShown).forEach(player -> {
@ -132,6 +131,11 @@ public class ChatListener extends BasicListener {
return true; return true;
} }
if(message.replace("§[a-f0-9klmno]", "").trim().isEmpty()) {
sender.system("CHAT_EMPTY");
return true;
}
SteamwarUser user = sender.user(); SteamwarUser user = sender.user();
UserGroup group = user.getUserGroup(); UserGroup group = user.getUserGroup();
if(!group.isTeamGroup() && (message.contains("http:") || message.contains("https:") || message.contains("www."))){ if(!group.isTeamGroup() && (message.contains("http:") || message.contains("https:") || message.contains("www."))){

Datei anzeigen

@ -521,6 +521,7 @@ CHAT_RECEIVE=§cTo be able to send chat messages, you must also receive them!
CHAT_NO_LINKS=§cYou may not send links. CHAT_NO_LINKS=§cYou may not send links.
CHAT_BC_USAGE=§8/§7bc §8[§emessage§8] CHAT_BC_USAGE=§8/§7bc §8[§emessage§8]
CHAT_NO_RECEIVER=§cNobody receives your message CHAT_NO_RECEIVER=§cNobody receives your message
CHAT_EMPTY=§cDon't write meaningless empty messages.
CHAT_SERVERTEAM=§8STC §e{0}§8» §f{2} CHAT_SERVERTEAM=§8STC §e{0}§8» §f{2}
CHAT_GLOBAL={3}{4}{5}{6}{0}§8» {7}{2} CHAT_GLOBAL={3}{4}{5}{6}{0}§8» {7}{2}

Datei anzeigen

@ -500,6 +500,7 @@ CHAT_RECEIVE=§cUm Chatnachrichten versenden zu können, musst du auch welche em
CHAT_NO_LINKS=§cDu darfst keine Links versenden. CHAT_NO_LINKS=§cDu darfst keine Links versenden.
CHAT_BC_USAGE=§8/§7bc §8[§eNachricht§8] CHAT_BC_USAGE=§8/§7bc §8[§eNachricht§8]
CHAT_NO_RECEIVER=§cNiemand empfängt deine Nachricht CHAT_NO_RECEIVER=§cNiemand empfängt deine Nachricht
CHAT_EMPTY=§cSchreibe keine inhaltslosen Nachrichten.
CHAT_SERVERTEAM=§8STC §e{0}§8» §f{2} CHAT_SERVERTEAM=§8STC §e{0}§8» §f{2}
CHAT_GLOBAL={3}{4}{5}{6}{0}§8» {7}{2} CHAT_GLOBAL={3}{4}{5}{6}{0}§8» {7}{2}