Player.equip() not working?

What am I doing wrong?

ItemStack helmet = ItemStack.builder()
           .itemType(ItemTypes.IRON_HELMET)
           .add(Keys.UNBREAKABLE, true)
           .build();
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);
if(!opSlot.isPresent()){
    //something went wrong 
    return;
}
opSlot.get().set(stack);

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.