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.
A 1.7.1 beta build is available here. Suggested if you're on 1.13
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.6.5
A basic event thats called when players equip and unequip armor
Thanks for this! Why isn't this implemented in regular Bukkit/Spigot?^^
Looks pretty good so far. I only encountered two issues:
1) In the source, there's nothing about Dispensers even though you created the enum constant (the newArmorPiece was null in that case, even though it was a chestplate).
2) When trying to insert an armor piece into your creative inventory armor slot (and you cancel the event in your listener), the armor piece disappears completely.
I know that you usually don't insert improvements into the review section, but I thought it'd be fine in the form of a 5-star review ^.^
I would just like to say a very BIG thank you for developing such a user-friendly plugin and I am so greatful that such an excellent plugin is all for the cost of NONE I'm so proud that you are a plugin developer you should definitely make more plugins in the future, keep up the amazing work and this is to credit you for all your hard work on such a complex yet easy to learn plugin for custom enchantments, and I can so by far this is the BEST enchantment plugin that I have ever (in my 19 years of living) witnessed, I would recommend this plugin to all server developers who would like a custom RPG style factions server (I'm making an RPG Factions server speaking of which ^^) I wish you great luck for your future projects! If I could I'd rate 11/10 stars!
This plugin does not work anymore. I don't know if it is just outdated or what but when I tried contacting the dev, she answered, and when it seemed she did not know how to fix it, she did not even bother replying or trying to help me.
I do not recommend this plugin unless you want something that does not work lol.