From 092417ac910e32d001955e90ed1ac8bce95f3909 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 30 Aug 2020 12:26:08 +0200 Subject: [PATCH] @Player IgnoreCase --- .../bungeecore/listeners/ChatListener.java | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index 536688d1..6b8b4a25 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -160,23 +160,21 @@ public class ChatListener extends BasicListener { msg = "§8" + Team.get(user.getTeam()).getTeamKuerzel() + " §r" + msg; } + String[] msgSplits = msg.split(" "); + StringBuilder builder = new StringBuilder(); + for(ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){ Subserver targetServer = Subserver.getSubserver(target); - if(targetServer == null || targetServer.getType() != Servertype.ARENA || targetServer.getServer() != target.getServer().getInfo()){ - if(msg.toLowerCase().contains("@" + target.getName().toLowerCase())) { - String toSend = ""; - for (String curr : msg.split(" ")) { - if(curr.equalsIgnoreCase("@" + target.getName())) { - toSend += "§e@" + target.getName() + chatcolor + " "; - }else { - toSend += curr + " "; - } - } - BungeeCore.send(target, ChatMessageType.CHAT, toSend); + if(!(targetServer == null || targetServer.getType() != Servertype.ARENA || targetServer.getServer() != target.getServer().getInfo())) continue; + for (String curr : msgSplits) { + if(curr.equalsIgnoreCase("@" + target.getName())) { + builder.append("§e@").append(target.getName()).append(chatcolor).append(" "); }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); }