diff --git a/EXILED/Exiled.Events/EventArgs/Player/InteractingLockerEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/InteractingLockerEventArgs.cs
index 46a7dfc63..da490ade7 100644
--- a/EXILED/Exiled.Events/EventArgs/Player/InteractingLockerEventArgs.cs
+++ b/EXILED/Exiled.Events/EventArgs/Player/InteractingLockerEventArgs.cs
@@ -24,16 +24,20 @@ public class InteractingLockerEventArgs : IPlayerEvent, IDeniableEvent
///
///
///
- ///
+ ///
+ ///
+ ///
+ ///
///
///
///
///
///
- public InteractingLockerEventArgs(Player player, MapGeneration.Distributors.LockerChamber lockerChamber, bool isAllowed)
+ public InteractingLockerEventArgs(Player player, MapGeneration.Distributors.Locker locker, byte colliderId, bool isAllowed)
{
Player = player;
- InteractingChamber = API.Features.Lockers.Chamber.Get(lockerChamber);
+ InteractingLocker = API.Features.Lockers.Locker.Get(locker);
+ InteractingChamber = API.Features.Lockers.Chamber.Get(locker.Chambers[colliderId]);
IsAllowed = isAllowed;
}
@@ -52,7 +56,7 @@ public InteractingLockerEventArgs(Player player, MapGeneration.Distributors.Lock
///
/// Gets the locker which is containing .
///
- public Locker InteractingLocker => InteractingChamber.Locker;
+ public Locker InteractingLocker { get; }
///
/// Gets the interacting chamber.
diff --git a/EXILED/Exiled.Events/Patches/Events/Player/InteractingLocker.cs b/EXILED/Exiled.Events/Patches/Events/Player/InteractingLocker.cs
index e99120751..3694168e4 100644
--- a/EXILED/Exiled.Events/Patches/Events/Player/InteractingLocker.cs
+++ b/EXILED/Exiled.Events/Patches/Events/Player/InteractingLocker.cs
@@ -32,29 +32,28 @@ private static IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions);
- const int offset = -9;
- int index = newInstructions.FindIndex(instruction => instruction.opcode == OpCodes.Newobj) + offset;
+ int index = newInstructions.FindLastIndex(instruction => instruction.opcode == OpCodes.Ldloc_0);
newInstructions.InsertRange(
index,
new[]
{
// Player.Get(ply);
- new CodeInstruction(OpCodes.Ldarg_1),
+ new CodeInstruction(OpCodes.Ldarg_1).MoveLabelsFrom(newInstructions[index]),
new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })),
- // this.Chambers[colliderId]
+ // this
new(OpCodes.Ldarg_0),
- new(OpCodes.Ldfld, Field(typeof(Locker), nameof(Locker.Chambers))),
+
+ // colliderId
new(OpCodes.Ldarg_2),
- new(OpCodes.Ldelem_Ref),
// !flag
new(OpCodes.Ldloc_0),
new(OpCodes.Ldc_I4_0),
new(OpCodes.Ceq),
- // InteractingLockerEventArgs ev = new(Player, Locker, LockerChamber, byte, bool)
+ // InteractingLockerEventArgs ev = new(Player, Locker, byte, bool)
new CodeInstruction(OpCodes.Newobj, GetDeclaredConstructors(typeof(InteractingLockerEventArgs))[0]),
new(OpCodes.Dup),