private void CmdUnmute(IPlayer player, string cmd, string[] args) { if (args.Length != 1) { player.Reply(lang.GetMessage("Invalid Syntax Unmute", this, player.Id)); return; } IPlayer target = GetPlayer(args[0], player); if (target == null) { return; } if (!MuteInfo.IsMuted(target)) { player.Reply(lang.GetMessage("Not Muted", this, player.Id).Replace("{player}", target.Name)); return; } mutes.Remove(target.Id); SaveData(mutes); Interface.CallHook("OnBetterChatUnmuted", target, player); PublicMessage("Unmuted", new KeyValuePair <string, string>("initiator", player.Name), new KeyValuePair <string, string>("player", target.Name)); }
private object OnUserChat(IPlayer player, string message) { object result = HandleChat(player); if (result is bool && !(bool)result) { if (!MuteInfo.IsMuted(player) && globalMute) { player.Reply(lang.GetMessage("Global Mute Active", this, player.Id)); } else if (mutes[player.Id].Timed) { player.Reply( lang.GetMessage("Time Muted Player Chat", this, player.Id) .Replace("{time}", FormatTime(mutes[player.Id].ExpireDate - DateTime.UtcNow)) ); } else { player.Reply(lang.GetMessage("Muted Player Chat", this, player.Id)); } } return(result); }
private void UpdateMuteStatus(IPlayer player) { if (MuteInfo.IsMuted(player) && mutes[player.Id].Expired) { mutes.Remove(player.Id); SaveData(mutes); PublicMessage("Mute Expired", new KeyValuePair <string, string>("player", players.FindPlayerById(player.Id)?.Name)); Interface.CallHook("OnBetterChatMuteExpired", player); } }
private void OnUserInit(IPlayer player) { UpdateMuteStatus(player); if (MuteInfo.IsMuted(player)) { if (mutes[player.Id].Timed) { PublicMessage("Time Muted Player Joined", new KeyValuePair <string, string>("player", player.Name), new KeyValuePair <string, string>("time", FormatTime(mutes[player.Id].ExpireDate - DateTime.UtcNow))); } else { PublicMessage("Muted Player Joined", new KeyValuePair <string, string>("player", player.Name)); } } }
private object HandleChat(IPlayer player, bool isPublicChat) { if (!isPublicChat) { return(null); } UpdateMuteStatus(player); var result = Interface.CallHook("OnBetterChatMuteHandle", player, MuteInfo.IsMuted(player) ? JObject.FromObject(_mutes[player.Id]) : null); if (result != null) { return(result); } if (MuteInfo.IsMuted(player)) { if (_mutes[player.Id].Timed) { player.Reply(lang.GetMessage("Time Muted Player Chat", this, player.Id) .Replace("{time}", FormatTime(_mutes[player.Id].ExpireDate - DateTime.UtcNow)) ); } else { player.Reply(lang.GetMessage("Muted Player Chat", this, player.Id)); } return(true); } if (_globalMute && !permission.UserHasPermission(player.Id, "betterchatmute.use.global")) { player.Reply(lang.GetMessage("Global Mute Active", this, player.Id)); return(true); } return(null); }
private object HandleChat(IPlayer player) { UpdateMuteStatus(player); var result = Interface.CallHook("OnBetterChatMuteHandle", player, MuteInfo.IsMuted(player) ? JObject.FromObject(mutes[player.Id]) : null); if (result != null) { return(null); } if (MuteInfo.IsMuted(player)) { return(false); } if (globalMute && !permission.UserHasPermission(player.Id, "betterchatmute.use.global")) { return(false); } return(null); }
private bool API_Unmute(IPlayer target, IPlayer player, bool callHook = true, bool broadcast = true) { if (!MuteInfo.IsMuted(target)) { return(false); } mutes.Remove(target.Id); SaveData(mutes); if (callHook) { Interface.CallHook("OnBetterChatUnmuted", target, player); } if (broadcast) { PublicMessage("Unmuted", new KeyValuePair <string, string>("initiator", player.Name), new KeyValuePair <string, string>("player", target.Name)); } return(true); }