diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index 74858b2f..faa761de 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -2071,16 +2071,9 @@ namespace TShockAPI /// internal void OnFishOutNPC(object sender, GetDataHandlers.FishOutNPCEventArgs args) { - Projectile projectile = null; - foreach (var recentProjectile in args.Player.RecentlyCreatedProjectiles) - { - if (Main.projectile[recentProjectile.Index] != null && Main.projectile[recentProjectile.Index].Name == "Bobber") - { - projectile = Main.projectile[recentProjectile.Index]; - break; - } - } - if (!FishingRodItemIDs.Contains(args.Player.SelectedItem.type) || projectile == null || !FishableNpcIDs.Contains(args.NpcID)) + var projectile = args.Player.RecentlyCreatedProjectiles.FirstOrDefault(p => Main.projectile[p.Index] != null && Main.projectile[p.Index].Name == "Bobber"); + + if (!FishingRodItemIDs.Contains(args.Player.SelectedItem.type) || Main.projectile[projectile.Index] == null || !FishableNpcIDs.Contains(args.NpcID)) { TShock.Log.ConsoleDebug("Bouncer / OnFishOutNPC rejected invalid NPC spawning from {0}", args.Player.Name); args.Handled = true; diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 9d2b63ef..99067e62 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -1889,7 +1889,7 @@ namespace TShockAPI public static HandlerList FishOutNPC = new HandlerList(); private static bool OnFishOutNPC(TSPlayer player, MemoryStream data, ushort tileX, ushort tileY, short npcID) { - if (FoodPlatterTryPlacing == null) + if (FishOutNPC == null) return false; var args = new FishOutNPCEventArgs