Solved Plugin with Module Support

Discussion in 'Plugin Development' started by Scimiguy, Oct 6, 2015.

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

    Scimiguy

    How do I go about supporting modular extensions to my plugin?

    I.e. Have a public interface that someone else can implement in a separate jar file, and have my plugin pick up any/all of those extra jars at runtime
     
  2. Offline

    pie_flavor

    @Scimiguy Your best bet would have someone package their implementation as its own plugin, and make a system where they register themselves.
     
  3. Offline

    boomboompower

    -Removed-
     
    Last edited: Oct 6, 2015
  4. Offline

    pie_flavor

    @boomboompower Modules are extra programs added on to the main program. He was very clear about using Bukkit.
     
  5. Offline

    mine-care

    Check how dynamical class loading is done.
    Also take a look into bukkit and the way plugins are loaded.
     
  6. Offline

    Scimiguy

    Hmmm..

    I know I've seen mods and plugins do this before.. Can't think of any Bukkit plugins at the moment, but one example is that ProjectKorra mod for Forge -- Allowing you to create new abilities as separate jars and the core merges them all in.

    Java itself has the ServiceLoader object which is supposedly used for something along these lines, just didn't know if Bukkit had a better way or not

    At the moment I'm leaning towards @pie_flavor 's suggestion
     
  7. Offline

    mythbusterma

    @Scimiguy

    You'd probably be better off having them use a scripting language like JavaScript which has the Nashorn interpreter to be run natively in the JVM. This is a lot easier to use and load, and is what the Nashorn module is meant for.

    Alternatively, if you want .jars that are compiled Java, like Bukkit plugins, your only option is to create a loader that dynamically loads the contents of jarfiles. Creating your own class loader is optional.
     
  8. Offline

    Scimiguy

    Gonna go with a register method as suggested by pie_flavor..
    Closed
     
  9. Offline

    vk2gpz

    are you sure? you should do automatic module discovery and integration.
     
  10. Offline

    Scimiguy

    If you have a reliable way to do that, feel free to share
     
  11. Offline

    MisterErwin

  12. Offline

    Scimiguy

Thread Status:
Not open for further replies.

Share This Page