From 890c3777ce843f3d1a489d69926cd831fbff2f9c Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 29 Aug 2020 14:11:07 +0200 Subject: [PATCH 1/4] Added @Player to Highlight the Message --- src/de/steamwar/bungeecore/listeners/ChatListener.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index a21dbce..e4ce0ff 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -19,6 +19,7 @@ import net.md_5.bungee.api.event.TabCompleteResponseEvent; import net.md_5.bungee.api.scheduler.TaskScheduler; import net.md_5.bungee.event.EventHandler; +import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; @@ -159,10 +160,15 @@ public class ChatListener extends BasicListener { if(user.getTeam() != 0){ msg = "§8" + Team.get(user.getTeam()).getTeamKuerzel() + " §r" + msg; } + for(ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){ Subserver targetServer = Subserver.getSubserver(target); if(targetServer == null || targetServer.getType() != Servertype.ARENA || targetServer.getServer() != target.getServer().getInfo()){ - BungeeCore.send(target, ChatMessageType.CHAT, msg); + if(msg.contains("@" + target.getName())) { + BungeeCore.send(target, ChatMessageType.CHAT, msg.replace("@" + target.getName(), "§e@" + target.getName() + "§r")); + }else { + BungeeCore.send(target, ChatMessageType.CHAT, msg); + } } } BungeeCore.log(sender.getServer().getInfo(), msg); From 41dd504191f36f0717e57c96972a45b1be331366 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 29 Aug 2020 14:13:16 +0200 Subject: [PATCH 2/4] Added @Player to Highlight the Message --- src/de/steamwar/bungeecore/listeners/ChatListener.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index e4ce0ff..dc2111b 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -19,7 +19,6 @@ import net.md_5.bungee.api.event.TabCompleteResponseEvent; import net.md_5.bungee.api.scheduler.TaskScheduler; import net.md_5.bungee.event.EventHandler; -import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; From 2807bf40e2b8100364350b6837379615f2370bce Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 29 Aug 2020 15:25:47 +0200 Subject: [PATCH 3/4] Add ReverColor for Ranks --- src/de/steamwar/bungeecore/listeners/ChatListener.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index dc2111b..fe6d92b 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -139,10 +139,12 @@ public class ChatListener extends BasicListener { private void publicChat(SteamwarUser user, ProxiedPlayer sender, String message){ String name = sender.getDisplayName(); String chatsuffix = "§7» "; + String revertColor = "§7"; message = message.replace('§', '&'); if(sender.hasPermission("bungeecore.group.admin")){ chatsuffix = "§7» §e"; + revertColor = "§e"; message = ChatColor.translateAlternateColorCodes('&', message); }else if( sender.hasPermission("bungeecore.group.developer") || @@ -150,6 +152,7 @@ public class ChatListener extends BasicListener { sender.hasPermission("bungeecore.group.supporter") || sender.hasPermission("bungeecore.group.builder")){ chatsuffix = "§7» §r"; + revertColor = "§r"; message = ChatColor.translateAlternateColorCodes('&', message); }else if(sender.hasPermission("bungeecore.group.youtuber")){ message = ChatColor.translateAlternateColorCodes('&', message); @@ -164,7 +167,7 @@ public class ChatListener extends BasicListener { Subserver targetServer = Subserver.getSubserver(target); if(targetServer == null || targetServer.getType() != Servertype.ARENA || targetServer.getServer() != target.getServer().getInfo()){ if(msg.contains("@" + target.getName())) { - BungeeCore.send(target, ChatMessageType.CHAT, msg.replace("@" + target.getName(), "§e@" + target.getName() + "§r")); + BungeeCore.send(target, ChatMessageType.CHAT, msg.replace("@" + target.getName(), "§e@" + target.getName() + revertColor)); }else { BungeeCore.send(target, ChatMessageType.CHAT, msg); } From 92ea2fa5d0f716b88f6fc95402e9f8c8d75725ac Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 29 Aug 2020 17:51:22 +0200 Subject: [PATCH 4/4] Simpliefied @play Revert Color --- .../steamwar/bungeecore/listeners/ChatListener.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index fe6d92b..cb255d6 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -138,27 +138,24 @@ public class ChatListener extends BasicListener { private void publicChat(SteamwarUser user, ProxiedPlayer sender, String message){ String name = sender.getDisplayName(); - String chatsuffix = "§7» "; - String revertColor = "§7"; + String chatcolor = "§7"; message = message.replace('§', '&'); if(sender.hasPermission("bungeecore.group.admin")){ - chatsuffix = "§7» §e"; - revertColor = "§e"; + chatcolor = "§e"; message = ChatColor.translateAlternateColorCodes('&', message); }else if( sender.hasPermission("bungeecore.group.developer") || sender.hasPermission("bungeecore.group.moderator") || sender.hasPermission("bungeecore.group.supporter") || sender.hasPermission("bungeecore.group.builder")){ - chatsuffix = "§7» §r"; - revertColor = "§r"; + chatcolor = "§r"; message = ChatColor.translateAlternateColorCodes('&', message); }else if(sender.hasPermission("bungeecore.group.youtuber")){ message = ChatColor.translateAlternateColorCodes('&', message); } - String msg = name + chatsuffix + message; + String msg = name + "§7» " + chatcolor + message; if(user.getTeam() != 0){ msg = "§8" + Team.get(user.getTeam()).getTeamKuerzel() + " §r" + msg; } @@ -167,7 +164,7 @@ public class ChatListener extends BasicListener { Subserver targetServer = Subserver.getSubserver(target); if(targetServer == null || targetServer.getType() != Servertype.ARENA || targetServer.getServer() != target.getServer().getInfo()){ if(msg.contains("@" + target.getName())) { - BungeeCore.send(target, ChatMessageType.CHAT, msg.replace("@" + target.getName(), "§e@" + target.getName() + revertColor)); + BungeeCore.send(target, ChatMessageType.CHAT, msg.replace("@" + target.getName(), "§e@" + target.getName() + chatcolor)); }else { BungeeCore.send(target, ChatMessageType.CHAT, msg); }