Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ChargingJailbird #1

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion EXILED/Exiled.Events/EventArgs/Item/ChargingJailbirdEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

namespace Exiled.Events.EventArgs.Item
{
using System;

using Exiled.API.Features;
using Exiled.API.Features.Items;
using Exiled.Events.EventArgs.Interfaces;
Expand All @@ -26,7 +28,9 @@ public ChargingJailbirdEventArgs(ReferenceHub player, InventorySystem.Items.Item
{
Player = Player.Get(player);
Item = Item.Get(swingItem);
#pragma warning disable CS0618
IsAllowed = isAllowed;
#pragma warning restore CS0618
}

/// <summary>
Expand All @@ -42,6 +46,11 @@ public ChargingJailbirdEventArgs(ReferenceHub player, InventorySystem.Items.Item
/// <summary>
/// Gets or sets a value indicating whether or not the Jailbird can be charged.
/// </summary>
public bool IsAllowed { get; set; }
public bool IsAllowed
{
get;
[Obsolete("This event cannot be denied as it will cause desync.")]
set;
}
}
}
5 changes: 1 addition & 4 deletions EXILED/Exiled.Events/Patches/Events/Item/JailbirdPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,7 @@ private static bool HandleJailbird(JailbirdItem instance, JailbirdMessageType me
ChargingJailbirdEventArgs ev = new(instance.Owner, instance);

Item.OnChargingJailbird(ev);
if (ev.IsAllowed)
return true;
instance.SendRpc(JailbirdMessageType.ChargeFailed, null);
return false;
return true;
}

default:
Expand Down
Loading