Connecting, linking plugins with each other?!

Discussion in 'Plugin Development' started by MisterPhiloe, Mar 12, 2014.

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

    MisterPhiloe

    Hellooo,

    So I am busy with a project with a friend and I was wondering if it is possible to get information directly from plugin to plugin like methods. So as example i make a join plugin and a Shop item and then if someone clicks the shop item it opens then you can choose something and that wont be registered by the join plugin but with an another plugin?

    Is this possible.. yes i think so but does it require something like github or something?
    and how would i do this?

    Thanks already
     
  2. Offline

    Amgis

    MisterPhiloe

    I've never worked with this before, but I can point you to this method:
    Code:java
    1. String pluginName;
    2.  
    3. Plugin plugin = Bukkit.getPluginManager().getPlugin(pluginName);
     
  3. Offline

    MisterPhiloe


    Could you help me with getting an method from an another class because i have the idea it doesnt work
     
  4. Offline

    acecheesecr14

    Ok, so import the plugin on your IDE, same method as how you imported Bukkit.
    Then call the function and import the class which the function is in. That should work?

    Does this plugin have an API
     
  5. Offline

    MisterPhiloe

    Nope it doesn't have an API.. I know how to import it but I don't know how I would make an plugin into an API
     
  6. Offline

    acecheesecr14

    Well if the function is static, you should be able to call it from another class, once imported.
     
  7. Offline

    Bart

    If you have PluginA that needs to connect to PluginB (with the main class of PluginB being 'PluginB') you could do:
    Code:java
    1. PluginB pluginB = (PluginB) getServer().getPluginManager().getPlugin("PluginB");

    From there you can access all the methods in PluginB's main class
     
  8. Offline

    MisterPhiloe

    and if you want to get a method from another class in an another plugin?
    so not the main class?
     
  9. Offline

    Bart

    Make sure your plugin.yml has depend:[PluginB] in it but then you will have to get an instance from the main class, use a singleton or make the methods in the other plugin static
     
Thread Status:
Not open for further replies.

Share This Page