getServer ()

Discussion in 'Plugin Development' started by ChrystianSandu, Jul 16, 2014.

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

    ChrystianSandu

    I made a secondary .class for a command but, when I put this:
    Code:java
    1. for (World world : getServer().getWorlds())

    It gave me an error as it does not recognize getServer()... Any help?
     
  2. Offline

    Traks

    The only reason you can use getServer() in your main class, is because its super class is JavaPlugin, which contains that method. Just use the static methods in the Bukkit class instead of getServer().
     
  3. Offline

    ChrystianSandu

    So, I will make a public void for getServer()?
     
  4. ChrystianSandu This isn't at all what Traks suggested so I think you need to learn the basics of Java, since you don't seem to understand the terminology that was provided or that you used.
     
  5. ChrystianSandu you need to get getServer() from bukkit if you don't know how to do that i say that you don't know java learn that before doing this/
     
  6. Offline

    ChrystianSandu

    bwfcwalshy and AdamQpzm
    Ok ok, I read something... and I saw this:
    Because in MainClass the getServer() is defined. But if I put bukkit.getServer(), going to work?
     
  7. ChrystianSandu yes you shouldn't even need to read that, that should be common knowledge that is if you know java which you should to make plugins or make anything that uses Java.
     
  8. Offline

    Msrules123

    It is common knowledge when trying to help someone understand something, to talk in proper grammar and try to be nice to the person.

    The correct thing would be to have a void in the middle of the class with bukkit.getServer().getWorlds().
     
  9. Offline

    Traks

    You don't need to invoke getServer() in the Bukkit class to access the methods in a Server implementation, just call them directly from Bukkit. The static methods in Bukkit call the ones in the Server implementation anyway. Why not use something that has been provided to you?
     
Thread Status:
Not open for further replies.

Share This Page