Calling methods from other plugins?

Discussion in 'Plugin Development' started by Relentless_x, Apr 29, 2011.

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

    Relentless_x

    One of the people in my team is making a plugin that needs to use a method from my plguin (.getRace()) we were wondering would it be the same calling a method from another jar file as it is calling it from another class? if not how could i do this? Thanks in advance

    any help at all?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 14, 2016
  2. Offline

    Evenprime

    Code:
    // this gets a reference to the plugin
    YourPlugin plugin = (YourPlugin) Bukkit.getServer().getPluginManager().getPlugin("YourPluginName");
    
    // this checks if the plugin was found and is enabled
    if(plugin != null && plugin.isEnabled()) {
        // Here you can safely call any method of the plugin, e.g.
        plugin.getRace();
    }
    
     
Thread Status:
Not open for further replies.

Share This Page