From aa64554b8ae86adbe6b0a2c902a24d1b92450f7c Mon Sep 17 00:00:00 2001 From: XLittleLeft <96688147+XLittleLeft@users.noreply.github.com> Date: Fri, 3 May 2024 19:23:36 +0800 Subject: [PATCH] Update ItemPickup.cs Directly remove items using Serial --- NwPluginAPI/Core/Items/ItemPickup.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/NwPluginAPI/Core/Items/ItemPickup.cs b/NwPluginAPI/Core/Items/ItemPickup.cs index 2da60da..b566c6e 100644 --- a/NwPluginAPI/Core/Items/ItemPickup.cs +++ b/NwPluginAPI/Core/Items/ItemPickup.cs @@ -106,6 +106,13 @@ public static bool Remove(ItemPickupBase item) return CachedItems.Remove(item.Info.Serial); } + public static bool Remove(ushort Serial) + { + if (!CachedItems.TryGetValue(Serial, out ItemPickup it)) return false; + + return CachedItems.Remove(Serial); + } + /// /// Creates a new . /// @@ -151,4 +158,4 @@ public ItemPickup(ItemPickupBase item) OriginalObject = item; } } -} \ No newline at end of file +}