Outdated craftbukkit?

Discussion in 'Plugin Development' started by Cyber_Pigeon, Apr 21, 2014.

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

    Cyber_Pigeon

    Hello, I am coding a plugin, but when I try to load it, I get a stack trace saying its out of date: http://imgur.com/RjNzBDj
    The jar I used in the plugin was: bukkit-1.7.2-R0.3.jar
    What do I need to do to fix this?
    Thanks in advance.
     
  2. Offline

    epicfacecreeper

    Can I see your main class?
     
  3. Offline

    Gater12

    Cyber_Pigeon
    Did you create any new instance of the Main class anywhere?
     
  4. Offline

    Cyber_Pigeon

    Yes, I did in every class:
    Code:java
    1. Main plugin;


    http://pastebin.com/AAS32rMV

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  5. Offline

    Gater12

    Cyber_Pigeon
    That's not creating a new instance, it's just telling what type of object it is.
    This is creating a new instance (and that causes the problem):
    Code:java
    1. new Main()


    You don't have any other classes that extends JavaPlugin?
     
  6. Offline

    Cyber_Pigeon

    All my classes extends JavaPlugin
     
  7. Offline

    Gater12

  8. Offline

    Cyber_Pigeon

    Gater12 When I do that the method "getConfig" becomes an error.
     
  9. Offline

    Gater12

    Cyber_Pigeon
    You have to get the config from your Main classes instance.
    You can do it two ways:
    1. CONSTRUCTOR
    Code:java
    1.  
    2. /* In your other classes */
    3. private Main plugin;
    4. public YourOtherClassNameHere(Main plugin){
    5. this.plugin = plugin;
    6. }
    7. plugin.getConfig()
    8.  
    9. /* When creating a new instance of it in your main class */
    10. new YourOtherClassNameHere(this)


    2. getInstance()
    Code:java
    1.  
    2. /* Make a static variable and then in the onEnable initiate the variable to your plugin */
    3. private static Main instance;
    4.  
    5. public void onEnable(){
    6. instance = this;
    7. }
    8.  
    9. /* Make your static method to return your Main class instance */
    10. public static Main getInstance(){
    11. return instance;
    12. }
    13.  
    14. /* In your other class */
    15. Main.getInstance().getConfig()
     
  10. Offline

    Cyber_Pigeon

    Gater12 Thanks so much!

    Gater12 still has the same stack trace. :(

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
Thread Status:
Not open for further replies.

Share This Page