Armor Equip!

Discussion in 'Spigot Plugin Development' started by Creepermanthe3rd, Jun 18, 2016.

  1. Ive been trying to figure this out for a while. Im making a custom enchanting plugin but I cant figure out how to test when a Player equips/un-equips special named/lored armor. If anyone could respond with the code for this that would be great!(Or the method for it, if there is one).

    If Anyone does help thank you SOOOOOO much!
     
  2. There's no event specifically for armor equip. However, what you can do is listen to the inventory click event, and check if the player has placed his armor in the slot you want to check. I will not provide code, as that would be spoonfeeding and Spigot is strongly against that.
     
  3. Funny, because I'm making a custom enchantment plugin aswell. I'm using a custom event called ArmorEquipEvent and it works like a charm for custom enchants. No bugs with it at all. I changed it slightly in the code so it fits better with my needs, but have a go at it! ITS AWESOME!
    You can find it here: https://drive.google.com/file/d/0ByosMTM_4WtMUFhZU3RZTnpQQnc/view?usp=sharing
     
  4. Can you link me where you downlaoded this?
     
  5. I cannont figure it out :(
     
  6. He already did. He linked you to the jar you'll need to make it work. Just add it as a dependency/library, and you should be good to go. That being said, if you still don't understand it, the link to the Spigot plugin download can be found here.
     
  7. Not sure how to add it a a dependancy/library
     
  8. What IDE are you using?
     
  9. Hopefully intellij ;)
     
    • Like Like x 1
    • Optimistic Optimistic x 1
  10. Eclipe
     
  11. Choco

    Moderator

    You would add it the same way you added the Spigot dependency. (Alt + Enter on project -> Libraries -> Add External Jar, Add the jar file)
    In your plugin.yml, add "depends:[PluginName]"
     
    • Agree Agree x 1
  12. Right click your project --> Mouseover "Build Path", then click on "Configure Build Path" --> On the right side of the window, hit "Add external jars", afterwards, select your "ArmorEquipEvent.jar" file and hit "Open". Your dependency should now work and you can now use ArmorEquipEvent like any other events like so:
    Code (Text):
    @EventHandler
    public void armorEquip(ArmorEquipEvent event) {
       // Do epic stuff here
    }
     
  13. its probably more handy to learn java a little better first, not to be mean, but if i read this post it seems like you dont have enough java knowledge yet