Code:java @Overridepublic void onEnable(){WorldCreator gamesmap = new WorldCreator("world");Random random = new Random();gamesmap.seed(random.nextLong());gamesmap.environment(Environment.NORMAL);gamesmap.generateStructures(true);gamesmap.createWorld(); This is my code, my plugin loads before world generation, and I'm getting a nullpointer exception at gamesmap.createWorld(); I want to randomize the world on restart any ideas? :L
I'm not quite sure of why you're getting this error, but maybe you could try using gamesmap.seed() (without args)?
It may be because you're trying to overwrite the default world. Try naming the world to something else. Additionally, you need may need to replace the line giving you the error with Code:java this.getServer().createWorld(gamesmap); Let me know if either of these solutions work.
Nope neither one of them did, also I misread the error, its an out of bounds exception. http://pastebin.com/gDe0T8Yg
I haven't used these classes before, but the exception is called by the method that gets the server's default gamemode. Maybe you need to pass more options to gamesmap?
Here's some code that does this same thing: Code:java WorldCreator creator = new WorldCreator("world_nightmare");creator.environment(World.Environment.THE_END);creator.generateStructures(false);creator.seed();creator.createWorld();this.world = this.getServer().createWorld(creator); I have no idea why your code doesn't work, but maybe try replacing it with this, and seeing if there's a difference. Additionally, I'm pretty sure that if you don't define a seed, it will default to a random one.
He creates a WorldCreator, which internally tries to get the default gamemode of the world. But the world is not yet loaded, so the list does not have index 0 at that moment. Don't load your plugin before the world loads Creating a WorldCreator for "world" would just return the default world