Help with getServer()

Discussion in 'Plugin Development' started by PerezHD, Nov 19, 2014.

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

    PerezHD

    How exactly would I make a
    Code:java
    1. getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable()
    be able to go into another class?

    It says it has a error in another class, and I have to put it in main only ;/
     
  2. Offline

    Skionz

    Create a constructor that takes an instance of the Plugin class as a parameter and save it. Then create a scheduler using
    Code:java
    1. plugin.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable()
     
  3. Offline

    PerezHD

    Ok Ill give it a try

    Well I did it, but http://pastebin.com/4rwQDVpV Yah, it says scheduleSyncDelayedTask is a error

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

    mythbusterma

    PerezHD

    But you didn't do what he said. Try again.
     
  5. Offline

    PerezHD

    Eh, I created the instance in the main, idk what to do in the other class :/
     
  6. Offline

    mythbusterma

    PerezHD

    He told you to create a constructor that takes an instance of your main class (as an argument) in the dependant class, do so.
     
  7. Offline

    PerezHD

    Eh here is what I did now http://pastebin.com/zpV18vQw I still have that error on scheduleSyncDelayedTask
     
  8. Offline

    Skionz

    You never ended your brackets. And what is the point of using a constructor if you are going to make "plugin" static anyway?
     
  9. Offline

    PerezHD

    Yo, listen please, I am here for help, not judgement at all. I really don't understand how you pros do this really, that's why I am looking for someone loyal to help me right now, I was just asking :p
     
  10. Offline

    Dudemister1999

  11. Offline

    mythbusterma

    Dudemister1999

    That's a valid approach, but this method is something he's going to learn for a plethora of other things, which is why I didn't mention it.
     
  12. Offline

    PerezHD

    Haha, cool, just use bukkit instead of main instance and stuff... Also I am still getting this error http://gyazo.com/76447eaa830a3eb24cf290810b03904c

    I see where your taking this so I can improve more in my code and such, Ill try whatever.

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

Share This Page