geforkt von SteamWar/BungeeCore
Fix local colorcodes
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
c79f49b166
Commit
b80827ed1e
@ -82,27 +82,27 @@ public class ChatListener extends BasicListener {
|
||||
}
|
||||
|
||||
public static void sendChat(ChatSender sender, Stream<ChatSender> receivers, String format, ChatSender msgReceiver, String message) {
|
||||
String finalMessage = modifyFilter(sender, message);
|
||||
if(finalMessage == null)
|
||||
if(chatFilter(sender, message))
|
||||
return;
|
||||
|
||||
SteamwarUser user = sender.user();
|
||||
String coloredMessage = (user.getUserGroup() != UserGroup.Member || coloredTeams.contains(user.getTeam())) ? ChatColor.translateAlternateColorCodes('&', message) : message;
|
||||
|
||||
AtomicBoolean noReceiver = new AtomicBoolean(true);
|
||||
receivers.filter(ChatSender::chatShown).forEach(player -> {
|
||||
if(sender.user().getId() != player.user().getId())
|
||||
noReceiver.set(false);
|
||||
chatToReciever(player, msgReceiver, user, format, finalMessage);
|
||||
chatToReciever(player, msgReceiver, user, format, coloredMessage);
|
||||
});
|
||||
|
||||
chatToReciever(ChatSender.console(), msgReceiver, user, format, finalMessage);
|
||||
chatToReciever(ChatSender.console(), msgReceiver, user, format, coloredMessage);
|
||||
|
||||
if(format.equals("CHAT_GLOBAL")) {
|
||||
if (SteamwarDiscordBot.instance() != null)
|
||||
chatToReciever(ChatSender.discordChannel(SteamwarDiscordBot.instance().getIngameChatListener()), msgReceiver, user, format, finalMessage);
|
||||
chatToReciever(ChatSender.discordChannel(SteamwarDiscordBot.instance().getIngameChatListener()), msgReceiver, user, format, coloredMessage);
|
||||
} else if (format.equals("CHAT_SERVERTEAM")) {
|
||||
if (SteamwarDiscordBot.instance() != null)
|
||||
chatToReciever(ChatSender.discordChannel(SteamwarDiscordBot.instance().getServerTeamChatListener()), msgReceiver, user, format, finalMessage);
|
||||
chatToReciever(ChatSender.discordChannel(SteamwarDiscordBot.instance().getServerTeamChatListener()), msgReceiver, user, format, coloredMessage);
|
||||
} else if (noReceiver.get()) {
|
||||
sender.system("CHAT_NO_RECEIVER");
|
||||
}
|
||||
@ -119,40 +119,35 @@ public class ChatListener extends BasicListener {
|
||||
|
||||
if(ChatListener.filteredCommand(player, message))
|
||||
return;
|
||||
if(!message.startsWith("/")) {
|
||||
message = modifyFilter(sender, message);
|
||||
if(message == null)
|
||||
return;
|
||||
}
|
||||
|
||||
if(!message.startsWith("/") && chatFilter(sender, message))
|
||||
return;
|
||||
|
||||
Chat19.chat(player, message);
|
||||
}
|
||||
|
||||
private static String modifyFilter(ChatSender sender, String message) {
|
||||
private static boolean chatFilter(ChatSender sender, String message) {
|
||||
if(!sender.chatShown()) {
|
||||
sender.system("CHAT_RECEIVE");
|
||||
return null;
|
||||
return true;
|
||||
}
|
||||
|
||||
SteamwarUser user = sender.user();
|
||||
UserGroup group = user.getUserGroup();
|
||||
if(!group.isTeamGroup() && (message.contains("http:") || message.contains("https:") || message.contains("www."))){
|
||||
sender.system("CHAT_NO_LINKS");
|
||||
return null;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (user.isPunishedWithMessage(sender, Punishment.PunishmentType.Mute))
|
||||
return null;
|
||||
|
||||
if(group != UserGroup.Member || coloredTeams.contains(user.getTeam()))
|
||||
message = ChatColor.translateAlternateColorCodes('&', message);
|
||||
return true;
|
||||
|
||||
if (message.contains("LIXFEL"))
|
||||
specialAlert(sender, "Lixfel", "CHAT_LIXFEL_", 3, 6, 11, 12, 15);
|
||||
if (message.contains("YOYONOW"))
|
||||
specialAlert(sender, "YoyoNow", "CHAT_YOYONOW_", 3, 6, 11, 12);
|
||||
|
||||
return message;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void chatToReciever(ChatSender receiver, ChatSender msgReceiver, SteamwarUser sender, String format, String message) {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren