From 7ffb431550f6deb8b5d0b3000a9234740f170c67 Mon Sep 17 00:00:00 2001 From: Luke Date: Sat, 11 Jan 2025 20:00:23 +1000 Subject: [PATCH] Update server init test to static hook --- TShockLauncher.Tests/ServerInitTests.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/TShockLauncher.Tests/ServerInitTests.cs b/TShockLauncher.Tests/ServerInitTests.cs index e0926c660..2ab72bd11 100644 --- a/TShockLauncher.Tests/ServerInitTests.cs +++ b/TShockLauncher.Tests/ServerInitTests.cs @@ -14,18 +14,19 @@ public class ServerInitTests public void EnsureBoots() { var are = new AutoResetEvent(false); - On.Terraria.Main.hook_DedServ cb = (On.Terraria.Main.orig_DedServ orig, Terraria.Main instance) => + HookEvents.HookDelegate cb = (instance, args) => { + args.ContinueExecution = false; are.Set(); Debug.WriteLine("Server init process successful"); }; - On.Terraria.Main.DedServ += cb; + HookEvents.Terraria.Main.DedServ += cb; - new Thread(() => TerrariaApi.Server.Program.Main(new string[] { })).Start(); + new Thread(() => TerrariaApi.Server.Program.Main([])).Start(); var hit = are.WaitOne(TimeSpan.FromSeconds(10)); - On.Terraria.Main.DedServ -= cb; + HookEvents.Terraria.Main.DedServ -= cb; Assert.That(hit, Is.True); }