I request you to add an 'isArmor()' function. Hope you (yes, you) add it soon.
Thanks. And I appreciate all the work you have been doing to keep up the project. Glad someone took responsibility, or else I don't know what would've happen to the MCPE community altogether.
I apologize for not following the issue format as I don't think it's suitable for a request.
What is the objective of this function ? Cause i you wanna check if player have an armor some functions are already available
https://github.com/pmmp/PocketMine-MP/blob/a8650a241cc1aaeb35877ae45b290fae97195754/src/pocketmine/inventory/PlayerInventory.php#L261
Can't you just check if an item is instanceof Armor?
Having so many ways to check item type is a confusing failure of the item API that may be subject to change in the future (or may not).
Slightly irrelevant to this issue: instanceof check only works if item was created probably through Item::get(). We may want to enforce using the correct class if the item class exists, or check its correctness when it gets cloned or otherwise the instance gets into the API (e.g. inventory operations)
@SOF3 due to the way items are going to be constructed in the future, the only legal way will be to use Item::get() anyway, so that isn't concern.
I believe he/she meant Item::isArmor(), in case someone didn't get it.
(Item::class instanceof Armor) does the same thing.
Most helpful comment
Can't you just check if an item is instanceof Armor?