diff --git a/TerrariaServerAPI/TerrariaApi.Server/Hooking/GameHooks.cs b/TerrariaServerAPI/TerrariaApi.Server/Hooking/GameHooks.cs index 66e2624b..62d65af9 100644 --- a/TerrariaServerAPI/TerrariaApi.Server/Hooking/GameHooks.cs +++ b/TerrariaServerAPI/TerrariaApi.Server/Hooking/GameHooks.cs @@ -35,6 +35,10 @@ private static void OnUpdate(Terraria.Main instance, HookEvents.Terraria.Main.Up private static void OnHardmodeTileUpdate(object sender, Hooks.WorldGen.HardmodeTileUpdateEventArgs e) { + if (e.Result == HookResult.Cancel) + { + return; + } if (_hookManager.InvokeGameHardmodeTileUpdate(e.X, e.Y, e.Type)) { e.Result = HookResult.Cancel; @@ -43,6 +47,10 @@ private static void OnHardmodeTileUpdate(object sender, Hooks.WorldGen.HardmodeT private static void OnHardmodeTilePlace(object sender, Hooks.WorldGen.HardmodeTilePlaceEventArgs e) { + if (e.Result == HardmodeTileUpdateResult.Cancel) + { + return; + } if (_hookManager.InvokeGameHardmodeTileUpdate(e.X, e.Y, e.Type)) { e.Result = HardmodeTileUpdateResult.Cancel; @@ -64,6 +72,10 @@ private static void OnStartServer(object? sender, HookEvents.Terraria.Netplay.St private static void OnItemMechSpawn(object sender, Hooks.Item.MechSpawnEventArgs e) { + if (e.Result == HookResult.Cancel) + { + return; + } if (!_hookManager.InvokeGameStatueSpawn(e.Num2, e.Num3, e.Num, (int)(e.X / 16f), (int)(e.Y / 16f), e.Type, false)) { e.Result = HookResult.Cancel; @@ -72,6 +84,10 @@ private static void OnItemMechSpawn(object sender, Hooks.Item.MechSpawnEventArgs private static void OnNpcMechSpawn(object sender, Hooks.NPC.MechSpawnEventArgs e) { + if (e.Result == HookResult.Cancel) + { + return; + } if (!_hookManager.InvokeGameStatueSpawn(e.Num2, e.Num3, e.Num, (int)(e.X / 16f), (int)(e.Y / 16f), e.Type, true)) { e.Result = HookResult.Cancel; diff --git a/TerrariaServerAPI/TerrariaApi.Server/Hooking/ItemHooks.cs b/TerrariaServerAPI/TerrariaApi.Server/Hooking/ItemHooks.cs index 6f64ac5d..5fa87537 100644 --- a/TerrariaServerAPI/TerrariaApi.Server/Hooking/ItemHooks.cs +++ b/TerrariaServerAPI/TerrariaApi.Server/Hooking/ItemHooks.cs @@ -37,6 +37,10 @@ private static void OnSetDefaults(Item item, HookEvents.Terraria.Item.SetDefault private static void OnQuickStack(object sender, Hooks.Chest.QuickStackEventArgs e) { + if (e.Result == HookResult.Cancel) + { + return; + } if (_hookManager.InvokeItemForceIntoChest(Main.chest[e.ChestIndex], e.Item, Main.player[e.PlayerId])) { e.Result = HookResult.Cancel; diff --git a/TerrariaServerAPI/TerrariaApi.Server/Hooking/NetHooks.cs b/TerrariaServerAPI/TerrariaApi.Server/Hooking/NetHooks.cs index 7ea8bce1..57d8123d 100644 --- a/TerrariaServerAPI/TerrariaApi.Server/Hooking/NetHooks.cs +++ b/TerrariaServerAPI/TerrariaApi.Server/Hooking/NetHooks.cs @@ -47,6 +47,10 @@ static void OnBroadcastChatMessage(object? sender, HookEvents.Terraria.Chat.Chat static void OnSendData(object sender, Hooks.NetMessage.SendDataEventArgs e) { + if (e.Result == HookResult.Cancel) + { + return; + } if (e.Event == HookEvent.Before) { var msgType = e.MsgType; @@ -108,6 +112,10 @@ ref args.packet static void OnReceiveData(object sender, Hooks.MessageBuffer.GetDataEventArgs e) { + if (e.Result == HookResult.Cancel) + { + return; + } if (!Enum.IsDefined(typeof(PacketTypes), (int)e.PacketId)) { e.Result = HookResult.Cancel; @@ -138,6 +146,10 @@ static void OnGreetPlayer(object? sender, HookEvents.Terraria.NetMessage.greetPl static void OnSendBytes(object sender, Hooks.NetMessage.SendBytesEventArgs e) { + if (e.Result == HookResult.Cancel) + { + return; + } if (_hookManager.InvokeNetSendBytes(Netplay.Clients[e.RemoteClient], e.Data, e.Offset, e.Size)) { e.Result = HookResult.Cancel; @@ -146,6 +158,10 @@ static void OnSendBytes(object sender, Hooks.NetMessage.SendBytesEventArgs e) static void OnNameCollision(object sender, Hooks.MessageBuffer.NameCollisionEventArgs e) { + if (e.Result == HookResult.Cancel) + { + return; + } if (_hookManager.InvokeNetNameCollision(e.Player.whoAmI, e.Player.name)) { e.Result = HookResult.Cancel; diff --git a/TerrariaServerAPI/TerrariaApi.Server/Hooking/NpcHooks.cs b/TerrariaServerAPI/TerrariaApi.Server/Hooking/NpcHooks.cs index 3c91961b..1e248a0d 100644 --- a/TerrariaServerAPI/TerrariaApi.Server/Hooking/NpcHooks.cs +++ b/TerrariaServerAPI/TerrariaApi.Server/Hooking/NpcHooks.cs @@ -69,6 +69,10 @@ static void OnTransform(NPC npc, HookEvents.Terraria.NPC.TransformEventArgs args static void OnSpawn(object sender, Hooks.NPC.SpawnEventArgs e) { + if (e.Result == HookResult.Cancel) + { + return; + } var index = e.Index; if (_hookManager.InvokeNpcSpawn(ref index)) { @@ -79,6 +83,10 @@ static void OnSpawn(object sender, Hooks.NPC.SpawnEventArgs e) static void OnDropLoot(object sender, Hooks.NPC.DropLootEventArgs e) { + if (e.Result == HookResult.Cancel) + { + return; + } if (e.Event == HookEvent.Before) { var Width = e.Width; @@ -126,6 +134,10 @@ ref reverseLookup static void OnBossBagItem(object sender, Hooks.NPC.BossBagEventArgs e) { + if (e.Result == HookResult.Cancel) + { + return; + } var Width = e.Width; var Height = e.Height; var Type = e.Type; diff --git a/TerrariaServerAPI/TerrariaApi.Server/Hooking/ServerHooks.cs b/TerrariaServerAPI/TerrariaApi.Server/Hooking/ServerHooks.cs index bba22df6..2392f0d5 100644 --- a/TerrariaServerAPI/TerrariaApi.Server/Hooking/ServerHooks.cs +++ b/TerrariaServerAPI/TerrariaApi.Server/Hooking/ServerHooks.cs @@ -38,6 +38,10 @@ static void Main_startDedInput(object? sender, HookEvents.Terraria.Main.startDed static void OnProcess(object sender, Hooks.Main.CommandProcessEventArgs e) { + if (e.Result == HookResult.Cancel) + { + return; + } if (_hookManager.InvokeServerCommand(e.Command)) { e.Result = HookResult.Cancel; diff --git a/TerrariaServerAPI/TerrariaApi.Server/Hooking/WiringHooks.cs b/TerrariaServerAPI/TerrariaApi.Server/Hooking/WiringHooks.cs index 433161d4..e2026a41 100644 --- a/TerrariaServerAPI/TerrariaApi.Server/Hooking/WiringHooks.cs +++ b/TerrariaServerAPI/TerrariaApi.Server/Hooking/WiringHooks.cs @@ -20,6 +20,10 @@ public static void AttachTo(HookManager hookManager) static void OnAnnouncementBox(object sender, Hooks.Wiring.AnnouncementBoxEventArgs e) { + if (e.Result == HookResult.Cancel) + { + return; + } if (_hookManager.InvokeWireTriggerAnnouncementBox(Wiring.CurrentUser, e.X, e.Y, e.SignId, Main.sign[e.SignId].text)) { e.Result = HookResult.Cancel; diff --git a/TerrariaServerAPI/TerrariaApi.Server/Hooking/WorldHooks.cs b/TerrariaServerAPI/TerrariaApi.Server/Hooking/WorldHooks.cs index 7de686a5..46e894d4 100644 --- a/TerrariaServerAPI/TerrariaApi.Server/Hooking/WorldHooks.cs +++ b/TerrariaServerAPI/TerrariaApi.Server/Hooking/WorldHooks.cs @@ -27,6 +27,10 @@ public static void AttachTo(HookManager hookManager) static void OnPressurePlate(object sender, Hooks.Collision.PressurePlateEventArgs e) { + if (e.Result == HookResult.Cancel) + { + return; + } if (e.Entity is NPC npc) { if (_hookManager.InvokeNpcTriggerPressurePlate(npc, e.X, e.Y)) @@ -60,6 +64,10 @@ private static void WorldGen_StartHardmode(object? sender, HookEvents.Terraria.W static void OnDropMeteor(object sender, Hooks.WorldGen.MeteorEventArgs e) { + if (e.Result == HookResult.Cancel) + { + return; + } if (_hookManager.InvokeWorldMeteorDrop(e.X, e.Y)) { e.Result = HookResult.Cancel;