/// <inheritdoc cref="Exiled.Events.Handlers.Player.OnReceivingEffect(ReceivingEffectEventArgs)"/> public void OnReceivingEffect(ReceivingEffectEventArgs ev) { Log.Info($"{ev.Player.Nickname} is receiving effect {ev.Effect}. Duration: {ev.Duration} New Intensity: {ev.State} Old Intensity: {ev.CurrentState}"); if (ev.Effect is Invigorated) { Log.Info($"{ev.Player.Nickname} is being rejected the {nameof(Invigorated)} effect!"); ev.IsAllowed = false; } }
public void OnReceivingEffect(ReceivingEffectEventArgs ev) { // Check that the player receiving the effect is the same player if (player != null && player.Id == ev.Player.Id) { // Remove the 'negative' effect SCP999x.Extensions.Extensions.removeNegativeStatusEffect(player); } }
private static bool Prefix(PlayerEffect __instance, byte newState) { try { if (__instance.Intensity == newState) { return(false); } var ev = new ReceivingEffectEventArgs(API.Features.Player.Get(__instance.Hub.gameObject), __instance, newState, __instance.Intensity); Exiled.Events.Handlers.Player.OnReceivingEffect(ev); if (!ev.IsAllowed) { return(false); } byte intensity = ev.CurrentState; __instance.Intensity = ev.State; if (NetworkServer.active) { __instance.Hub.playerEffectsController.Resync(); } __instance.ServerOnIntensityChange(intensity, ev.State); if (ev.Duration > 0.0f) { Timing.CallDelayed(0.5f, () => __instance.Duration = ev.Duration); } return(false); } catch (Exception e) { Log.Error($"RecievingEffect: {e}"); return(true); } }
/// <summary> /// Called before receiving an effect. /// </summary> /// <param name="ev">The <see cref="ReceivingEffectEventArgs"/> instance.</param> public static void OnReceivingEffect(ReceivingEffectEventArgs ev) => ReceivingEffect.InvokeSafely(ev);