This is just a simple plugin that calls an event when players equip and unequip armor.
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.
Usage
This is also untested on Cauldron, I don't plan to add support and have no plans to make this for Sponge.
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.
Usage
Spoiler
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.
ItemStacks in the inventory can be either null or AIR so you have to check for both when checking if its null.
You can also check what method the player did to equip the armor by doing
The six possible results are:
Code (Java):
if
(e.
getNewArmorPiece
(
)
!=
null
&& e.
getNewArmorPiece
(
).
getType
(
)
!= Material.
AIR
)
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
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.
Quick facts
- Edition: Minecraft Java
- File type: .jar
- Minecraft versions listed: 1.9, 1.10, 1.11
- How to install: Install the matching mod loader (Forge, Fabric or NeoForge) for your Minecraft version. → Download the .jar. → Put it in the .minecraft/mods folder and launch that loader profile.
- Where to get it: Opens on Spigot — not every file is mirrored on our own servers.
Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.
[LIB] ArmorEquipEvent is a free Minecraft Java mod. Compatible with Minecraft 1.9, 1.10, 1.11, 1.12 and newer. Downloaded 10,380 times (via Spigot). Download it and open it directly in the game.