Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
6a7b0ff9c1
Commit
f1f334a750
@ -57,7 +57,7 @@ public class DiscordChatListener extends BasicDiscordListener {
|
|||||||
if (steamwarUser == null || event.getMessage().getContentRaw().length() > 250 || steamwarUser.isPunished(Punishment.PunishmentType.Ban)) {
|
if (steamwarUser == null || event.getMessage().getContentRaw().length() > 250 || steamwarUser.isPunished(Punishment.PunishmentType.Ban)) {
|
||||||
event.getMessage().delete().queue();
|
event.getMessage().delete().queue();
|
||||||
} else {
|
} else {
|
||||||
ChatListener.sendChat(ChatSender.of(event.getMessage(), steamwarUser), targets.get(), format, event.getMessage().getContentDisplay().replace('§', '&').replace('\n', ' '));
|
ChatListener.sendChat(ChatSender.of(event.getMessage(), steamwarUser), targets.get(), format, null, event.getMessage().getContentDisplay().replace('§', '&').replace('\n', ' '));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,8 @@ public class MsgCommand extends BasicCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatListener.sendChat(sender, Stream.of(sender, ChatSender.of(target)), "CHAT_MSG", String.join(" ", args));
|
ChatSender receiver = ChatSender.of(target);
|
||||||
|
ChatListener.sendChat(sender, Stream.of(sender, receiver), "CHAT_MSG", receiver, String.join(" ", args));
|
||||||
lastChats.put(player, target);
|
lastChats.put(player, target);
|
||||||
lastChats.put(target, player);
|
lastChats.put(target, player);
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,6 @@ public class ServerTeamchatCommand extends BasicCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatListener.sendChat(sender, ChatSender.serverteamReceivers(), "CHAT_SERVERTEAM", String.join(" ", args));
|
ChatListener.sendChat(sender, ChatSender.serverteamReceivers(), "CHAT_SERVERTEAM", null, String.join(" ", args));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,6 @@ public class TeamchatCommand extends BasicCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatListener.sendChat(sender, ChatSender.allReceivers().filter(player -> player.user().getTeam() == user.getTeam()), "CHAT_TEAM", String.join(" ", args));
|
ChatListener.sendChat(sender, ChatSender.allReceivers().filter(player -> player.user().getTeam() == user.getTeam()), "CHAT_TEAM", null, String.join(" ", args));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ public class TpCommand extends BasicCommand {
|
|||||||
|
|
||||||
//Give control of teleport command to server
|
//Give control of teleport command to server
|
||||||
if(server == null) {
|
if(server == null) {
|
||||||
player.chat("/teleport " + String.join(" ", args));
|
player.chat("/tp " + String.join(" ", args));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,12 +74,12 @@ public class ChatListener extends BasicListener {
|
|||||||
} else if (message.startsWith("+")) {
|
} else if (message.startsWith("+")) {
|
||||||
localChat(player, message.substring(1));
|
localChat(player, message.substring(1));
|
||||||
} else {
|
} else {
|
||||||
sendChat(ChatSender.of(player), ChatSender.globalReceivers(), "CHAT_GLOBAL", message);
|
sendChat(ChatSender.of(player), ChatSender.globalReceivers(), "CHAT_GLOBAL", null, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendChat(ChatSender sender, Stream<ChatSender> receivers, String format, String message) {
|
public static void sendChat(ChatSender sender, Stream<ChatSender> receivers, String format, ChatSender msgReceiver, String message) {
|
||||||
String finalMessage = modifyFilter(sender, message);
|
String finalMessage = modifyFilter(sender, message);
|
||||||
if(finalMessage == null)
|
if(finalMessage == null)
|
||||||
return;
|
return;
|
||||||
@ -90,17 +90,17 @@ public class ChatListener extends BasicListener {
|
|||||||
receivers.filter(ChatSender::chatShown).forEach(player -> {
|
receivers.filter(ChatSender::chatShown).forEach(player -> {
|
||||||
if(sender.user().getId() != player.user().getId())
|
if(sender.user().getId() != player.user().getId())
|
||||||
noReceiver.set(false);
|
noReceiver.set(false);
|
||||||
chatToReciever(player, user, format, finalMessage);
|
chatToReciever(player, msgReceiver, user, format, finalMessage);
|
||||||
});
|
});
|
||||||
|
|
||||||
chatToReciever(ChatSender.console(), user, format, finalMessage);
|
chatToReciever(ChatSender.console(), msgReceiver, user, format, finalMessage);
|
||||||
|
|
||||||
if(format.equals("CHAT_GLOBAL")) {
|
if(format.equals("CHAT_GLOBAL")) {
|
||||||
if (SteamwarDiscordBot.instance() != null)
|
if (SteamwarDiscordBot.instance() != null)
|
||||||
chatToReciever(ChatSender.discordChannel(SteamwarDiscordBot.instance().getIngameChatListener()), user, format, finalMessage);
|
chatToReciever(ChatSender.discordChannel(SteamwarDiscordBot.instance().getIngameChatListener()), msgReceiver, user, format, finalMessage);
|
||||||
} else if (format.equals("CHAT_SERVERTEAM")) {
|
} else if (format.equals("CHAT_SERVERTEAM")) {
|
||||||
if (SteamwarDiscordBot.instance() != null)
|
if (SteamwarDiscordBot.instance() != null)
|
||||||
chatToReciever(ChatSender.discordChannel(SteamwarDiscordBot.instance().getServerTeamChatListener()), user, format, finalMessage);
|
chatToReciever(ChatSender.discordChannel(SteamwarDiscordBot.instance().getServerTeamChatListener()), msgReceiver, user, format, finalMessage);
|
||||||
} else if (noReceiver.get()) {
|
} else if (noReceiver.get()) {
|
||||||
sender.system("CHAT_NO_RECEIVER");
|
sender.system("CHAT_NO_RECEIVER");
|
||||||
}
|
}
|
||||||
@ -153,16 +153,16 @@ public class ChatListener extends BasicListener {
|
|||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void chatToReciever(ChatSender receiver, SteamwarUser sender, String format, String message) {
|
private static void chatToReciever(ChatSender receiver, ChatSender msgReceiver, SteamwarUser sender, String format, String message) {
|
||||||
UserGroup group = sender.getUserGroup();
|
UserGroup group = sender.getUserGroup();
|
||||||
receiver.chat(new Message(format,
|
receiver.chat(new Message(format,
|
||||||
sender,
|
sender,
|
||||||
receiver,
|
msgReceiver == null ? receiver : msgReceiver,
|
||||||
highlightMentions(message, group.getChatColorCode(), receiver),
|
highlightMentions(message, group.getChatColorCode(), receiver),
|
||||||
sender.getTeam() == 0 ? "" : "§" + Team.get(sender.getTeam()).getTeamColor() + Team.get(sender.getTeam()).getTeamKuerzel() + " ",
|
sender.getTeam() == 0 ? "" : "§" + Team.get(sender.getTeam()).getTeamColor() + Team.get(sender.getTeam()).getTeamKuerzel() + " ",
|
||||||
UserElo.getEmblem(sender),
|
UserElo.getEmblem(sender),
|
||||||
group.getColorCode(),
|
group.getColorCode(),
|
||||||
group.getChatPrefix() + " ",
|
group.getChatPrefix().length() == 0 ? "" : group.getChatPrefix() + " ",
|
||||||
group.getChatColorCode()));
|
group.getChatColorCode()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren