"getServer cannot be resolved"

Discussion in 'Plugin Development' started by daelwolf, Jul 12, 2014.

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

    daelwolf

    Hello,

    I'm fairly new to the coding world (started tonight, actually) and am already experiencing problems. What seems like a big problem to me is surely a small one to you all. ;3That's why I'm here for support, rather than my nearest Best Buy.

    I'm coding a block placement plugin: place a block, receive a message; destroy a block, receive a message.

    I've gotten almost all the way done, except for this small error I can't resolve. Here is a small portion of the code:

    Code:java
    1. public void onEnable() {
    2. getServer.getPluginManager.registerEvents(this,this);
    3. }

    I'm receiving the error with the "getServer" part-- as the title stated, "getServer cannot be resolved."

    Any help is greatly appreciated. Thanks.
     
  2. Offline

    Konkz

    getServer is a method therefore it needs () - I suggest revisting Java lessons.
     
    daelwolf likes this.
  3. Offline

    chasechocolate

    getServer()

    EDIT: Ninja'd by Konkz :I
     
    daelwolf likes this.
  4. Offline

    RawCode

    wont work ever with () due class hierarchy rules.

    you should learn java before coding bukkit, bukkit a bit too complex for first expirience with java.
     
  5. Offline

    Rocoty

    What are you talking about? Of course it will work, seeing as this is the main class...
     
  6. Offline

    Flamedek

    That is subject to opinion though. It will differ from person to person.
    I have learned the basics of java through the bukkitAPI and developing bukkit plugins. Although I will never claim to be an expert in any way, I know my way around the API and java code by now.

    Given, in the beginning it will be harder/slower because you are essentially learning two things at the same time but it's not impossible.
     
  7. Offline

    RawCode

    Rocoty
    Bukkit.getServer()...
    really learn java.

    Flamedek
    i got c# under 2 hours from nothing, but most visitors of this forum unable to ever read sticky threads.
    if you smart - everything easy, but majority is not smart.
     
  8. Offline

    Rocoty

    RawCode JavaPlugin declares getServer(). Main class inherits. Which means you can directly call it from the main class instance. Sorry for having to point that out for you and lower your arrogance a bit, but I think you need it, sir.

    Source: http://jd.bukkit.org/dev/doxygen/d7...Plugin.html#ac9c92663e6991509e82fd4a24951df4b

    By the way, calling Bukkit.getServer() in this case would also be redundant, seeing as Bukkit declares most of Server's methods as static utility methods.
     
  9. Offline

    RawCode

    show me full class declaration inside first post... Rocoty

    if you will locate "extends JavaPlugin" we will talk more.
     
  10. Offline

    Rocoty

    RawCode I think you might find that the code posted is inside an onEnable method. Hence my reasoning for believing this exists in the main class. Of course, I might be wrong, but don't tell me I'm wrong to assume it is in the main class.
     
    AdamQpzm likes this.
  11. Offline

    ReggieMOL

Thread Status:
Not open for further replies.

Share This Page