Home›Java›Mods›[API] ArmorChange
[API] ArmorChange
ModsJava

[API] ArmorChange

Java mod listed for Minecraft 1.16–1.19. Downloads from the MC Java Mods app on Android.

⬇ Download on Spigot
ArmorChangeEvents

Sadly Spigot does not have an event for checking when a Player is changing armor. Arnuh put a good base with his project, but there where still a lot of bugs.
This plugin should be bug free and working properly, but if you still find some please report them. Thank you!

The events handle when a player


Caution

It could be that some things changed in newer versions. Currently testing other versions.
As said before if you find bugs please report them. Thank you!


Events

All armor events of this plugin are ´ Cancellable´. The ´ ArmorAction´ gives you info how the armor was equipped or unequipped. When checking in which slot the item was equipped or unequipped use the ´ getArmorSlot()´ method.

ArmorEquipEvent

This event is called when a Player is equipping armor.

In this example we give the Player the jump boost effect when he equips iron boots.
Code (Java):
@EventHandler
private void onArmorEquipEvent (ArmorEquipEvent e ) {
    if (e. getItem ( ). getType ( ) == Material. IRON_BOOTS ) {
        PotionEffect effect = new PotionEffect (PotionEffectType. JUMP, 1000000, 2 ) ;
        e. getPlayer ( ). addPotionEffect (effect ) ;
    }
    ...
}
ArmorUnequipEvent

This event is called when a Player is fully unequipping an item out of the armor slot. This means it will only be called when the armor slot is empty. In example, you custom equipped a stack of dirt on the boots slot and take half of it, it will not count as an unequip event.

And here we remove the jump boost effect when the Player unequips iron boots.
Code (Java):
@EventHandler
private void onArmorUnequipEvent (ArmorUnequipEvent e ) {
    if (e. getAction ( ) == ArmorAction. DEATH ) return ;
    if (e. getItem ( ). getType ( ) == Material. IRON_BOOTS ) {
        e. getPlayer ( ). removePotionEffect (PotionEffectType. JUMP ) ;
    }
    ...
}

Have fun coding :coffee:

Plugin details

Read from the plugin's own plugin.yml.

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

[API] ArmorChange is a free Minecraft Java mod. Compatible with Minecraft 1.16, 1.17, 1.18, 1.19. Downloaded 164 times (via Spigot). Download it and open it directly in the game.

Explore more