Skip to content

Commit

Permalink
Fix ChargingJailbird (#2)
Browse files Browse the repository at this point in the history
* Update ChargingJailbirdEventArgs.cs

* Update JailbirdPatch.cs

* Update dev.yml

* Update labeler.yml
  • Loading branch information
Misaka-ZeroTwo authored Aug 1, 2024
1 parent 0698e6e commit 2e1686e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
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

0 comments on commit 2e1686e

Please sign in to comment.