public static void Run(SvPlayer player) { try { Debug.Log($"{PlaceholderParser.ParseTimeStamp()} [INFO] [JOIN] {player.player.username} IP is: {player.connection.IP}"); int tries = 0; while (tries < 2) { try { if (!File.ReadAllText(IpListFile).Contains(player.player.username + ": " + player.connection.IP)) { File.AppendAllText(IpListFile, player.player.username + ": " + player.connection.IP + Environment.NewLine); } break; } catch (IOException) { ++tries; } } } catch (Exception ex) { ErrorLogging.Run(ex); } }
public static void Run(SvPlayer player) { if (CheckBannedEnabled) { try { if (player.player.admin || string.IsNullOrEmpty(player.connection.IP.Trim())) { return; } foreach (var line in File.ReadAllLines(BansFile)) { if (string.IsNullOrEmpty(line) || !line.StartsWith("# " + player.player.username, StringComparison.CurrentCulture)) { continue; } } Debug.Log($"{PlaceholderParser.ParseTimeStamp()} [WARNING] {player.player.username} Joined while banned! IP: {player.connection.IP}"); player.svManager.AddBanned(player.player); player.svManager.Disconnect(player.connection, DisconnectTypes.Banned); } catch (Exception ex) { ErrorLogging.Run(ex); } } }
public static int Run(ShPlayer player, InventoryItem myItem) { try { if (player.job.info.rankItems.Length > player.rank) { for (int i = player.rank; i >= 0; i--) { foreach (InventoryItem inventoryItem in player.job.info.rankItems[i].items) { if (myItem.item.index == inventoryItem.item.index) { return(Mathf.Max(0, myItem.count - inventoryItem.count)); } } } } return(myItem.count); } catch (Exception ex) { ErrorLogging.Run(ex); } return(0); }
public static void Run(SvPlayer player, string message, string prefix = "") { try { var mssge = $"{PlaceholderParser.ParseTimeStamp()} {prefix}[{(message.StartsWith(CmdCommandCharacter, StringComparison.CurrentCulture) ? "COMMAND" : "MESSAGE")}] {player.playerData.username}: {message}"; Debug.Log(mssge); int tries = 0; while (tries < 2) { try { if (!message.StartsWith(CmdCommandCharacter, StringComparison.CurrentCulture)) { File.AppendAllText(ChatLogFile, mssge + Environment.NewLine); } else { File.AppendAllText(CommandLogFile, mssge + Environment.NewLine); } File.AppendAllText(LogFile, mssge + Environment.NewLine); break; } catch (IOException) { Thread.Sleep(50); ++tries; } } } catch (Exception ex) { ErrorLogging.Run(ex); } }
public static void Run(string json, string link, bool enabled) { try { if (!enabled) { return; } if (DebugLevel >= 2) { Debug.Log($"{PlaceholderParser.ParseTimeStamp()} [INFO] Creating POST request to {link}"); } var formData = Encoding.UTF8.GetBytes(json); var www = new WWW(link, formData); SvMan.StartCoroutine(WaitForRequest(www)); if (DebugLevel >= 2) { Debug.Log($"{PlaceholderParser.ParseTimeStamp()} [INFO] Post request sent!"); } } catch (Exception ex) { ErrorLogging.Run(ex); } }
public static void LogOther(string message) { try { Debug.Log(message); int tries = 0; while (tries < 2) { try { File.AppendAllText(LogFile, $"{message}{Environment.NewLine}"); break; } catch (IOException) { Thread.Sleep(50); ++tries; } } } catch (Exception ex) { ErrorLogging.Run(ex); } }
public static void Run(string FileName, string RemoveString) { try { File.WriteAllLines(FileName, File.ReadLines(FileName).Where(s => !s.Contains(RemoveString)).ToList()); } catch (Exception ex) { ErrorLogging.Run(ex); } }
public static void Run() { try { var m = JsonConvert.DeserializeObject <RootObject>(FilterComments.Run(CustomCommandsFile)); CustomCommands = m.CustomCommands; } catch (Exception ex) { ErrorLogging.Run(ex); } }
public static void Run(string fileName) { try { switch (fileName) { case SettingsFile: { if (IsPreRelease) { GetWebsiteContent.WriteToFile(SettingsFile, "http://www.UserR00T.com/dev/BPEssentials/settings_test.json"); } else { GetWebsiteContent.WriteToFile(SettingsFile, "http://www.UserR00T.com/dev/BPEssentials/settings.json"); } break; } case ChatBlockFile: { File.WriteAllText(ChatBlockFile, ""); break; } case LanguageBlockFile: { File.WriteAllText(LanguageBlockFile, ""); break; } case CustomCommandsFile: { GetWebsiteContent.WriteToFile(CustomCommandsFile, "http://www.UserR00T.com/dev/BPEssentials/customcommands.json"); break; } case CustomGroupsFile: { GetWebsiteContent.WriteToFile(CustomGroupsFile, "http://www.UserR00T.com/dev/BPEssentials/customgroups.json"); break; } default: break; } } catch (Exception ex) { ErrorLogging.Run(ex); } }
public static void StartSaveTimer() { try { var Tmer = new System.Timers.Timer(); // TODO: Disposing the timer seems to break Tmer.Elapsed += (sender, e) => Run(); Tmer.Interval = SaveTime * 1000; Tmer.Enabled = true; } catch (Exception ex) { ErrorLogging.Run(ex); } }
public static bool SvAddCrime(SvPlayer player, ref byte crimeIndex, ref ShEntity victim) { try { if (GodModeLevel >= 1 && CheckGodMode.Run(player, null, "<color=#b7b5b5>Blocked crime and losing EXP!</color>")) { return(true); } } catch (Exception ex) { ErrorLogging.Run(ex); } return(false); }
public static bool TransferItem(ShPlayer player, ref byte deltaType, ref int itemIndex, ref int amount, ref bool dispatch) { try { if (player != null && BlockedItems.Count > 0 && BlockedItems.Contains(itemIndex)) { player.svPlayer.SendChatMessage(BlockedItemMessage); return(true); } } catch (Exception ex) { ErrorLogging.Run(ex); } return(false); }
public static void Run() { try { Debug.Log($"{PlaceholderParser.ParseTimeStamp()} [INFO] Saving game.."); foreach (var shPlayer in SvMan.players.Values.ToList()) { if (!shPlayer.svPlayer.serverside) { shPlayer.svPlayer.SendChatMessage("<color=#DCDADA>Saving game.. This can take up to 5 seconds.</color>"); shPlayer.svPlayer.Save(); } } } catch (Exception ex) { ErrorLogging.Run(ex); } }
public static ShPlayer Run(string player, bool idOnly = false) { try { foreach (var shPlayer in SvMan.players.Values) { if ((shPlayer.ID.ToString() == player || shPlayer.username == player) && !idOnly || shPlayer.ID.ToString() == player && idOnly) { return(shPlayer); } } return(null); } catch (Exception ex) { ErrorLogging.Run(ex); return(null); } }
public static void Run(string fileName, List <string> output) { try { output.Clear(); foreach (var line in File.ReadAllLines(fileName)) { if (line.StartsWith("#", StringComparison.CurrentCulture)) { continue; } output.Add(line); } } catch (Exception ex) { ErrorLogging.Run(ex); } }
public static void Run(bool silentExecution, SvPlayer player = null, bool IsFirstReload = false) { try { if (!silentExecution && player != null) { player.SendChatMessage("[WAIT] Reloading all files.."); } CheckFiles.Run(); ReadFile.Run(SettingsFile); ReadStream.Run(LanguageBlockFile, LanguageBlockWords); ReadStream.Run(ChatBlockFile, ChatBlockWords); ReadStream.Run(AdminListFile, AdminsListPlayers); ReadCustomCommands.Run(); ReadGroups.Run(); LanguageBlockWords = LanguageBlockWords.ConvertAll(d => d.ToLower()); ChatBlockWords = ChatBlockWords.ConvertAll(d => d.ToLower()); if (DownloadIdList && player == null) // do not download every time a player /reloads { GetIdList.Run(false); } else { ReadFile.Run(IdListItemsFile); ReadFile.Run(IdListVehicleFile); } ReadFile.Run(AnnouncementsFile); ReadFile.Run(GodListFile); ReadFile.Run(MuteListFile); ReadFile.Run(AfkListFile); ReadFile.Run(RulesFile); if (!silentExecution && player != null) { player.SendChatMessage("[OK] Critical config files reloaded"); } } catch (Exception ex) { ErrorLogging.Run(ex); } }
public static string ParseUserMessage(ShPlayer shplayer, string message, string playerMessage) { try { var src = DateTime.Now; var hm = new DateTime(src.Year, src.Month, src.Day, src.Hour, src.Minute, src.Second); var minutes = hm.ToString("mm"); var seconds = hm.ToString("ss"); // Improve this mess return(message .Replace("{YYYY}", hm.ToString("yyyy")) .Replace("{DD}", hm.ToString("dd")) .Replace("{DDDD}", hm.ToString("dddd")) .Replace("{MMMM}", hm.ToString("MMMM")) .Replace("{MM}", hm.ToString("MM")) .Replace("{H}", hm.ToString("HH")) .Replace("{h}", hm.ToString("hh")) .Replace("{M}", minutes) .Replace("{S}", seconds) .Replace("{T}", hm.ToString("tt")) .Replace("{username}", new Regex("(<)").Replace(shplayer.username, "<<b></b>")) .Replace("{id}", $"{shplayer.ID}") .Replace("{jobname}", Jobs[shplayer.job.jobIndex]) .Replace("{jobnameofficial}", shplayer.job.info.jobName) .Replace("{jobindex}", $"{shplayer.job.jobIndex}") .Replace("{jobcolor}", $"#{ColorUtility.ToHtmlStringRGB(shplayer.job.info.jobColor)}") .Replace("{discordlink}", MsgDiscord) .Replace("{infocolor}", infoColor) .Replace("{warningcolor}", warningColor) .Replace("{errorcolor}", errorColor) .Replace("{argcolor}", argColor) .Replace("{message}", new Regex("(<)").Replace(Chat.LangAndChatBlock.Run(playerMessage), "<<b></b>"))); } catch (Exception ex) { ErrorLogging.Run(ex); } return(null); }
public static bool SvGetJob(SvPlayer player, ref int employerID) { try { var shPlayer = player.player; var shEmployer = shPlayer.manager.FindByID <ShPlayer>(employerID); if (!WhitelistedJobs.ContainsKey(shEmployer.job.jobIndex)) { return(false); } if (HasPermission.Run(player, WhitelistedJobs[shEmployer.job.jobIndex], false, shPlayer.job.jobIndex)) { return(false); } player.SendChatMessage(MsgNoPermJob); return(true); } catch (Exception ex) { ErrorLogging.Run(ex); return(false); } }
public static void Run() { try { Groups.Clear(); _RootObject m = JsonConvert.DeserializeObject <_RootObject>(FilterComments.Run(CustomGroupsFile)); foreach (var group in m.Groups) { if (Groups.ContainsKey(group.Name)) { Debug.Log($"{PlaceholderParser.ParseTimeStamp()} [ERROR] Cannot add group {group.Name} To dictionary because it already exists!"); continue; } Groups.Add(group.Name, new _Group { Message = group.Message, Name = group.Name, Users = group.Usernames }); } } catch (Exception ex) { ErrorLogging.Run(ex); } }
public static bool Run(SvPlayer player, float?amount = null, string customMessage = null) { try { if (GodListPlayers.Contains(player.playerData.username)) { if (amount != null && ShowDMGMessage) { player.SendChatMessage($"<color=#b7b5b5>{amount} DMG Blocked!</color>"); } if (customMessage != null) { player.SendChatMessage(customMessage); } return(true); } } catch (Exception ex) { ErrorLogging.Run(ex); } return(false); }
public static void Run(string Reporter, string ReportReason, ShPlayer ReportedPlayer) { try { foreach (var currItem in PlayerList.Values) { if (currItem.ShPlayer.admin) { if (currItem.LastMenu == CurrentMenu.Main) { currItem.ShPlayer.svPlayer.Send(SvSendType.Self, Channel.Reliable, ClPacket.CloseFunctionMenu); currItem.ShPlayer.svPlayer.Send(SvSendType.Self, Channel.Reliable, ClPacket.ShowFunctionMenu, "<color=#00ffffff>New report:</color>\n<color=#00ffffff>Username: </color>" + ReportedPlayer.username + "\n<color=#00ffffff>Reporter: </color>" + Reporter + "\n<color=#00ffffff>Reason: </color>" + ReportReason + "\n\n<color=#00ffffff>F2: </color>Teleport to player<color=#00ffffff>\nF3-11: </color>Close menu\n\n<color=#00ffffff>Press</color><color=#ea8220> F11 </color><color=#00ffffff>To close this (G)UI</color>"); currItem.LastMenu = CurrentMenu.AdminReport; currItem.ReportedPlayer = ReportedPlayer; } } continue; } } catch (Exception ex) { ErrorLogging.Run(ex); } }
public static void Run(string file) { try { var watcher = new FileSystemWatcher { Path = Path.GetDirectoryName(file), Filter = Path.GetFileName(file), NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName, EnableRaisingEvents = true }; watcher.Changed += (sender, e) => { Debug.Log($"{PlaceholderParser.ParseTimeStamp()} [INFO] Found a change in file {file}, reloading all files..."); Debug.Log(" "); Reload.Run(true); }; } catch (Exception ex) { ErrorLogging.Run(ex); } }
public static void Run() { try { // this really needs some improvement // I don't know when I added that comment but seriously I should really redo this method.. whenever I have time // Every time I have to change something in this file it reminds me again that I should change this somehow.. I just don't know how. // lol yup still here.. f**k. // shrugs if (!Directory.Exists(FileDirectory)) { Directory.CreateDirectory(FileDirectory); Debug.Log(FileDirectory + " Does not exist! Creating one."); } if (!Directory.Exists(LogDirectory)) { Directory.CreateDirectory(LogDirectory); Debug.Log(LogDirectory + " Does not exist! Creating one."); } if (!Directory.Exists(KitDirectory)) { Directory.CreateDirectory(KitDirectory); Debug.Log(KitDirectory + " Does not exist! Creating one."); } if (!Directory.Exists(WarpDirectory)) { Directory.CreateDirectory(WarpDirectory); Debug.Log(WarpDirectory + " Does not exist! Creating one."); } if (!File.Exists(AutoReloader)) { File.Create(AutoReloader).Close(); Debug.Log(AutoReloader + " Does not exist! Creating one."); } if (!File.Exists(AfkListFile)) { File.Create(AfkListFile).Close(); Debug.Log(AfkListFile + " Does not exist! Creating one."); } if (!File.Exists(MuteListFile)) { File.Create(MuteListFile).Close(); Debug.Log(MuteListFile + " Does not exist! Creating one."); } if (!File.Exists(ChatBlockFile)) { File.Create(ChatBlockFile).Close(); CreateFile.Run(ChatBlockFile); Debug.Log(ChatBlockFile + " Does not exist! Creating one."); } if (!File.Exists(GodListFile)) { File.Create(GodListFile).Close(); Debug.Log(GodListFile + " Does not exist! Creating one."); } if (!File.Exists(IpListFile)) { File.Create(IpListFile).Close(); Debug.Log(IpListFile + " Does not exist! Creating one."); } if (!File.Exists(LanguageBlockFile)) { File.Create(LanguageBlockFile).Close(); CreateFile.Run(LanguageBlockFile); Debug.Log(LanguageBlockFile + " Does not exist! Creating one."); } if (!File.Exists(MuteListFile)) { File.Create(MuteListFile).Close(); Debug.Log(MuteListFile + " Does not exist! Creating one."); } if (!File.Exists(SettingsFile)) { File.Create(SettingsFile).Close(); CreateFile.Run(SettingsFile); Debug.Log(SettingsFile + " Does not exist! Creating one."); } if (!File.Exists(CustomGroupsFile)) { File.Create(CustomGroupsFile).Close(); CreateFile.Run(CustomGroupsFile); Debug.Log(CustomGroupsFile + " Does not exist! Creating one."); } if (!File.Exists(CustomCommandsFile)) { File.Create(CustomCommandsFile).Close(); CreateFile.Run(CustomCommandsFile); Debug.Log(CustomCommandsFile + " Does not exist! Creating one."); } if (!File.Exists(AnnouncementsFile)) { File.Create(AnnouncementsFile).Close(); Debug.Log(AnnouncementsFile + " Does not exist! Creating one."); } if (!File.Exists(LogFile)) { File.Create(LogFile).Close(); Debug.Log(LogFile + " Does not exist! Creating one."); } if (!File.Exists(ChatLogFile)) { File.Create(ChatLogFile).Close(); Debug.Log(ChatLogFile + " Does not exist! Creating one."); } if (!File.Exists(CommandLogFile)) { File.Create(CommandLogFile).Close(); Debug.Log(CommandLogFile + " Does not exist! Creating one."); } } catch (Exception ex) { ErrorLogging.Run(ex); } }
public static void Run(string fileName) { try { IdListObject idlist; switch (fileName) { case SettingsFile: var m = JsonConvert.DeserializeObject <__RootObject>(FilterComments.Run(SettingsFile)); LocalVersion = m.General.Version; CmdCommandCharacter = m.General.CommandCharacter; DownloadIdList = m.General.DownloadIDList; TimestampFormat = m.General.TimestapFormat; MsgSayColor = m.General.MsgSayColor; MsgUnknownCommand = m.General.DisplayUnknownCommandMessage; VoteKickDisabled = m.General.VoteKickDisabled; ShowDMGMessage = m.General.ShowDMGMessage; DebugLevel = m.General.DebugLevel; EnableDiscordWebhook_Ban = m.General.EnableDiscordWebhook_Ban; if (EnableDiscordWebhook_Ban && string.IsNullOrEmpty(m.General.DiscordWebhook_Ban.Trim())) { Debug.Log("[ERROR] Discord webhook_Ban is empty but EnableDiscordWebhook_Ban is true! Disabling webhook_Ban."); EnableDiscordWebhook_Ban = false; } else { DiscordWebhook_Ban = m.General.DiscordWebhook_Ban; } EnableDiscordWebhook_Report = m.General.EnableDiscordWebhook_Report; if (EnableDiscordWebhook_Report && string.IsNullOrEmpty(m.General.DiscordWebhook_Report.Trim())) { Debug.Log("[ERROR] Discord webhook_Report is empty but EnableDiscordWebhook_Report is true! Disabling webhook_Report."); EnableDiscordWebhook_Report = false; } else { DiscordWebhook_Report = m.General.DiscordWebhook_Report; } BlockBanButtonTabMenu = m.General.BlockBanButtonTabMenu; blockLicenseRemoved = m.General.BlockLicenseRemoved; MessagesAllowedPerSecond = m.General.MessagesAllowedPerSecond; TimeBetweenDelay = m.General.TimeBetweenDelay; WipePassword = m.General.WipePassword; infoColor = m.MessageColors.Info; errorColor = m.MessageColors.Error; warningColor = m.MessageColors.Warning; argColor = m.MessageColors.Arg; MsgNoPerm = m.Messages.NoPerm; MsgDiscord = m.Messages.DiscordLink; MsgSayPrefix = m.Messages.MsgSayPrefix; DisabledCommand = $"<color={errorColor}>{m.Messages.DisabledCommand}</color>"; PlayerIsAFK = $"<color={warningColor}>{m.Messages.PlayerIsAFK}</color>"; SelfIsMuted = $"<color={errorColor}>{m.Messages.SelfIsMuted}</color>"; ArgRequired = $"<color={errorColor}>{m.Messages.ArgRequired}</color>"; NotFoundOnline = $"<color={errorColor}>{m.Messages.NotFoundOnline}</color>"; NotFoundOnlineIdOnly = $"<color={errorColor}>{m.Messages.NotFoundOnlineIdOnly}</color>"; AdminSearchingInv = $"<color={errorColor}>{m.Messages.AdminSearchingInv}</color>"; PlayerMessage = m.Messages.PlayerMessage; AdminMessage = m.Messages.AdminMessage; AdminChatMessage = m.Messages.AdminChatMessage; MsgNoPermJob = $"<color={errorColor}>{m.Messages.MsgNoPermJob}</color>"; BlockedItemMessage = $"<color={errorColor}>{m.Messages.BlockedItem}</color>"; MsgNoWantedAllowed = $"<color={errorColor}>{m.Messages.MsgNoWantedAllowed}</color>"; MsgNoCuffedAllowed = $"<color={errorColor}>{m.Messages.MsgNoCuffedAllowed}</color>"; MsgNoJailAllowed = $"<color={errorColor}>{m.Messages.MsgNoJailAllowed}</color>"; MeMessage = m.Messages.MeMessage; AccessMoneyMenu = m.FunctionUI.AccessMoneyMenu; AccessItemMenu = m.FunctionUI.AccessItemMenu; AccessSetHPMenu = m.FunctionUI.AccessSetHPMenu; AccessSetStatsMenu = m.FunctionUI.AccessSetStatsMenu; AccessCWMenu = m.FunctionUI.AccessCWMenu; ReportReasons = new string[] { m.ReportOptions.F2, m.ReportOptions.F3, m.ReportOptions.F4, m.ReportOptions.F5, m.ReportOptions.F6, m.ReportOptions.F7, m.ReportOptions.F8, m.ReportOptions.F9, m.ReportOptions.F10 }; // Softcode this someday Jobs = new string[] { m.JobIndexArray.Citizen, m.JobIndexArray.Criminal, m.JobIndexArray.Prisoner, m.JobIndexArray.Police, m.JobIndexArray.Paramedic, m.JobIndexArray.Firefighter, m.JobIndexArray.Rojo_Loco, m.JobIndexArray.Green_St_Fam, m.JobIndexArray.Borgata_Blue, m.JobIndexArray.Mayor, m.JobIndexArray.DeliveryDriver, m.JobIndexArray.TaxiDriver, m.JobIndexArray.SpecOps }; BlockedItems = m.BlockedItems; EnableBlockSpawnBot = m.Misc.EnableBlockSpawnBot; LanguageBlock = m.Misc.EnableLanguageBlock; ChatBlock = m.Misc.EnableChatBlock; CheckBannedEnabled = m.Misc.CheckBannedEnabled; TimeBetweenAnnounce = m.Misc.TimeBetweenAnnounce; Variables.Announcer.Interval = TimeBetweenAnnounce; TimescaleDisabled = m.Misc.TimescaleDisabled; if (m.Misc.EnableBlockSpawnBot) { BlockedSpawnIds = m.Misc.BlockSpawnBot.Split(',').Select(int.Parse).ToArray(); } GodModeLevel = m.Misc.GodModeLevel; ShowJailMessage = m.Misc.ShowJailMessage; BlockSuicide = m.Misc.BlockSuicide; BlockMissions = m.Misc.BlockMissions; ProximityChat = m.Misc.ProximityChat; LocalChatMute = m.Misc.LocalChatMute; LocalChatMe = m.Misc.LocalChatMe; foreach (var currJob in m.WhitelistedJobs) { if (WhitelistedJobs.ContainsKey(currJob.JobIndex)) { Debug.Log($"{PlaceholderParser.ParseTimeStamp()} [WARNING] WhitelistedJobs already contains a item with the key '{currJob.JobIndex}'! (Did you make two objects with the same JobIndex?)"); continue; } WhitelistedJobs.Add(currJob.JobIndex, currJob.Whitelisted); } RegisterCommands.Run(m.Commands); break; case IdListItemsFile: idlist = JsonConvert.DeserializeObject <IdListObject>(FilterComments.Run(IdListItemsFile)); IDs_Items = idlist.items.Select(x => x.gameid).ToArray(); break; case IdListVehicleFile: idlist = JsonConvert.DeserializeObject <IdListObject>(FilterComments.Run(IdListVehicleFile)); IDs_Vehicles = idlist.items.Select(x => x.gameid).ToArray(); break; case AnnouncementsFile: Variables.Announcer.Announcements = File.ReadAllLines(fileName).ToList(); break; case RulesFile: Rules = File.ReadAllText(fileName); break; case GodListFile: GodListPlayers = File.ReadAllLines(fileName).ToList(); break; case AfkListFile: AfkPlayers = File.ReadAllLines(fileName).ToList(); break; case MuteListFile: MutePlayers = File.ReadAllLines(fileName).ToList(); break; default: break; } } catch (Exception ex) { ErrorLogging.Run(ex); } }
public static bool SvGlobalChatMessage(SvPlayer player, ref string message) { try { var tempMessage = message; if (HandleSpam.Run(player, tempMessage)) { return(true); } //Message Logging if (!MutePlayers.Contains(player.playerData.username)) { LogMessage.Run(player, message); } if (message.StartsWith(CmdCommandCharacter, StringComparison.CurrentCulture)) { if (OnCommand(player, ref message)) { return(true); } } //Checks if the player is muted. if (MutePlayers.Contains(player.playerData.username)) { player.SendChatMessage(SelfIsMuted); return(true); } //Checks if the message contains a username that is AFK. if (AfkPlayers.Any(message.Contains)) { player.SendChatMessage(PlayerIsAFK); } var shPlayer = player.player; if (!PlayerList[shPlayer.ID].ChatEnabled) { player.SendChatMessage($"<color={warningColor}>Please enable your chat again by typing</color> <color={argColor}>{CmdCommandCharacter}{CmdToggleChat}</color><color={warningColor}>.</color>"); return(true); } if (PlayerList[shPlayer.ID].StaffChatEnabled) { SendChatMessageToAdmins.Run(PlaceholderParser.ParseUserMessage(shPlayer, AdminChatMessage, message)); return(true); } foreach (var curr in Groups) { if (curr.Value.Users.Contains(player.playerData.username)) { SendChatMessage.Run(PlaceholderParser.ParseUserMessage(shPlayer, curr.Value.Message, message)); return(true); } } if (player.player.admin) { SendChatMessage.Run(PlaceholderParser.ParseUserMessage(shPlayer, AdminMessage, message)); return(true); } SendChatMessage.Run(PlaceholderParser.ParseUserMessage(shPlayer, PlayerMessage, message)); } catch (Exception ex) { ErrorLogging.Run(ex); } return(true); }