Get code in other plugin?

Discussion in 'Spigot Plugin Development' started by Snowmite, May 17, 2017.

  1. Is it possible to get code from another plugin? Like get a method from another plugin without adding as a dependency?
     
  2. Well um, you could access it maybe by doing Bukkit#getPluginManager()#getPlugin("PLUGIN NAME");
    Unless you decompile it, I don't really know.
     
  3. I don't think it's possible without adding it as a dependency.
     
  4. You can do it as long as the class you are attempting to use is loaded on the server, and you ignore the compile errors in your IDE. I do not suggest doing this, there is no reason not to add the jar to your project as a library.
     
  5. You can use reflection, but it's generally a really bad idea so I won't bother explaining as you really should NOT do it. Just add it as a dependency... It's good practice and will result in a more future proof plugin as well as greater stability.