From 0b96f4b7804862a07ba5563adbb774394be31ba6 Mon Sep 17 00:00:00 2001 From: "Mr. Baguetter" Date: Thu, 2 Apr 2026 20:38:26 -0500 Subject: [PATCH 1/5] Add: Player::RemoveItem method that uses ItemType instead of a item instance --- EXILED/Exiled.API/Features/Player.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/EXILED/Exiled.API/Features/Player.cs b/EXILED/Exiled.API/Features/Player.cs index d91e703c0..3e68fb40b 100644 --- a/EXILED/Exiled.API/Features/Player.cs +++ b/EXILED/Exiled.API/Features/Player.cs @@ -2137,6 +2137,22 @@ public bool RemoveItem(Item item, bool destroy = true) return true; } + /// + /// Removes an from the player's inventory by its . + /// + /// The specified to be removed. + /// Whether to destroy the item. + /// A value indicating whether the was removed. + public bool RemoveItem(ItemType item, bool destroy = true) + { + Item itemtoremove = Items.FirstOrDefault(tempItem => tempItem.Type == item); + if (itemtoremove == null) + return false; + + RemoveItem(itemtoremove, destroy); + return true; + } + /// /// Removes an from the player's inventory. /// From f138d367ab134256f4634314d4c4c7e7c66c21f9 Mon Sep 17 00:00:00 2001 From: "Mr. Baguetter" Date: Thu, 2 Apr 2026 20:41:00 -0500 Subject: [PATCH 2/5] Updated parameter name --- EXILED/Exiled.API/Features/Player.cs | 122 +++++++++++++-------------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/EXILED/Exiled.API/Features/Player.cs b/EXILED/Exiled.API/Features/Player.cs index 3e68fb40b..261654791 100644 --- a/EXILED/Exiled.API/Features/Player.cs +++ b/EXILED/Exiled.API/Features/Player.cs @@ -83,7 +83,7 @@ public class Player : TypeCastObject, IEntity, IWorldSpace internal readonly List ItemsValue = new(8); /// - /// A dictionary of custom item category limits. + /// A dictionary of custom type category limits. /// internal Dictionary CustomCategoryLimits = new(); @@ -987,7 +987,7 @@ public float HumeShieldRegenerationMultiplier public HumeShieldStat HumeShieldStat => CustomHumeShieldStat; /// - /// Gets or sets the item in the player's hand. Value will be if the player is not holding anything. + /// Gets or sets the type in the player's hand. Value will be if the player is not holding anything. /// /// public Item CurrentItem @@ -1643,7 +1643,7 @@ public void SetFriendlyFire(RoleTypeId roleToAdd, float ffMult) /// /// Role to add. /// Friendly fire multiplier. - /// Whether the item was able to be added. + /// Whether the type was able to be added. public bool TryAddFriendlyFire(RoleTypeId roleToAdd, float ffMult) { if (FriendlyFireMultiplier.ContainsKey(roleToAdd)) @@ -1657,7 +1657,7 @@ public bool TryAddFriendlyFire(RoleTypeId roleToAdd, float ffMult) /// Tries to add to FriendlyFire rules. /// /// Role FF multiplier to add. - /// Whether the item was able to be added. + /// Whether the type was able to be added. public bool TryAddFriendlyFire(KeyValuePair pairedRoleFF) => TryAddFriendlyFire(pairedRoleFF.Key, pairedRoleFF.Value); /// @@ -1665,7 +1665,7 @@ public bool TryAddFriendlyFire(RoleTypeId roleToAdd, float ffMult) /// /// Roles to add with friendly fire values. /// Whether to overwrite current values if they exist. - /// Whether the item was able to be added. + /// Whether the type was able to be added. public bool TryAddFriendlyFire(Dictionary ffRules, bool overwrite = false) { Dictionary temporaryFriendlyFireRules = DictionaryPool.Pool.Get(); @@ -1729,7 +1729,7 @@ public void SetCustomRoleFriendlyFire(string roleTypeId, RoleTypeId roleToAdd, f /// /// Role associated for CustomFF. /// Role to add and FF multiplier. - /// Whether the item was able to be added. + /// Whether the type was able to be added. public bool TryAddCustomRoleFriendlyFire(string roleTypeId, KeyValuePair roleFf) => TryAddCustomRoleFriendlyFire(roleTypeId, roleFf.Key, roleFf.Value); /// @@ -1738,7 +1738,7 @@ public void SetCustomRoleFriendlyFire(string roleTypeId, RoleTypeId roleToAdd, f /// Role associated for CustomFF. /// Role to add. /// Friendly fire multiplier. - /// Whether the item was able to be added. + /// Whether the type was able to be added. public bool TryAddCustomRoleFriendlyFire(string roleTypeId, RoleTypeId roleToAdd, float ffMult) { if (CustomRoleFriendlyFireMultiplier.TryGetValue(roleTypeId, out Dictionary currentPairedData)) @@ -1762,7 +1762,7 @@ public bool TryAddCustomRoleFriendlyFire(string roleTypeId, RoleTypeId roleToAdd /// Role associated for CustomFF. /// Roles to add with friendly fire values. /// Whether to overwrite current values if they exist - does NOT delete previous entries if they are not in provided rules. - /// Whether the item was able to be added. + /// Whether the type was able to be added. public bool TryAddCustomRoleFriendlyFire(string customRoleName, Dictionary ffRules, bool overwrite = false) { Dictionary temporaryFriendlyFireRules = DictionaryPool.Pool.Get(); @@ -1829,14 +1829,14 @@ public void TrySetCustomRoleFriendlyFire(string roleTypeId, Dictionary from FriendlyFire rules. /// /// Role to add. - /// Whether the item was able to be added. + /// Whether the type was able to be added. public bool TryRemoveFriendlyFire(RoleTypeId role) => FriendlyFireMultiplier.Remove(role); /// /// Tries to remove from FriendlyFire rules. /// /// Role to add. - /// Whether the item was able to be added. + /// Whether the type was able to be added. public bool TryRemoveCustomeRoleFriendlyFire(string role) => CustomRoleFriendlyFireMultiplier.Remove(role); /// @@ -1906,11 +1906,11 @@ public bool TryUnloadWeapon() } /// - /// Tries to get an item from a player's inventory. + /// Tries to get an type from a player's inventory. /// - /// The unique identifier of the item. + /// The unique identifier of the type. /// The found. if it doesn't exist. - /// if the item is found, otherwise. + /// if the type is found, otherwise. public bool TryGetItem(ushort serial, out Item item) { item = Inventory.UserInventory.Items.TryGetValue(serial, out ItemBase itemBase) ? Item.Get(itemBase) : null; @@ -2012,10 +2012,10 @@ public float CassieAnnouncement(global::Cassie.CassieAnnouncement cassieAnnounce } /// - /// Drops an item from the player's inventory. + /// Drops an type from the player's inventory. /// /// The to be dropped. - /// Is the item Thrown?. + /// Is the type Thrown?. public void DropItem(Item item, bool isThrown = false) { if (item is null) @@ -2024,23 +2024,23 @@ public void DropItem(Item item, bool isThrown = false) } /// - /// Drops an item from the player's inventory. + /// Drops an type from the player's inventory. /// /// The to be dropped. /// dropped . public Pickup DropItem(Item item) => item is not null ? Pickup.Get(Inventory.ServerDropItem(item.Serial)) : null; /// - /// Drops the held item. Will not do anything if the player is not holding an item. + /// Drops the held type. Will not do anything if the player is not holding an type. /// - /// Is the item Thrown?. + /// Is the type Thrown?. public void DropHeldItem(bool isThrown = false) => DropItem(CurrentItem, isThrown); /// - /// Drops the held item. Will not do anything if the player is not holding an item. + /// Drops the held type. Will not do anything if the player is not holding an type. /// /// - /// Dropped item's . + /// Dropped type's . public Pickup DropHeldItem() { Item item = CurrentItem; @@ -2052,14 +2052,14 @@ public Pickup DropHeldItem() } /// - /// Indicates whether the player has an item. + /// Indicates whether the player has an type. /// - /// The item to search for. + /// The type to search for. /// , if the player has it; otherwise, . public bool HasItem(Item item) => Items.Contains(item); /// - /// Indicates whether the player has an item type. + /// Indicates whether the player has an type type. /// /// The type to search for. /// , if the player has it; otherwise, . @@ -2068,7 +2068,7 @@ public Pickup DropHeldItem() /// /// Counts how many items of a certain a player has. /// - /// The item to search for. + /// The type to search for. /// How many items of that the player has. /// For counting ammo, see . /// @@ -2099,7 +2099,7 @@ public Pickup DropHeldItem() /// Removes an from the player's inventory. /// /// The to remove. - /// Whether to destroy the item. + /// Whether to destroy the type. /// A value indicating whether the was removed. public bool RemoveItem(Item item, bool destroy = true) { @@ -2140,12 +2140,12 @@ public bool RemoveItem(Item item, bool destroy = true) /// /// Removes an from the player's inventory by its . /// - /// The specified to be removed. - /// Whether to destroy the item. + /// The specified to be removed. + /// Whether to destroy the type. /// A value indicating whether the was removed. - public bool RemoveItem(ItemType item, bool destroy = true) + public bool RemoveItem(ItemType type, bool destroy = true) { - Item itemtoremove = Items.FirstOrDefault(tempItem => tempItem.Type == item); + Item itemtoremove = Items.FirstOrDefault(item => item.Type == type); if (itemtoremove == null) return false; @@ -2157,7 +2157,7 @@ public bool RemoveItem(ItemType item, bool destroy = true) /// Removes an from the player's inventory. /// /// The serial to remove. - /// Whether to destroy the item. + /// Whether to destroy the type. /// A value indicating whether the was removed. public bool RemoveItem(ushort serial, bool destroy = true) { @@ -2190,7 +2190,7 @@ public int RemoveItem(Func predicate, bool destroy = true) /// /// Removes the held from the player's inventory. /// - /// Whether to destroy the item. + /// Whether to destroy the type. /// Returns a value indicating whether the was removed. public bool RemoveHeldItem(bool destroy = true) => RemoveItem(CurrentItem, destroy); @@ -2340,23 +2340,23 @@ public void Heal(float amount, bool overrideMaxHealth = false) } /// - /// Forces the player to use an item. + /// Forces the player to use an type. /// /// The ItemType to be used. - /// if item was used successfully. Otherwise, . + /// if type was used successfully. Otherwise, . public bool UseItem(ItemType usableItem) => UseItem(Item.Create(usableItem)); /// - /// Forces the player to use an item. + /// Forces the player to use an type. /// - /// The item to be used. + /// The type to be used. public void UseItem(Usable usable) => usable?.Use(this); /// - /// Forces the player to use an item. + /// Forces the player to use an type. /// - /// The item to be used. - /// if item was used successfully. Otherwise, . + /// The type to be used. + /// if type was used successfully. Otherwise, . public bool UseItem(Item item) { if (item is not Usable usableItem) @@ -2772,9 +2772,9 @@ public void GrantLoadout(RoleTypeId roleType) } /// - /// Adds an item of the specified type with default durability(ammo/charge) and no mods to the player's inventory. + /// Adds an type of the specified type with default durability(ammo/charge) and no mods to the player's inventory. /// - /// The item to be added. + /// The type to be added. /// The given to the player. public Item AddItem(ItemType itemType) { @@ -2794,7 +2794,7 @@ public Item AddItem(ItemType itemType) /// Adds a firearm of the specified type with default durability(ammo/charge) and no mods to the player's inventory. /// /// The firearm to be added. - /// The attachments to be added to the item. + /// The attachments to be added to the type. /// The given to the player. public Item AddItem(FirearmType firearmType, IEnumerable identifiers) { @@ -2816,7 +2816,7 @@ public Item AddItem(FirearmType firearmType, IEnumerable i /// /// Adds the amount of items of the specified type with default durability(ammo/charge) and no mods to the player's inventory. /// - /// The item to be added. + /// The type to be added. /// The amount of items to be added. /// An containing the items given. public IEnumerable AddItem(ItemType itemType, int amount) @@ -2834,9 +2834,9 @@ public IEnumerable AddItem(ItemType itemType, int amount) /// /// Adds the amount of firearms of the specified type with default durability(ammo/charge) and no mods to the player's inventory. /// - /// The item to be added. + /// The type to be added. /// The amount of items to be added. - /// The attachments to be added to the item. + /// The attachments to be added to the type. /// An containing the items given. public IEnumerable AddItem(FirearmType firearmType, int amount, IEnumerable identifiers) { @@ -2886,9 +2886,9 @@ public IEnumerable AddItem(Dictionary - /// Adds an item to the player's inventory. + /// Adds an type to the player's inventory. /// - /// The item to be added. + /// The type to be added. public void AddItem(Item item) { try @@ -2902,10 +2902,10 @@ public void AddItem(Item item) } /// - /// Adds an item to the player's inventory. + /// Adds an type to the player's inventory. /// - /// The item to be added. - /// The attachments to be added to the item. + /// The type to be added. + /// The attachments to be added to the type. public void AddItem(Firearm item, IEnumerable identifiers) { try @@ -2922,18 +2922,18 @@ public void AddItem(Firearm item, IEnumerable identifiers) } /// - /// Adds an item to the player's inventory. + /// Adds an type to the player's inventory. /// - /// The of the item to be added. - /// The reason the item was added. + /// The of the type to be added. + /// The reason the type was added. /// The that was added. public Item AddItem(Pickup pickup, ItemAddReason addReason = ItemAddReason.AdminCommand) => Item.Get(Inventory.ServerAddItem(pickup.Type, addReason, pickup.Serial, pickup.Base)); /// - /// Adds an item to the player's inventory. + /// Adds an type to the player's inventory. /// - /// The of the item to be added. - /// The attachments to be added to of the item. + /// The of the type to be added. + /// The attachments to be added to of the type. /// The that was added. public Item AddItem(FirearmPickup pickup, IEnumerable identifiers) { @@ -2946,11 +2946,11 @@ public Item AddItem(FirearmPickup pickup, IEnumerable iden } /// - /// Adds an item to the player's inventory. + /// Adds an type to the player's inventory. /// - /// The item to be added. - /// The object of the item. - /// The reason the item was added. + /// The type to be added. + /// The object of the type. + /// The reason the type was added. /// The that was added. public Item AddItem(ItemBase itemBase, Item item = null, ItemAddReason addReason = ItemAddReason.AdminCommand) { @@ -3128,7 +3128,7 @@ public void ClearAmmo() /// /// The to be thrown. /// Whether to throw with full or half force. - /// The item that was spawned. + /// The type that was spawned. public Throwable ThrowGrenade(ProjectileType type, bool fullForce = true) { Throwable throwable = Item.Create(type.GetItemType(), this); @@ -3139,7 +3139,7 @@ public Throwable ThrowGrenade(ProjectileType type, bool fullForce = true) } /// - /// Forcefully throws a item. + /// Forcefully throws a type. /// /// The to be thrown. /// Whether to throw with full or half force. From eb175ff16f59e654437eff65735ec78472e83448 Mon Sep 17 00:00:00 2001 From: "Mr. Baguetter" Date: Thu, 2 Apr 2026 20:41:00 -0500 Subject: [PATCH 3/5] Updated parameter name --- EXILED/Exiled.API/Features/Player.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXILED/Exiled.API/Features/Player.cs b/EXILED/Exiled.API/Features/Player.cs index 3e68fb40b..812a00e85 100644 --- a/EXILED/Exiled.API/Features/Player.cs +++ b/EXILED/Exiled.API/Features/Player.cs @@ -4070,4 +4070,4 @@ public override int GetHashCode() /// A string containing Player-related data. public override string ToString() => $"{Id} ({Nickname}) [{UserId}] *{(Role is null ? "No role" : Role)}*"; } -} +} \ No newline at end of file From 8fba1b7c993e159dd15269bbde622d56afcbc069 Mon Sep 17 00:00:00 2001 From: "Mr. Baguetter" Date: Thu, 2 Apr 2026 20:46:45 -0500 Subject: [PATCH 4/5] Revert param change --- EXILED/Exiled.API/Features/Player.cs | 122 +++++++++++++-------------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/EXILED/Exiled.API/Features/Player.cs b/EXILED/Exiled.API/Features/Player.cs index 3e463581b..812a00e85 100644 --- a/EXILED/Exiled.API/Features/Player.cs +++ b/EXILED/Exiled.API/Features/Player.cs @@ -83,7 +83,7 @@ public class Player : TypeCastObject, IEntity, IWorldSpace internal readonly List ItemsValue = new(8); /// - /// A dictionary of custom type category limits. + /// A dictionary of custom item category limits. /// internal Dictionary CustomCategoryLimits = new(); @@ -987,7 +987,7 @@ public float HumeShieldRegenerationMultiplier public HumeShieldStat HumeShieldStat => CustomHumeShieldStat; /// - /// Gets or sets the type in the player's hand. Value will be if the player is not holding anything. + /// Gets or sets the item in the player's hand. Value will be if the player is not holding anything. /// /// public Item CurrentItem @@ -1643,7 +1643,7 @@ public void SetFriendlyFire(RoleTypeId roleToAdd, float ffMult) /// /// Role to add. /// Friendly fire multiplier. - /// Whether the type was able to be added. + /// Whether the item was able to be added. public bool TryAddFriendlyFire(RoleTypeId roleToAdd, float ffMult) { if (FriendlyFireMultiplier.ContainsKey(roleToAdd)) @@ -1657,7 +1657,7 @@ public bool TryAddFriendlyFire(RoleTypeId roleToAdd, float ffMult) /// Tries to add to FriendlyFire rules. /// /// Role FF multiplier to add. - /// Whether the type was able to be added. + /// Whether the item was able to be added. public bool TryAddFriendlyFire(KeyValuePair pairedRoleFF) => TryAddFriendlyFire(pairedRoleFF.Key, pairedRoleFF.Value); /// @@ -1665,7 +1665,7 @@ public bool TryAddFriendlyFire(RoleTypeId roleToAdd, float ffMult) /// /// Roles to add with friendly fire values. /// Whether to overwrite current values if they exist. - /// Whether the type was able to be added. + /// Whether the item was able to be added. public bool TryAddFriendlyFire(Dictionary ffRules, bool overwrite = false) { Dictionary temporaryFriendlyFireRules = DictionaryPool.Pool.Get(); @@ -1729,7 +1729,7 @@ public void SetCustomRoleFriendlyFire(string roleTypeId, RoleTypeId roleToAdd, f /// /// Role associated for CustomFF. /// Role to add and FF multiplier. - /// Whether the type was able to be added. + /// Whether the item was able to be added. public bool TryAddCustomRoleFriendlyFire(string roleTypeId, KeyValuePair roleFf) => TryAddCustomRoleFriendlyFire(roleTypeId, roleFf.Key, roleFf.Value); /// @@ -1738,7 +1738,7 @@ public void SetCustomRoleFriendlyFire(string roleTypeId, RoleTypeId roleToAdd, f /// Role associated for CustomFF. /// Role to add. /// Friendly fire multiplier. - /// Whether the type was able to be added. + /// Whether the item was able to be added. public bool TryAddCustomRoleFriendlyFire(string roleTypeId, RoleTypeId roleToAdd, float ffMult) { if (CustomRoleFriendlyFireMultiplier.TryGetValue(roleTypeId, out Dictionary currentPairedData)) @@ -1762,7 +1762,7 @@ public bool TryAddCustomRoleFriendlyFire(string roleTypeId, RoleTypeId roleToAdd /// Role associated for CustomFF. /// Roles to add with friendly fire values. /// Whether to overwrite current values if they exist - does NOT delete previous entries if they are not in provided rules. - /// Whether the type was able to be added. + /// Whether the item was able to be added. public bool TryAddCustomRoleFriendlyFire(string customRoleName, Dictionary ffRules, bool overwrite = false) { Dictionary temporaryFriendlyFireRules = DictionaryPool.Pool.Get(); @@ -1829,14 +1829,14 @@ public void TrySetCustomRoleFriendlyFire(string roleTypeId, Dictionary from FriendlyFire rules. /// /// Role to add. - /// Whether the type was able to be added. + /// Whether the item was able to be added. public bool TryRemoveFriendlyFire(RoleTypeId role) => FriendlyFireMultiplier.Remove(role); /// /// Tries to remove from FriendlyFire rules. /// /// Role to add. - /// Whether the type was able to be added. + /// Whether the item was able to be added. public bool TryRemoveCustomeRoleFriendlyFire(string role) => CustomRoleFriendlyFireMultiplier.Remove(role); /// @@ -1906,11 +1906,11 @@ public bool TryUnloadWeapon() } /// - /// Tries to get an type from a player's inventory. + /// Tries to get an item from a player's inventory. /// - /// The unique identifier of the type. + /// The unique identifier of the item. /// The found. if it doesn't exist. - /// if the type is found, otherwise. + /// if the item is found, otherwise. public bool TryGetItem(ushort serial, out Item item) { item = Inventory.UserInventory.Items.TryGetValue(serial, out ItemBase itemBase) ? Item.Get(itemBase) : null; @@ -2012,10 +2012,10 @@ public float CassieAnnouncement(global::Cassie.CassieAnnouncement cassieAnnounce } /// - /// Drops an type from the player's inventory. + /// Drops an item from the player's inventory. /// /// The to be dropped. - /// Is the type Thrown?. + /// Is the item Thrown?. public void DropItem(Item item, bool isThrown = false) { if (item is null) @@ -2024,23 +2024,23 @@ public void DropItem(Item item, bool isThrown = false) } /// - /// Drops an type from the player's inventory. + /// Drops an item from the player's inventory. /// /// The to be dropped. /// dropped . public Pickup DropItem(Item item) => item is not null ? Pickup.Get(Inventory.ServerDropItem(item.Serial)) : null; /// - /// Drops the held type. Will not do anything if the player is not holding an type. + /// Drops the held item. Will not do anything if the player is not holding an item. /// - /// Is the type Thrown?. + /// Is the item Thrown?. public void DropHeldItem(bool isThrown = false) => DropItem(CurrentItem, isThrown); /// - /// Drops the held type. Will not do anything if the player is not holding an type. + /// Drops the held item. Will not do anything if the player is not holding an item. /// /// - /// Dropped type's . + /// Dropped item's . public Pickup DropHeldItem() { Item item = CurrentItem; @@ -2052,14 +2052,14 @@ public Pickup DropHeldItem() } /// - /// Indicates whether the player has an type. + /// Indicates whether the player has an item. /// - /// The type to search for. + /// The item to search for. /// , if the player has it; otherwise, . public bool HasItem(Item item) => Items.Contains(item); /// - /// Indicates whether the player has an type type. + /// Indicates whether the player has an item type. /// /// The type to search for. /// , if the player has it; otherwise, . @@ -2068,7 +2068,7 @@ public Pickup DropHeldItem() /// /// Counts how many items of a certain a player has. /// - /// The type to search for. + /// The item to search for. /// How many items of that the player has. /// For counting ammo, see . /// @@ -2099,7 +2099,7 @@ public Pickup DropHeldItem() /// Removes an from the player's inventory. /// /// The to remove. - /// Whether to destroy the type. + /// Whether to destroy the item. /// A value indicating whether the was removed. public bool RemoveItem(Item item, bool destroy = true) { @@ -2140,12 +2140,12 @@ public bool RemoveItem(Item item, bool destroy = true) /// /// Removes an from the player's inventory by its . /// - /// The specified to be removed. - /// Whether to destroy the type. + /// The specified to be removed. + /// Whether to destroy the item. /// A value indicating whether the was removed. - public bool RemoveItem(ItemType type, bool destroy = true) + public bool RemoveItem(ItemType item, bool destroy = true) { - Item itemtoremove = Items.FirstOrDefault(item => item.Type == type); + Item itemtoremove = Items.FirstOrDefault(tempItem => tempItem.Type == item); if (itemtoremove == null) return false; @@ -2157,7 +2157,7 @@ public bool RemoveItem(ItemType type, bool destroy = true) /// Removes an from the player's inventory. /// /// The serial to remove. - /// Whether to destroy the type. + /// Whether to destroy the item. /// A value indicating whether the was removed. public bool RemoveItem(ushort serial, bool destroy = true) { @@ -2190,7 +2190,7 @@ public int RemoveItem(Func predicate, bool destroy = true) /// /// Removes the held from the player's inventory. /// - /// Whether to destroy the type. + /// Whether to destroy the item. /// Returns a value indicating whether the was removed. public bool RemoveHeldItem(bool destroy = true) => RemoveItem(CurrentItem, destroy); @@ -2340,23 +2340,23 @@ public void Heal(float amount, bool overrideMaxHealth = false) } /// - /// Forces the player to use an type. + /// Forces the player to use an item. /// /// The ItemType to be used. - /// if type was used successfully. Otherwise, . + /// if item was used successfully. Otherwise, . public bool UseItem(ItemType usableItem) => UseItem(Item.Create(usableItem)); /// - /// Forces the player to use an type. + /// Forces the player to use an item. /// - /// The type to be used. + /// The item to be used. public void UseItem(Usable usable) => usable?.Use(this); /// - /// Forces the player to use an type. + /// Forces the player to use an item. /// - /// The type to be used. - /// if type was used successfully. Otherwise, . + /// The item to be used. + /// if item was used successfully. Otherwise, . public bool UseItem(Item item) { if (item is not Usable usableItem) @@ -2772,9 +2772,9 @@ public void GrantLoadout(RoleTypeId roleType) } /// - /// Adds an type of the specified type with default durability(ammo/charge) and no mods to the player's inventory. + /// Adds an item of the specified type with default durability(ammo/charge) and no mods to the player's inventory. /// - /// The type to be added. + /// The item to be added. /// The given to the player. public Item AddItem(ItemType itemType) { @@ -2794,7 +2794,7 @@ public Item AddItem(ItemType itemType) /// Adds a firearm of the specified type with default durability(ammo/charge) and no mods to the player's inventory. /// /// The firearm to be added. - /// The attachments to be added to the type. + /// The attachments to be added to the item. /// The given to the player. public Item AddItem(FirearmType firearmType, IEnumerable identifiers) { @@ -2816,7 +2816,7 @@ public Item AddItem(FirearmType firearmType, IEnumerable i /// /// Adds the amount of items of the specified type with default durability(ammo/charge) and no mods to the player's inventory. /// - /// The type to be added. + /// The item to be added. /// The amount of items to be added. /// An containing the items given. public IEnumerable AddItem(ItemType itemType, int amount) @@ -2834,9 +2834,9 @@ public IEnumerable AddItem(ItemType itemType, int amount) /// /// Adds the amount of firearms of the specified type with default durability(ammo/charge) and no mods to the player's inventory. /// - /// The type to be added. + /// The item to be added. /// The amount of items to be added. - /// The attachments to be added to the type. + /// The attachments to be added to the item. /// An containing the items given. public IEnumerable AddItem(FirearmType firearmType, int amount, IEnumerable identifiers) { @@ -2886,9 +2886,9 @@ public IEnumerable AddItem(Dictionary - /// Adds an type to the player's inventory. + /// Adds an item to the player's inventory. /// - /// The type to be added. + /// The item to be added. public void AddItem(Item item) { try @@ -2902,10 +2902,10 @@ public void AddItem(Item item) } /// - /// Adds an type to the player's inventory. + /// Adds an item to the player's inventory. /// - /// The type to be added. - /// The attachments to be added to the type. + /// The item to be added. + /// The attachments to be added to the item. public void AddItem(Firearm item, IEnumerable identifiers) { try @@ -2922,18 +2922,18 @@ public void AddItem(Firearm item, IEnumerable identifiers) } /// - /// Adds an type to the player's inventory. + /// Adds an item to the player's inventory. /// - /// The of the type to be added. - /// The reason the type was added. + /// The of the item to be added. + /// The reason the item was added. /// The that was added. public Item AddItem(Pickup pickup, ItemAddReason addReason = ItemAddReason.AdminCommand) => Item.Get(Inventory.ServerAddItem(pickup.Type, addReason, pickup.Serial, pickup.Base)); /// - /// Adds an type to the player's inventory. + /// Adds an item to the player's inventory. /// - /// The of the type to be added. - /// The attachments to be added to of the type. + /// The of the item to be added. + /// The attachments to be added to of the item. /// The that was added. public Item AddItem(FirearmPickup pickup, IEnumerable identifiers) { @@ -2946,11 +2946,11 @@ public Item AddItem(FirearmPickup pickup, IEnumerable iden } /// - /// Adds an type to the player's inventory. + /// Adds an item to the player's inventory. /// - /// The type to be added. - /// The object of the type. - /// The reason the type was added. + /// The item to be added. + /// The object of the item. + /// The reason the item was added. /// The that was added. public Item AddItem(ItemBase itemBase, Item item = null, ItemAddReason addReason = ItemAddReason.AdminCommand) { @@ -3128,7 +3128,7 @@ public void ClearAmmo() /// /// The to be thrown. /// Whether to throw with full or half force. - /// The type that was spawned. + /// The item that was spawned. public Throwable ThrowGrenade(ProjectileType type, bool fullForce = true) { Throwable throwable = Item.Create(type.GetItemType(), this); @@ -3139,7 +3139,7 @@ public Throwable ThrowGrenade(ProjectileType type, bool fullForce = true) } /// - /// Forcefully throws a type. + /// Forcefully throws a item. /// /// The to be thrown. /// Whether to throw with full or half force. From 7aefc6660e4ac1fd592c849641363a76fd643a59 Mon Sep 17 00:00:00 2001 From: "Mr. Baguetter" Date: Mon, 6 Apr 2026 14:38:24 -0500 Subject: [PATCH 5/5] Added Player::DropItem(ItemType) methods --- EXILED/Exiled.API/Features/Player.cs | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/EXILED/Exiled.API/Features/Player.cs b/EXILED/Exiled.API/Features/Player.cs index 812a00e85..0ad032cb9 100644 --- a/EXILED/Exiled.API/Features/Player.cs +++ b/EXILED/Exiled.API/Features/Player.cs @@ -2030,6 +2030,36 @@ public void DropItem(Item item, bool isThrown = false) /// dropped . public Pickup DropItem(Item item) => item is not null ? Pickup.Get(Inventory.ServerDropItem(item.Serial)) : null; + /// + /// Drops an from the player's inventory by its . + /// + /// The specified to be dropped. + /// Is the item Thrown?. + /// A value indicating whether the was dropped. + public bool DropItem(ItemType item, bool isThrown = false) + { + Item itemtodrop = Items.FirstOrDefault(tempItem => tempItem.Type == item); + if (itemtodrop == null) + return false; + + DropItem(itemtodrop, isThrown); + return true; + } + + /// + /// Drops an item from the player's inventory. + /// + /// The specified to be dropped. + /// dropped . + public Pickup DropItem(ItemType item) + { + Item itemtodrop = Items.FirstOrDefault(tempItem => tempItem.Type == item); + if (itemtodrop == null) + return null; + + return Pickup.Get(Inventory.ServerDropItem(itemtodrop.Serial)); + } + /// /// Drops the held item. Will not do anything if the player is not holding an item. ///