From 3e46db6f1c306e80e0ee97cfae7caeb226aaef54 Mon Sep 17 00:00:00 2001 From: Bolton <48883340+BoltonDev@users.noreply.github.com> Date: Mon, 28 Apr 2025 16:55:53 +0200 Subject: [PATCH 1/5] fix: command type invalid --- .../Events/Player/SendingValidGameConsoleCommand.cs | 10 +++++----- .../Patches/Events/Player/SendingValidRACommand.cs | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/EXILED/Exiled.Events/Patches/Events/Player/SendingValidGameConsoleCommand.cs b/EXILED/Exiled.Events/Patches/Events/Player/SendingValidGameConsoleCommand.cs index 170107af59..2bbaba7e58 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 Transpiler(IEnumerable Transpiler(IEnumerable Date: Mon, 28 Apr 2025 17:06:20 +0200 Subject: [PATCH 2/5] fix: landing event --- EXILED/Exiled.Events/Patches/Events/Player/Landing.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Landing.cs b/EXILED/Exiled.Events/Patches/Events/Player/Landing.cs index ccdad0f5ac..6f70c4b8b0 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Landing.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Landing.cs @@ -43,7 +43,7 @@ private static IEnumerable Transpiler(IEnumerable Date: Mon, 28 Apr 2025 17:24:34 +0200 Subject: [PATCH 3/5] fix: EscapingPocketDimension event --- .../EventArgs/Player/EscapingPocketDimensionEventArgs.cs | 6 +++--- .../Patches/Events/Player/EscapingPocketDimension.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) 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 Date: Mon, 28 Apr 2025 18:19:23 +0200 Subject: [PATCH 4/5] fix: Handcuffing / RemovingHandcuff events --- .../Patches/Events/Player/ProcessDisarmMessage.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ProcessDisarmMessage.cs b/EXILED/Exiled.Events/Patches/Events/Player/ProcessDisarmMessage.cs index cdc4ee1913..559af2a032 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ProcessDisarmMessage.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ProcessDisarmMessage.cs @@ -38,9 +38,9 @@ private static 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, From a15d85a51d85b7f8c23622d3238fa8b091f7ec10 Mon Sep 17 00:00:00 2001 From: Bolton <48883340+BoltonDev@users.noreply.github.com> Date: Mon, 28 Apr 2025 21:25:16 +0200 Subject: [PATCH 5/5] fix: sentvalidcommand event --- .../Player/SendingValidGameConsoleCommand.cs | 15 +++++---------- .../Events/Player/SendingValidRACommand.cs | 8 ++++---- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/EXILED/Exiled.Events/Patches/Events/Player/SendingValidGameConsoleCommand.cs b/EXILED/Exiled.Events/Patches/Events/Player/SendingValidGameConsoleCommand.cs index 2bbaba7e58..e1ff66c95a 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/SendingValidGameConsoleCommand.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/SendingValidGameConsoleCommand.cs @@ -130,22 +130,17 @@ private static 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_S, (sbyte)CommandType.Client), diff --git a/EXILED/Exiled.Events/Patches/Events/Player/SendingValidRACommand.cs b/EXILED/Exiled.Events/Patches/Events/Player/SendingValidRACommand.cs index f35bd89a98..a9a0f9d9fb 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/SendingValidRACommand.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/SendingValidRACommand.cs @@ -128,16 +128,16 @@ private static 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),