Merge remote-tracking branch 'origin/Teamserver' into Teamserver
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Dieser Commit ist enthalten in:
Commit
39471cf468
@ -108,7 +108,7 @@ public class Message {
|
||||
if(type == ChatMessageType.CHAT && !sender.chatShown())
|
||||
return;
|
||||
|
||||
sender.send(prefixed, type, new Message("PLAIN_STRING", onHover), onClick, new Message(message, params));
|
||||
sender.send(prefixed, type, onHover != null ? new Message("PLAIN_STRING", onHover) : null, onClick, new Message(message, params));
|
||||
}
|
||||
|
||||
public static void broadcast(String message, Object... params) {
|
||||
@ -116,7 +116,7 @@ public class Message {
|
||||
}
|
||||
|
||||
public static void broadcast(String message, String onHover, ClickEvent onClick, Object... params) {
|
||||
ChatSender.allReceivers().forEach(player -> player.prefixless(message, new Message(onHover, params), onClick, params));
|
||||
ChatSender.allReceivers().forEach(player -> player.system(message, onHover != null ? new Message(onHover, params) : null, onClick, params));
|
||||
}
|
||||
|
||||
public static void team(String message, Object... params) {
|
||||
@ -124,7 +124,7 @@ public class Message {
|
||||
}
|
||||
|
||||
public static void team(String message, String onHover, ClickEvent onClick, Object... params) {
|
||||
ChatSender.serverteamReceivers().filter(player -> player.user().getUserGroup().isTeamGroup()).forEach(player -> player.prefixless(message, new Message(onHover, params), onClick, params));
|
||||
ChatSender.serverteamReceivers().filter(player -> player.user().getUserGroup().isTeamGroup()).forEach(player -> player.prefixless(message, onHover != null ? new Message(onHover, params) : null, onClick, params));
|
||||
}
|
||||
|
||||
private final String format;
|
||||
|
@ -57,7 +57,7 @@ public class DiscordChatListener extends BasicDiscordListener {
|
||||
if (steamwarUser == null || event.getMessage().getContentRaw().length() > 250 || steamwarUser.isPunished(Punishment.PunishmentType.Ban)) {
|
||||
event.getMessage().delete().queue();
|
||||
} 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', ' '));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,8 @@
|
||||
|
||||
package de.steamwar.bungeecore.commands;
|
||||
|
||||
import de.steamwar.bungeecore.Arenaserver;
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.Servertype;
|
||||
import de.steamwar.bungeecore.Subserver;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
@ -40,7 +40,8 @@ public class ArenaCommand extends BasicCommand {
|
||||
ProxiedPlayer player = (ProxiedPlayer) sender;
|
||||
|
||||
ServerInfo server = ProxyServer.getInstance().getServerInfo(String.join(" ", args));
|
||||
if(server == null || !(Subserver.getSubserver(server) instanceof Arenaserver)) {
|
||||
Subserver subserver = Subserver.getSubserver(server);
|
||||
if(server == null || subserver == null || subserver.getType() != Servertype.ARENA) {
|
||||
Message.send("ARENA_NOT_FOUND", player);
|
||||
return;
|
||||
}
|
||||
|
@ -63,7 +63,8 @@ public class MsgCommand extends BasicCommand {
|
||||
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(target, player);
|
||||
}
|
||||
|
@ -37,6 +37,6 @@ public class ServerTeamchatCommand extends BasicCommand {
|
||||
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;
|
||||
}
|
||||
|
||||
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
|
||||
if(server == null) {
|
||||
player.chat("/teleport " + String.join(" ", args));
|
||||
player.chat("/tp " + String.join(" ", args));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ public class TpCommand extends BasicCommand {
|
||||
String serverPerm = BungeeCore.serverPermissions.get(server.getName());
|
||||
Subserver subserver = Subserver.getSubserver(server);
|
||||
|
||||
if (subserver instanceof Arenaserver) {
|
||||
if (subserver != null && subserver.getType() == Servertype.ARENA) {
|
||||
if (!sender.user().isPunishedWithMessage(sender, Punishment.PunishmentType.NoFightServer))
|
||||
SubserverSystem.sendPlayer(subserver, player);
|
||||
|
||||
|
@ -69,17 +69,17 @@ public class ChatListener extends BasicListener {
|
||||
e.setCancelled(true);
|
||||
|
||||
Subserver subserver = Subserver.getSubserver(player);
|
||||
if(subserver instanceof Arenaserver && subserver.getServer() == player.getServer().getInfo()) {
|
||||
if(subserver != null && subserver.getType() == Servertype.ARENA && subserver.getServer() == player.getServer().getInfo()) {
|
||||
localChat(player, message);
|
||||
} else if (message.startsWith("+")) {
|
||||
localChat(player, message.substring(1));
|
||||
} 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);
|
||||
if(finalMessage == null)
|
||||
return;
|
||||
@ -90,17 +90,17 @@ public class ChatListener extends BasicListener {
|
||||
receivers.filter(ChatSender::chatShown).forEach(player -> {
|
||||
if(sender.user().getId() != player.user().getId())
|
||||
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 (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")) {
|
||||
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()) {
|
||||
sender.system("CHAT_NO_RECEIVER");
|
||||
}
|
||||
@ -153,16 +153,16 @@ public class ChatListener extends BasicListener {
|
||||
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();
|
||||
receiver.chat(new Message(format,
|
||||
sender,
|
||||
receiver,
|
||||
msgReceiver == null ? receiver : msgReceiver,
|
||||
highlightMentions(message, group.getChatColorCode(), receiver),
|
||||
sender.getTeam() == 0 ? "" : "§" + Team.get(sender.getTeam()).getTeamColor() + Team.get(sender.getTeam()).getTeamKuerzel() + " ",
|
||||
UserElo.getEmblem(sender),
|
||||
group.getColorCode(),
|
||||
group.getChatPrefix() + " ",
|
||||
group.getChatPrefix().length() == 0 ? "§f" : group.getChatPrefix() + " ",
|
||||
group.getChatColorCode()));
|
||||
}
|
||||
|
||||
|
@ -19,10 +19,7 @@
|
||||
|
||||
package de.steamwar.messages;
|
||||
|
||||
import de.steamwar.bungeecore.Arenaserver;
|
||||
import de.steamwar.bungeecore.BungeeCore;
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.Subserver;
|
||||
import de.steamwar.bungeecore.*;
|
||||
import de.steamwar.bungeecore.bot.listeners.DiscordChatListener;
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
@ -59,7 +56,7 @@ public interface ChatSender {
|
||||
static Stream<ChatSender> globalReceivers() {
|
||||
return all().filter(player -> {
|
||||
Subserver subserver = Subserver.getSubserver(player);
|
||||
return !(subserver instanceof Arenaserver && subserver.getServer() == player.getServer().getInfo());
|
||||
return subserver == null || !(subserver.getType() == Servertype.ARENA && subserver.getServer() == player.getServer().getInfo());
|
||||
}).map(ChatSender::of);
|
||||
}
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren