diff --git a/EXILED/Exiled.API/Features/Items/Item.cs b/EXILED/Exiled.API/Features/Items/Item.cs index 7e46a408f..710a031a1 100644 --- a/EXILED/Exiled.API/Features/Items/Item.cs +++ b/EXILED/Exiled.API/Features/Items/Item.cs @@ -357,7 +357,7 @@ public static T Get(ushort serial) /// The who owns the item by default. /// The specified type. /// The created. This can be cast as a subclass. - public static Item Create(ItemType type, Player owner = null) + public static Item Create(ItemType type, Player owner = null) // TODO modify return type to "T" where T : Item => Create(type, owner) as T; /// diff --git a/EXILED/Exiled.API/Features/Pickups/Pickup.cs b/EXILED/Exiled.API/Features/Pickups/Pickup.cs index 77998260a..fa9aca3b2 100644 --- a/EXILED/Exiled.API/Features/Pickups/Pickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/Pickup.cs @@ -532,7 +532,7 @@ public static IEnumerable Get(IEnumerable gameObjects) /// The specified type. /// The created . /// - public static Pickup Create(ItemType type) + public static Pickup Create(ItemType type) // TODO modify return type to "T" where T : Pickup => Create(type) as T; /// diff --git a/EXILED/Exiled.API/Features/Pickups/Projectiles/Projectile.cs b/EXILED/Exiled.API/Features/Pickups/Projectiles/Projectile.cs index 17a0691b9..80a129eb6 100644 --- a/EXILED/Exiled.API/Features/Pickups/Projectiles/Projectile.cs +++ b/EXILED/Exiled.API/Features/Pickups/Projectiles/Projectile.cs @@ -111,7 +111,7 @@ internal Projectile(ItemType type) /// The of the projectile. /// The specified type. /// The created . - public static Projectile Create(ProjectileType projectiletype) + public static Projectile Create(ProjectileType projectiletype) // TODO modify return type to "T" where T : Projectile => Create(projectiletype) as T; /// diff --git a/EXILED/Exiled.API/Features/Player.cs b/EXILED/Exiled.API/Features/Player.cs index 70acfb2c9..ada3c952a 100644 --- a/EXILED/Exiled.API/Features/Player.cs +++ b/EXILED/Exiled.API/Features/Player.cs @@ -2203,13 +2203,28 @@ public void Heal(float amount, bool overrideMaxHealth = false) /// Forces the player to use an item. /// /// The ItemType to be used. - public void UseItem(ItemType usableItem) => UseItem(Item.Create(usableItem)); + /// if item was used successfully. Otherwise, . + public bool UseItem(ItemType usableItem) => UseItem(Item.Create(usableItem)); + + /// + /// Forces the player to use an item. + /// + /// The item to be used. + public void UseItem(Usable usable) => usable?.Use(this); /// /// Forces the player to use an item. /// /// The item to be used. - public void UseItem(Usable item) => item.Use(this); + /// if item was used successfully. Otherwise, . + public bool UseItem(Item item) + { + if (item is not Usable usableItem) + return false; + + UseItem(usableItem); + return true; + } /// /// Kills the player.