Пример #1
0
        private static bool Prefix(CharacterClassManager __instance, bool value)
        {
            try
            {
                ChangingMuteStatusEventArgs ev = new ChangingMuteStatusEventArgs(API.Features.Player.Get(__instance._hub), value, true);

                Player.OnChangingMuteStatus(ev);

                if (!ev.IsAllowed)
                {
                    if (value == true)
                    {
                        MuteHandler.RevokePersistentMute(__instance.UserId);
                    }
                    else
                    {
                        MuteHandler.IssuePersistentMute(__instance.UserId);
                    }

                    return(false);
                }

                return(true);
            }
            catch (Exception e)
            {
                Exiled.API.Features.Log.Error($"{typeof(ChangingMuteStatus).FullName}.{nameof(Prefix)}:\n{e}");
                return(true);
            }
        }
Пример #2
0
 /// <summary>
 /// Called before an user's mute status is changed.
 /// </summary>
 /// <param name="ev">The <see cref="ChangingMuteStatusEventArgs"/> instance.</param>
 public static void OnChangingMuteStatus(ChangingMuteStatusEventArgs ev) => ChangingMuteStatus.InvokeSafely(ev);