Solved Accessing non-static method in other plugin's Main class

Discussion in 'Spigot Plugin Development' started by ProfiiQus, Jun 20, 2018.

  1. Pretty much what the title says.
    I'm trying to implement some methods from another plugin. Problem is, all of these are in the plugin's Main class (extending JavaPlugin) and I can't access them because of another initialization of Main error.

    Is there any possibility to get over this?
  2. You could use PluginManager#getPlugin to get the plugin.
    Say the plugin's name is "Foo" and the main class in that plugin (the one that extends JavaPlugin) is "Bar.class"
    Code (Text):
    Bar plugin = server.getPluginManager().getPlugin("Foo");
    • Like Like x 1
    • Winner Winner x 1
  3. JanTuck


    Get the plugin instance?
    • Winner Winner x 1
    • Creative Creative x 1
  4. Okay guys, I didn't think about that.
    Thanks for help.
  5. Praya


    Code (Java):
    final OtherPlugin plugin = JavaPlugin.getPlugin(OtherPlugin.class);