SteamWar/BungeeCore
Archiviert
13
2

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

Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
YoyoNow 2020-08-29 17:53:29 +02:00
Commit fe9ad69de4

Datei anzeigen

@ -138,31 +138,36 @@ public class ChatListener extends BasicListener {
private void publicChat(SteamwarUser user, ProxiedPlayer sender, String message){ private void publicChat(SteamwarUser user, ProxiedPlayer sender, String message){
String name = sender.getDisplayName(); String name = sender.getDisplayName();
String chatsuffix = "§7» "; String chatcolor = "§7";
message = message.replace('§', '&'); message = message.replace('§', '&');
if(sender.hasPermission("bungeecore.group.admin")){ if(sender.hasPermission("bungeecore.group.admin")){
chatsuffix = "§7» §e"; chatcolor = "§e";
message = ChatColor.translateAlternateColorCodes('&', message); message = ChatColor.translateAlternateColorCodes('&', message);
}else if( }else if(
sender.hasPermission("bungeecore.group.developer") || sender.hasPermission("bungeecore.group.developer") ||
sender.hasPermission("bungeecore.group.moderator") || sender.hasPermission("bungeecore.group.moderator") ||
sender.hasPermission("bungeecore.group.supporter") || sender.hasPermission("bungeecore.group.supporter") ||
sender.hasPermission("bungeecore.group.builder")){ sender.hasPermission("bungeecore.group.builder")){
chatsuffix = "§7» §r"; chatcolor = "§r";
message = ChatColor.translateAlternateColorCodes('&', message); message = ChatColor.translateAlternateColorCodes('&', message);
}else if(sender.hasPermission("bungeecore.group.youtuber")){ }else if(sender.hasPermission("bungeecore.group.youtuber")){
message = ChatColor.translateAlternateColorCodes('&', message); message = ChatColor.translateAlternateColorCodes('&', message);
} }
String msg = name + chatsuffix + 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;
} }
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()){
BungeeCore.send(target, ChatMessageType.CHAT, msg); if(msg.contains("@" + target.getName())) {
BungeeCore.send(target, ChatMessageType.CHAT, msg.replace("@" + target.getName(), "§e@" + target.getName() + chatcolor));
}else {
BungeeCore.send(target, ChatMessageType.CHAT, msg);
}
} }
} }
BungeeCore.log(sender.getServer().getInfo(), msg); BungeeCore.log(sender.getServer().getInfo(), msg);