How can I make this work in 1.16+?

Discussion in 'Spigot Plugin Help' started by AppleSauceTea, Jun 20, 2021.

  1. For the past two days, I have been trying to figure how to detect when a player equips armor but I can't make it work. Today, I found this great API (ArmorEquipEvent by Arnuh but it doesn't work on 1.16. Does anyone know how I could make this work on 1.16 so I can use it in my plugin?

    NOTE: Arnuh has discontinued this API and has authorized anyone to modify the project. Quote from the github page: "Due to limitations with the Spigot API(because I never cared to remove such limitations) and my time not being spent on Minecraft as much anymore I am no longer interested in attempting to fix all remaining issues with the way this plugin attempts to handle the Event. If you would like to contribute to adding an Armor Equip Event to Spigot you can do so here, otherwise. I give full permission to anyone to take over this project."

    I had to upload the file because the code was too long (sry i know it isn't convenitent)

    Attached Files:

  2. I have had this problem in the past. I really dislike how spigot still doesn't have an event for this after all of this time. But there is a work around. Listen for the InventoryClickEvent event. Then you can use the getSlotType() method to check if the slot type equals InventoryType.SlotType.ARMOR

    (If this works please (y) my post xD, I have no shame)