From 6534a56b1703d620a2139cf019be826a7df2299b Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 29 Aug 2020 21:21:21 +0200 Subject: [PATCH] @Player IgnoreCase --- .../bungeecore/listeners/ChatListener.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index a387104..664bffb 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -155,7 +155,7 @@ public class ChatListener extends BasicListener { message = ChatColor.translateAlternateColorCodes('&', message); } - String msg = name + "§7» " + chatcolor + message; + String msg = name + "§7»" + chatcolor + " " + message; if(user.getTeam() != 0){ msg = "§8" + Team.get(user.getTeam()).getTeamKuerzel() + " §r" + msg; } @@ -164,7 +164,15 @@ public class ChatListener extends BasicListener { Subserver targetServer = Subserver.getSubserver(target); if(targetServer == null || targetServer.getType() != Servertype.ARENA || targetServer.getServer() != target.getServer().getInfo()){ if(msg.toLowerCase().contains("@" + target.getName().toLowerCase())) { - BungeeCore.send(target, ChatMessageType.CHAT, msg.replace("@" + target.getName(), "§e@" + target.getName() + chatcolor)); + 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); }else { BungeeCore.send(target, ChatMessageType.CHAT, msg); } @@ -208,8 +216,8 @@ public class ChatListener extends BasicListener { else last = ""; for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()){ - String name = player.getName().replace("@", ""); - if(last.isEmpty() || name.startsWith(last)){ + String name = player.getName(); + if (last.isEmpty() || name.startsWith(last)) { suggestions.add(name); } }