createWorld function gives nullpointer

Discussion in 'Plugin Development' started by calthor, Aug 10, 2011.

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

    calthor

    i've been at this all day long without any succes so far, so decided to ask for help...
    i'm trying to create terrain generator, but i can't get my plugin to create a new world.
    when the world already exists, but doesn't have anything in the region folder, the generator works fine. without the world, i keep getting a nullpointerexception and i can't figure out where it comes from.
    Code:
    23:24:54 [SEVERE] Error occurred while enabling WasteLandsv0.0 (Is it up to dat
    e?): null
    java.lang.NullPointerException
            at net.minecraft.server.World.c(World.java:171)
            at net.minecraft.server.World.<init>(World.java:142)
            at net.minecraft.server.WorldServer.<init>(WorldServer.java:27)
            at org.bukkit.craftbukkit.CraftServer.createWorld(CraftServer.java:465)
            at org.bukkit.craftbukkit.CraftServer.createWorld(CraftServer.java:439)
            at cx.calthor.wastelands.WasteLands.onEnable(newWorld.java:47)
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:126)
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader
    .java:878)
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManage
    r.java:272)
            at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:162)
            at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:146
    )
            at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:284)
            at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:271)
            at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:148)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:335)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)


    the console says it's in this line:
    Code:
    getServer().createWorld(new String("WasteLands"), org.bukkit.World.Environment.NORMAL, new Generator());
    i've been trying to get rid of the nullpointer in that line, and checked the generator for nullpointers, but didn't find any
    if source is needed i can post it, i'll give source when it's finished anyway
    help apreciated.
     
  2. Offline

    vildaberper

    Something might be missing in Generator. Im not sure, but I dont think its the String. :)

    Btw, why use new String("bleh"), when "bleh" is already a String?
     
  3. Offline

    calthor

    i tried that because i can't figure out what it is.
    but you're right, i can remove the new String stuff and place the normal string there.
    just cleared my generator, so that it doesn't generate anything (just air). i removed all fields and functions except for the generate function. still had the same result
     
  4. Offline

    nisovin

    If you want help, please just post your source so we don't have to guess.
     
  5. Offline

    calthor

    sorry for the late response, fell asleep...
    i figured out the generator returns a null when instantiated :\
    guess i've still got an error in that one somewhere
     
Thread Status:
Not open for further replies.

Share This Page