[LIB] ArmorEquipEvent 1.7.2

A basic event thats called when players equip and unequip armor

  1. Borlea
    Tested Minecraft Versions:
    • 1.9
    • 1.10
    • 1.11
    • 1.12
    • 1.13
    • 1.14
    • 1.15
    Contributors:
    Borlea
    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
    To detect if you are equipping a piece of armor you can do
    Code (Java):
    if(e.getNewArmorPiece() != null && e.getNewArmorPiece().getType() != Material.AIR)
    To check if you are unequipping a piece of armor you can do a few changes to the above code.
    Code (Java):
    if(e.getOldArmorPiece() != null && e.getOldArmorPiece().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.

    You can also check what method the player did to equip the armor by doing
    Code (Java):
    event.getMethod()
    The six possible results are:
    • 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.

Recent Reviews

  1. JifPom
    JifPom
    4/5,
    Version: 1.7.2
    Really good API, but please please please add some proper documentation, it took me multiple examples from other friends and countless trial and error to just detect the armor. Really would be useful for other developers aswell. Other than that its really really good.
  2. Lukacizek
    Lukacizek
    5/5,
    Version: 1.7.2
    Awesome API but add 1.16.5 support, please
    80 charactersssssssssssssssssssssssss
  3. Stivlets_5000
    Stivlets_5000
    5/5,
    Version: 1.7.2
    This is a very good api! With this api i do 80% of my plugins! Thak you very much, developer!
  4. ultrapunisher97
    ultrapunisher97
    5/5,
    Version: 1.7.2
    Definitely amazing, no doubt about that. Unfortunately it doesn't work with the new 1.16 nether armor. Which I'm not sure why, because I looked at the source, and it should be working just fine.
  5. Matocolotoe
    Matocolotoe
    5/5,
    Version: 1.7.2
    Great library, really useful ! But PLEASE try to improve readability for people who want to edit things.
  6. BersamBas
    BersamBas
    5/5,
    Version: 1.7.2
    Really REALLY useful! Only suggestion I have is have a Maven Repo so it is easier to import.
  7. theboyjamal
    theboyjamal
    5/5,
    Version: 1.7.2
    helped me with a exploit I had with items being duplicated when running a certain command. great library, does exactly what it explains!
  8. OffsetPaladin89
    OffsetPaladin89
    4/5,
    Version: 1.7.2
    Good resource but for 1.12.2 and I would think below, BlockDispenseArmorEvent does not exist.
    1. Borlea
      Author's Response
      Spigot API doesn't have BlockDispenseArmorEvent implemented in versions before 1.13.1. The plugin just checks if the class exists so you can create a custom fork of Spigot and pull those changes to 1.12 and it'll work automatically.
  9. LoneDev
    LoneDev
    5/5,
    Version: 1.7.2
    Amazing!
    Thanks I needed that for my plugins, really helpful and easy to integrate.
    I like how code is simple and not bloated
  10. Jordan2313231
    Jordan2313231
    5/5,
    Version: 1.7.2
    looks great heard it was great however i cant figure out how to actually use it right