SteamWar/BungeeCore
Archiviert
13
2

Merge pull request '@Player Highlighting Ignore Case' (#103) from at-player into master

Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
YoyoNow 2020-08-30 13:22:22 +02:00
Commit 28ce39efcd

Datei anzeigen

@ -155,20 +155,26 @@ public class ChatListener extends BasicListener {
message = ChatColor.translateAlternateColorCodes('&', message); message = ChatColor.translateAlternateColorCodes('&', message);
} }
String msg = name + "§7» " + chatcolor + message; String msg = name + "§7»" + chatcolor + " " + message;
if(user.getTeam() != 0){ if(user.getTeam() != 0){
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.contains("@" + target.getName())) { for (String curr : msgSplits) {
BungeeCore.send(target, ChatMessageType.CHAT, msg.replace("@" + target.getName(), "§e@" + target.getName() + chatcolor)); if(curr.equalsIgnoreCase("@" + target.getName())) {
builder.append("§e@").append(target.getName()).append(chatcolor).append(" ");
}else { }else {
BungeeCore.send(target, ChatMessageType.CHAT, msg); builder.append(curr).append(" ");
} }
} }
BungeeCore.send(target, ChatMessageType.CHAT, builder.toString());
builder = new StringBuilder();
} }
BungeeCore.log(sender.getServer().getInfo(), msg); BungeeCore.log(sender.getServer().getInfo(), msg);
} }