diff --git a/EXILED/Exiled.Events/EventArgs/Player/EscapingPocketDimensionEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/EscapingPocketDimensionEventArgs.cs index 4a9e233dd9..841edfdcf6 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/EscapingPocketDimensionEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/EscapingPocketDimensionEventArgs.cs @@ -24,16 +24,16 @@ public class EscapingPocketDimensionEventArgs : IPlayerEvent, IDeniableEvent /// /// /// - /// + /// /// /// /// /// /// - public EscapingPocketDimensionEventArgs(PocketDimensionTeleport pocketDimensionTeleport, Player player, Vector3 position) + public EscapingPocketDimensionEventArgs(PocketDimensionTeleport pocketDimensionTeleport, ReferenceHub hub, Vector3 position) { Teleporter = pocketDimensionTeleport; - Player = player; + Player = Player.Get(hub); TeleportPosition = position; } diff --git a/EXILED/Exiled.Events/Patches/Events/Player/EscapingPocketDimension.cs b/EXILED/Exiled.Events/Patches/Events/Player/EscapingPocketDimension.cs index fb40fe943f..03153ab7a5 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/EscapingPocketDimension.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/EscapingPocketDimension.cs @@ -48,10 +48,10 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); Label returnLabel = generator.DefineLabel(); - int offset = -3; + int offset = -6; int index = newInstructions.FindIndex( - instruction => instruction.opcode == OpCodes.Newobj && (ConstructorInfo)instruction.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerCuffingEventArgs))[0]) + offset; + instruction => instruction.opcode == OpCodes.Newobj && (ConstructorInfo)instruction.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerUncuffingEventArgs))[0]) + offset; newInstructions.InsertRange( index, diff --git a/EXILED/Exiled.Events/Patches/Events/Player/SendingValidGameConsoleCommand.cs b/EXILED/Exiled.Events/Patches/Events/Player/SendingValidGameConsoleCommand.cs index 170107af59..e1ff66c95a 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/SendingValidGameConsoleCommand.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/SendingValidGameConsoleCommand.cs @@ -18,7 +18,7 @@ namespace Exiled.Events.Patches.Events.Player using Exiled.Events.EventArgs.Player; using HarmonyLib; - + using LabApi.Features.Enums; using RemoteAdmin; using static HarmonyLib.AccessTools; @@ -67,8 +67,8 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable instrction.Calls(Method(typeof(GameConsoleTransmission), nameof(GameConsoleTransmission.SendToClient)))) + offset; + index = newInstructions.FindLastIndex(i => i.Calls(Method(typeof(GameConsoleTransmission), nameof(GameConsoleTransmission.SendToClient)))) + offset; newInstructions.InsertRange( index, new CodeInstruction[] { - // this - new(OpCodes.Ldarg_0), - - // this._hub - new(OpCodes.Ldfld, Field(typeof(QueryProcessor), nameof(QueryProcessor._hub))), - - // Player.Get(Hub) - new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new Type[] { typeof(ReferenceHub) })), + // Player.Get(sender) + new(OpCodes.Ldloc_0), + new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(CommandSender) })), // command - new(OpCodes.Ldloc_1), + new(OpCodes.Ldloc_S, 4), - // commandtype CLIENT - new(OpCodes.Ldc_I4_2), + // CommandType.Client + new (OpCodes.Ldc_I4_S, (sbyte)CommandType.Client), // query new(OpCodes.Ldarg_1), diff --git a/EXILED/Exiled.Events/Patches/Events/Player/SendingValidRACommand.cs b/EXILED/Exiled.Events/Patches/Events/Player/SendingValidRACommand.cs index e22c9c313b..a9a0f9d9fb 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/SendingValidRACommand.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/SendingValidRACommand.cs @@ -18,7 +18,7 @@ namespace Exiled.Events.Patches.Events.Player using Exiled.Events.EventArgs.Player; using HarmonyLib; - + using LabApi.Features.Enums; using RemoteAdmin; using static HarmonyLib.AccessTools; @@ -66,8 +66,8 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable instrction.Calls(Method(typeof(CommandSender), nameof(CommandSender.RaReply)))) + offset; + index = newInstructions.FindIndex(i => i.Calls(Method(typeof(CommandSender), nameof(CommandSender.RaReply)))) + offset; newInstructions.InsertRange( index, - new CodeInstruction[] + new[] { // sender - new (OpCodes.Ldarg_1), + new CodeInstruction(OpCodes.Ldarg_1).MoveLabelsFrom(newInstructions[index]), // Player.get(sender) - new (OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new Type[] { typeof(CommandSender) })), + new (OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(CommandSender) })), // command new (OpCodes.Ldloc_2), - // commandtype - new (OpCodes.Ldc_I4_4), + // CommandType.RemoteAdmin + new (OpCodes.Ldc_I4_S, (sbyte)CommandType.RemoteAdmin), // query new (OpCodes.Ldarg_0),