Player.equip() not working?

What am I doing wrong?

ItemStack helmet = ItemStack.builder()
           .add(Keys.UNBREAKABLE, true)
p.equip(EquipmentTypes.HEADWEAR, helmet);

To be honest. Didnt know that exists. Ive always gone into the inventory and set it directly.

Ask if you want to know that way (which works)

Yes please. Thank you.

Player player;
ItemStack stack;
Optional<Slot> opSlot = inventory.getEquipment().getSlot(EquipmentTypes.HEADWEAR);
    //something went wrong 

That works with latest 1.12 build - code looks perfectly fine.

Finally figured it out!

Apparently, having Player.equip() in a static function does not work. It doesn’t produce any errors or stop the code, so it it’s hard to detect. Is this intended?

EDIT nevermind

There is no reason that a method behave differently in a static context. Show your code, it’s probably something else.