SteamWar/BungeeCore
Archiviert
13
2

@Player IgnoreCase

Dieser Commit ist enthalten in:
Chaoscaot 2020-08-30 12:26:08 +02:00
Ursprung 7cb6a18b62
Commit 092417ac91

Datei anzeigen

@ -160,23 +160,21 @@ public class ChatListener extends BasicListener {
msg = "§8" + Team.get(user.getTeam()).getTeamKuerzel() + " §r" + msg; msg = "§8" + Team.get(user.getTeam()).getTeamKuerzel() + " §r" + msg;
} }
String[] msgSplits = msg.split(" ");
StringBuilder builder = new StringBuilder();
for(ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){ for(ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){
Subserver targetServer = Subserver.getSubserver(target); Subserver targetServer = Subserver.getSubserver(target);
if(targetServer == null || targetServer.getType() != Servertype.ARENA || targetServer.getServer() != target.getServer().getInfo()){ if(!(targetServer == null || targetServer.getType() != Servertype.ARENA || targetServer.getServer() != target.getServer().getInfo())) continue;
if(msg.toLowerCase().contains("@" + target.getName().toLowerCase())) { for (String curr : msgSplits) {
String toSend = "";
for (String curr : msg.split(" ")) {
if(curr.equalsIgnoreCase("@" + target.getName())) { if(curr.equalsIgnoreCase("@" + target.getName())) {
toSend += "§e@" + target.getName() + chatcolor + " "; builder.append("§e@").append(target.getName()).append(chatcolor).append(" ");
}else { }else {
toSend += curr + " "; builder.append(curr).append(" ");
}
}
BungeeCore.send(target, ChatMessageType.CHAT, toSend);
}else {
BungeeCore.send(target, ChatMessageType.CHAT, msg);
} }
} }
BungeeCore.send(target, ChatMessageType.CHAT, builder.toString());
builder = new StringBuilder();
} }
BungeeCore.log(sender.getServer().getInfo(), msg); BungeeCore.log(sender.getServer().getInfo(), msg);
} }