This is just a simple plugin that calls an event when players equip and unequip armor.
- Tested Minecraft Versions:
You can either just add this plugin as a dependency in the plugin yml and add it to your Libraries, or grab the needed methods and Class from the github page and insert it into your plugin. (Make sure when you grab the events you are registering them). The event is just named ArmorEquipEvent.
This plugin doesn't support equipping or unequipping of armor on mobs.
The github page is available here.
If you have any questions please do ask via pm or just reply to the resource.
To detect if you are equipping a piece of armor you can do
To check if you are unequipping a piece of armor you can do a few changes to the above code.Code (Java):if(e.getNewArmorPiece() != null && e.getNewArmorPiece().getType() != Material.AIR)
ItemStacks in the inventory can be either null or AIR so you have to check for both when checking if its null.Code (Java):if(e.getOldArmorPiece() != null && e.getOldArmorPiece().getType() != Material.AIR)
You can also check what method the player did to equip the armor by doing
The six possible results are:Code (Java):event.getMethod()
- Shift Click: Pressing shift + left or right click
- DRAG: Holding shift and dragging the item over the inventory slots then releasing left click.
- PICK_DROP: Picking up the item and dropping it into the armor slot or inventory
- Hotbar: Right clicking a piece of armor from the 9 hotbar slots.
- Hotbar Swap: When you press 1-9 while hovering over an armor slot to equip/unequip the armor piece to/from that slot
- Dispenser: Being in range of a dispenser when it shoots a piece of armor out.
- Broke: When an armor piece breaks(If cancelled durability gets set to 0 which means one hit till it breaks again)
- Death: When a player dies.
This is also untested on Cauldron, I don't plan to add support and have no plans to make this for Sponge.
[LIB] ArmorEquipEvent 1.7.2
A basic event thats called when players equip and unequip armor