1.15.2 How do I use API in plugin development?

Discussion in 'Spigot Plugin Development' started by lilmikey0174, Apr 3, 2020.

  1. I have never used an API before. Between this and my beginners understanding of java, I have so many questions.

    I have made a plugin that adds crafting recipes. It works great. Now I want to try and use an API (https://www.spigotmc.org/resources/advancedenchantments-api.76819/) to add custom enchants to the items in my plugin. I am aware my plugin will have a dependency on the advance enchants plugin.

    How would I go about this?

    My discord is Xubels#2994 if you think you can help.
  2. I use Eclipse. I have the API added to my project. Is there a way I can see how segments of code (I don't know what they are called) would be used? Inside the class you sort the code into methods, right?


    I'm trying to use the method that is highlighted. How do I know what to put in those parameters? Is there a place to view the context? Also whats the difference between the first and second applyEnchant()'s?
  3. I personally don't use eclipse but it may have a decompile function. If you click on the method if may bring up a decompiled version. But in terms of the first applyEnchant() function It looks like the first parameter is the enchant name, the second level, and the third the item to apply the enchant to.
  4. That's what I thought too. However, I don't know what I would put as the name of an enchant. If I try to add any string it says that string cant be resolved to a variable.
  5. Maybe try one from https://pastebin.com/raw/hbuDzGsL as those are the enchants apart of the plugin
  6. I didn't add quotes to the strings. Adding quotes gives this error: http://prntscr.com/rs0778
  7. Even using those strings I still get the error from above.
  8. Eclipse doesn't have the decompile function whatsoever.