Check if a Player equipped and armor

As the title says, I want to know how can you check if a Player has equipped an armor. I tried using the ChangeInventoryEvent.Equipment event, but that seems to not be fired off at all. So how can you do that?

Try

ChangeEntityEquipmentEvent.TargetPlayer

Based on your title of “check” do you want to know how to check or do you mean listen?

Sorry I meant listen, when a Player clicks the armor slot with an item or a Dispenser equips it. I see that this event is fired when I do one of these actions, so I guess I can rely on it

The event I said will do it. To quote the description of the base event.

/**
* Called when an entity changes an equipped item. This can occur whenever
* a {@link Slot} belonging to an {@link Inventory} of an {@link Entity}
* is filled with an {@link ItemStack}, emptied of an {@link ItemStack},
* or swapped with an {@link ItemStack}. In the event that a change to the
* {@link ItemStack}, the use of the {@link Transaction} is recommended.
*/
1 Like