Solved quick simple question

Discussion in 'Plugin Development' started by Yazan, Jun 1, 2014.

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

    Yazan

    Hello! This might seem like a noob question but my mind is kind of turned off today and I can't figure this out. I want to access this class from my plugin but when I call it I don't know what to put in the Fe space, could you please tell me what should I put? Thanks.
     
  2. Offline

    guyag

    I presume your main plugin class (which extends JavaPlugin) is named Fe? Use the instance of that which you have.
     
  3. Offline

    Yazan

    My main class isn't called Fe, no. I'm accessing this API.class from the plugin Fe-Economy and I've tried putting my main class but didn't work.
     
  4. In the same package as the class you want to acces there is a class cald Fe that class if the thing you need to add in the construstor, but that is the java plugin class. So new Fe() won't work, you need to get an the instance of the class:
    Code:java
    1.  
    2. Fe plugin = Bukkit.getPluginManager().getPlugin("Fe");
    3.  

    Then you need to get the instance of the class you want to acces:
    Code:java
    1.  
    2. API api = plugin.getAPI();
    3.  


    Note: I am on my phone, so it can be that I did something wrong or that the way to get the instance of the plugin class is wrong. But it's worth a try.
     
    Yazan likes this.
  5. Offline

    Yazan

    Thank you so much! That solved it!
     
Thread Status:
Not open for further replies.

Share This Page