onEnable and getWorld()

Discussion in 'Plugin Development' started by fromgate, Nov 10, 2011.

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

    fromgate

    Hello!

    I'm trying to get a variable type world refers to the world "peace."

    However, the function call

    Bukkit.getServer().getWorld ("world");

    returns null.

    I suppose that this is due to the fact that in the onEnable event of worlds not yet initialized.

    Please help me, how I can perform initialization of the World variables in my plugin when it loaded
     
  2. Offline

    ZachBora

    Is the world even loaded? You might need to load it first. Also might help if you replace "world" by "peace".
     
  3. Offline

    fromgate

    "world" by "peace"
    :)

    Sorry for google translate. In russian "world" and "peace" are the one word - "мир" ;)

    How I can load the worlds?
     
  4. Offline

    nisovin

    Unless you've changed the startup option in your plugin.yml file, the worlds should already be loaded. Are you sure your world is called "world"?
     
    fromgate likes this.
  5. Offline

    fromgate

    Oh! I found mistake, and it was my mistake.
    I initialized the world variables in the constructor of my class, and not in onEnable event.
     
Thread Status:
Not open for further replies.

Share This Page