public bool TryDoCommand(Players.Player causedBy, string chat, List <string> splits) { MuteList.Update(); if (MuteList.MutedMinutes.ContainsKey(causedBy)) { Chat.Send(causedBy, "[muted]"); return(true); } if (chat.StartsWith("/")) { return(false); } if (PermissionsManager.HasPermission(causedBy, "")) { String name = causedBy != null ? causedBy.Name : "Server"; Chat.SendToConnected($"[<color=red>{name}</color>]: {chat}"); } else { string nameColor = (from s in Colors where PermissionsManager.HasPermission(causedBy, AntiGrief.MOD_PREFIX + "betterchat.name." + s.Name) select s.Color).FirstOrDefault(); string textColor = (from s in Colors where PermissionsManager.HasPermission(causedBy, AntiGrief.MOD_PREFIX + "betterchat.text." + s.Name) select s.Color).FirstOrDefault(); Chat.SendToConnected($"[<color={nameColor}>{causedBy.Name}</color>]: <color={textColor}>{chat}</color>"); } return(true); }
public bool TryDoCommand(Players.Player causedBy, string chat, List <string> splits) { MuteList.Update(); if (MuteList.MutedMinutes.ContainsKey(causedBy.ID)) { Chat.Send(causedBy, "[muted]"); return(true); } if (chat.StartsWith("/")) { return(false); } Empire empire = Empire.GetEmpire(causedBy); if (Imperium.Commands.AutomaticChat.activeTeamChat.Contains(causedBy) && empire != null) { string name = causedBy.Name; foreach (Players.Player plr in empire.GetConnectedPlayers()) { Chatting.Chat.Send(plr, string.Format("<color=yellow>[{0}][{1}]: {2}</color>", empire.GetRank(causedBy).ToString(), name, chat)); } return(true); } // figure out chat color group name string groupname = null; foreach (string s in ChatColors.Colors.Keys) { if (PermissionsManager.HasPermission(causedBy, AntiGrief.MOD_PREFIX + "betterchat." + s)) { groupname = s; break; } } if (string.IsNullOrEmpty(groupname)) { if (empire != null && !empire.tag.Equals("")) { Chat.SendToConnected(causedBy.Name + "[<color=green>" + empire.tag + "</color>]> " + chat); } else { Chat.SendToConnected(causedBy.Name + "> " + chat); } return(true); } ChatColorSpecification spec = ChatColors.Colors[groupname]; // rank prefix string fulltext = ""; if (!string.IsNullOrEmpty(spec.Prefix)) { if (!string.IsNullOrEmpty(spec.PrefixColor)) { fulltext = $"[<color={spec.PrefixColor}>{spec.Prefix}</color>]"; } else { fulltext = $"[{spec.Prefix}]"; } } // name if (!string.IsNullOrEmpty(spec.Name)) { fulltext += $"<color={spec.Name}>{causedBy.Name}</color>"; } else { fulltext += causedBy.Name; } // roleplay marker if (RoleplayManager.IsRoleplaying(causedBy)) { fulltext += $"<color={spec.RpMarker}>[RP]</color>"; } if (empire != null && !empire.tag.Equals("")) { fulltext += $"[<color=green>" + empire.tag + "</color>]"; } // text fulltext += "> "; if (!string.IsNullOrEmpty(spec.Text)) { fulltext += $"<color={spec.Text}>{chat}</color>"; } else { fulltext += chat; } Chat.SendToConnected(fulltext); return(true); }