Creating a new world

Discussion in 'Plugin Development' started by Flascher, Mar 1, 2012.

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


    So, I have a few questions that I can hopefully get through rather shortly in this thread.

    Basically, what I want to do is create a SkyBlock on my server, except I would rather have each player have their own private SkyBlocks, or have the ability to share the access to their SkyBlock with others.

    For this, would it be best to have one world where each skyblock is spaced out VERY far from each other? (at least 1000 blocks or so) or would it be better to have a separate world for each personal SkyBlock?

    Secondly, (if having separate worlds is the best option, which I'm rather doubtful of) how would I go about creating a new world with code? I suppose I'd need to do this even if it is just one world for SkyBlocks, for simplicity's sake I suppose.

    Thirdly, would it be best to have a custom generator for making a SkyBlock every thousand blocks or so, or a generator that makes nothing but air, and then do like setBlock() (or whatever the method is... I'd also like to know what method is used for that as well, please and thank you. :) ) whenever a person uses the command to set up their own SkyBlock.

    This is going to be my first plugin, so I'm pretty new to all of this, although I've dabbled a tiny bit before. I don't have any more questions at the moment, but if I think of any more I'll be sure to post them in this thread as well. Thanks in advance for all the help!


    bump for help please? (Hope bumping isn't against the rules...)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 24, 2016
  2. server.createWorld(...)
  3. Offline


    Thank you sir, at least someone's answered one of my questions :)
  4. Offline


    I think that having only one extra world is better as it will decrease server lag. I am not sure on how to do that but i will look it up for you!

  5. Offline


    That's what I was thinking as well! So how would I go about checking if the SkyBlock world already exists? (also, how do you instantiate server? when I did it said it was abstract and implemented a bunch of "unsupported methods")
  6. Checking if the world exists:
    something}else{something else}
    Flascher likes this.
  7. Offline


    Thanks so much manniL! Would you know how to place blocks in a organized manner? Such as like placing a house for example?
  8. Mhm... IDK, I could imagine that this is possible, if you check the blocks which are under/over the location it could be possible. build step by step.
  9. Offline


    what function to you use to place a block though? Is it something like getServer().getPosition().setBlock("Wood"); or whatever?
  10. You could use player.getEyeLocation.getBlock().setTyp(Material.WOOD)
  11. Offline


    hmmm. Well I'm planning on trying to create a SkyBlock island when a user asks to have a SkyBlock. So I guess I'd generate a random position, check to make sure its a good distance from any blocks other than air, and then build outwards from that central spot?
  12. Offline


    well, we'll see how this goes ;) also, another question. I seem to be full of them. XD

    since its a new world, would it be best to make a custom generator that generates nothing but air? Or is there some way I could just use the default generator for that?

    And, for the getServer().createWorld() there is a required string argument for createWorld() and it has environments or generators... the default is createWorld("null") so what exactly would that do... although I suppose it might be best to just test it myself. ha.
  13. Mhm...

    You can build your own WorldGenerator. I think when you use createWorld(), the server throws an exception or so.
  14. Offline


    so then to link to my generator, just create a class like SkyBlockGen.class and then instantiate it, (such as SkyBlockGen sbGen = new SkyBlockGen(); ) then would I just use createWorld("sbGen"); ?
  15. I think u need WorldGen sbGen = new WorldGen(); and than you can use createWorld("sbGen"), but im not sure.
  16. Offline


    Hey again. Another question!

    Since the new Anvil map format is out, I'm looking at the MoonChunkGenerator source from Dinnerbone's MoonBukkit plugin, and for byte[] result = new byte[32768]; should 32768 be 65536 since the skycap is 256 now?

    Also, is there anything else involving ChunkGenerators that I should know about in order to comply with the new 1.2 generation?
  17. Read this sticky:ChunkGenerators & BlockPopulators FAQ
    Won't work, since getWorld() returns a list of Worlds, not Strings. Use if (Bukkit.getWorld("name") != null) instead.

    You can find out how to create a new world here and here (look at both).
    You'll end up with something like this:
    Bukkit.createWorld(new WorldCreator("name").generator(new CustomGenerator(), Bukkit.getConsoleSender()));
    where CustomGenerator is your skyblock world generator.

    edit: fixed link to point to start of thread
  18. Offline


    Thank you very much Njol! (I must say your Skript project looks very promising, keep it up!)

    Also, I'm guessing the point you're trying to get across, is that I'm going to have to wait for them to update the ChunkGenerator class?

    And thank you for the correction for detecting if a world has been created!
  19. I guess so because the Javadoc still refers to the 128 blocks limit.

    Also since you pass the ChunkGenerator as an instance, your plugin likely has to reassign the generator to the world on every server restart. You can however automate this as specified in the sticky.
Thread Status:
Not open for further replies.

Share This Page