[Question] Using a library in my plugin; Ok? Or bad?

Discussion in 'Plugin Development' started by bdubz4552, Jun 29, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    bdubz4552

    I am considering using a library for one of my plugins, but this raises questions such as how would a server running this plugin also have this library, and how would I get the plugin to access this library once thrown into a server? I know the reason the Bukkit API works is because those methods are found inside the server that the plugin runs on.

    So, my question ultimately resides in execution. Would it be possible to internalize a library inside my plugin's jar? Or do I have to ship my plugin and the library side by side in a zip?
     
  2. Offline

    xTigerRebornx

    bdubz4552 It depends on the library. You are able to load the library if the jar its in is present in the server directory or inside your plugin's jarfile (load it through Java methods and whatnot), and there are tools like Maven that can shade the libraries into your jar.
    Thought, read through http://wiki.bukkit.org/BukkitDev:Project_Submission_Guidelines to make sure what you are doing follows the guidelines if you plan on uploading it to Bukkit.
     
  3. Offline

    thecrystalflame

    If you are using maven, read option 1, if not completly disregard it as it would just confuse you.

    1: you can shade the library into your plugin, by using mavens shade plugin in the build section of your pom.

    2: you could just add the class's from that library into your plugin itself. keep in mind copyrights etc but you should be fine as long as you give correct credit and dont claim it as your own
     
  4. Offline

    bdubz4552

    xTigerRebornx Alright, I will see what I can do about storing it inside the jar. My Eclipse install doesn't like Maven for some reason, and I doubt that any server has the library I'm looking into. Thanks!

    thecrystalflame The library is open source... I will research some license terms, and if its legal, I will just do option two. My Eclipse doesn't like Maven for some reason.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  5. Offline

    techboy291

    Did you install m2e? Because that's the easiest way to use Maven in Eclipse. And all Maven shading is is just Maven copying the library's classes and packages into the jar along with your plugin, so servers wouldn't need to have the library on their server anywhere (plugins are a different story of course).
     
  6. Offline

    bdubz4552

    techboy291 Took the link, but it says its for Indigo, when I have Juno...
     
  7. Offline

    techboy291

    Then install Indigo. :p
     
Thread Status:
Not open for further replies.

Share This Page