Skip to content

Commit 219ba2b

Browse files
authored
fix: some fixes for 14.1 (#516)
2 parents cc624de + a15d85a commit 219ba2b

File tree

6 files changed

+27
-32
lines changed

6 files changed

+27
-32
lines changed

EXILED/Exiled.Events/EventArgs/Player/EscapingPocketDimensionEventArgs.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ public class EscapingPocketDimensionEventArgs : IPlayerEvent, IDeniableEvent
2424
/// <param name="pocketDimensionTeleport">
2525
/// <inheritdoc cref="Teleporter" />
2626
/// </param>
27-
/// <param name="player">
27+
/// <param name="hub">
2828
/// <inheritdoc cref="Player" />
2929
/// </param>
3030
/// <param name="position">
3131
/// <inheritdoc cref="TeleportPosition" />
3232
/// </param>
33-
public EscapingPocketDimensionEventArgs(PocketDimensionTeleport pocketDimensionTeleport, Player player, Vector3 position)
33+
public EscapingPocketDimensionEventArgs(PocketDimensionTeleport pocketDimensionTeleport, ReferenceHub hub, Vector3 position)
3434
{
3535
Teleporter = pocketDimensionTeleport;
36-
Player = player;
36+
Player = Player.Get(hub);
3737
TeleportPosition = position;
3838
}
3939

EXILED/Exiled.Events/Patches/Events/Player/EscapingPocketDimension.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
4848
new[]
4949
{
5050
// pocketDimensionTeleport
51-
new CodeInstruction(OpCodes.Ldarg_0),
51+
new CodeInstruction(OpCodes.Ldarg_0).MoveLabelsFrom(newInstructions[index]),
5252

5353
// referenceHub
54-
new CodeInstruction(OpCodes.Ldarg_1).MoveLabelsFrom(newInstructions[index]),
54+
new CodeInstruction(OpCodes.Ldarg_1),
5555

5656
// Scp106PocketExitFinder.GetBestExitPosition(fpcRole)
5757
new(OpCodes.Ldloc_0),

EXILED/Exiled.Events/Patches/Events/Player/Landing.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
4343
{
4444
// Player.Get(base.OwnerHub)
4545
new CodeInstruction(OpCodes.Ldarg_0).MoveLabelsFrom(newInstructions[index]),
46-
new(OpCodes.Call, PropertyGetter(typeof(CharacterModel), nameof(CharacterModel.OwnerHub))),
46+
new(OpCodes.Callvirt, PropertyGetter(typeof(CharacterModel), nameof(CharacterModel.OwnerHub))),
4747
new(OpCodes.Call, Method(typeof(API.Features.Player), nameof(API.Features.Player.Get), new[] { typeof(ReferenceHub) })),
4848

4949
// LandingEventArgs ev = new(Player)

EXILED/Exiled.Events/Patches/Events/Player/ProcessDisarmMessage.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
3838
List<CodeInstruction> newInstructions = ListPool<CodeInstruction>.Pool.Get(instructions);
3939
Label returnLabel = generator.DefineLabel();
4040

41-
int offset = -3;
41+
int offset = -6;
4242
int index = newInstructions.FindIndex(
43-
instruction => instruction.opcode == OpCodes.Newobj && (ConstructorInfo)instruction.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerCuffingEventArgs))[0]) + offset;
43+
instruction => instruction.opcode == OpCodes.Newobj && (ConstructorInfo)instruction.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerUncuffingEventArgs))[0]) + offset;
4444

4545
newInstructions.InsertRange(
4646
index,

EXILED/Exiled.Events/Patches/Events/Player/SendingValidGameConsoleCommand.cs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace Exiled.Events.Patches.Events.Player
1818
using Exiled.Events.EventArgs.Player;
1919

2020
using HarmonyLib;
21-
21+
using LabApi.Features.Enums;
2222
using RemoteAdmin;
2323

2424
using static HarmonyLib.AccessTools;
@@ -67,8 +67,8 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
6767
// command
6868
new (OpCodes.Ldloc_S, 4),
6969

70-
// commandtype client
71-
new(OpCodes.Ldc_I4_2),
70+
// CommandType.Client
71+
new(OpCodes.Ldc_I4_S, (sbyte)CommandType.Client),
7272

7373
// query
7474
new(OpCodes.Ldarg_1),
@@ -130,25 +130,20 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
130130
});
131131

132132
offset = 1;
133-
index = newInstructions.FindIndex(instrction => instrction.Calls(Method(typeof(GameConsoleTransmission), nameof(GameConsoleTransmission.SendToClient)))) + offset;
133+
index = newInstructions.FindLastIndex(i => i.Calls(Method(typeof(GameConsoleTransmission), nameof(GameConsoleTransmission.SendToClient)))) + offset;
134134
newInstructions.InsertRange(
135135
index,
136136
new CodeInstruction[]
137137
{
138-
// this
139-
new(OpCodes.Ldarg_0),
140-
141-
// this._hub
142-
new(OpCodes.Ldfld, Field(typeof(QueryProcessor), nameof(QueryProcessor._hub))),
143-
144-
// Player.Get(Hub)
145-
new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new Type[] { typeof(ReferenceHub) })),
138+
// Player.Get(sender)
139+
new(OpCodes.Ldloc_0),
140+
new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(CommandSender) })),
146141

147142
// command
148-
new(OpCodes.Ldloc_1),
143+
new(OpCodes.Ldloc_S, 4),
149144

150-
// commandtype CLIENT
151-
new(OpCodes.Ldc_I4_2),
145+
// CommandType.Client
146+
new (OpCodes.Ldc_I4_S, (sbyte)CommandType.Client),
152147

153148
// query
154149
new(OpCodes.Ldarg_1),

EXILED/Exiled.Events/Patches/Events/Player/SendingValidRACommand.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace Exiled.Events.Patches.Events.Player
1818
using Exiled.Events.EventArgs.Player;
1919

2020
using HarmonyLib;
21-
21+
using LabApi.Features.Enums;
2222
using RemoteAdmin;
2323

2424
using static HarmonyLib.AccessTools;
@@ -66,8 +66,8 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
6666
// command
6767
new (OpCodes.Ldloc_2),
6868

69-
// commandtype
70-
new (OpCodes.Ldc_I4_4),
69+
// CommandType.RemoteAdmin
70+
new (OpCodes.Ldc_I4_S, (sbyte)CommandType.RemoteAdmin),
7171

7272
// query
7373
new (OpCodes.Ldarg_0),
@@ -128,22 +128,22 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
128128
});
129129

130130
offset = 1;
131-
index = newInstructions.FindIndex(instrction => instrction.Calls(Method(typeof(CommandSender), nameof(CommandSender.RaReply)))) + offset;
131+
index = newInstructions.FindIndex(i => i.Calls(Method(typeof(CommandSender), nameof(CommandSender.RaReply)))) + offset;
132132
newInstructions.InsertRange(
133133
index,
134-
new CodeInstruction[]
134+
new[]
135135
{
136136
// sender
137-
new (OpCodes.Ldarg_1),
137+
new CodeInstruction(OpCodes.Ldarg_1).MoveLabelsFrom(newInstructions[index]),
138138

139139
// Player.get(sender)
140-
new (OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new Type[] { typeof(CommandSender) })),
140+
new (OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(CommandSender) })),
141141

142142
// command
143143
new (OpCodes.Ldloc_2),
144144

145-
// commandtype
146-
new (OpCodes.Ldc_I4_4),
145+
// CommandType.RemoteAdmin
146+
new (OpCodes.Ldc_I4_S, (sbyte)CommandType.RemoteAdmin),
147147

148148
// query
149149
new (OpCodes.Ldarg_0),

0 commit comments

Comments
 (0)