[UNSOLVED]Map Generation

Discussion in 'Plugin Development' started by Inthezone, Jul 2, 2012.

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

    Inthezone

    Hey guys how would I make it so in my plugin, after the server restarts, a new map would be automatically?
     
  2. Offline

    Milkywayz

    For better replies you should try to explain more about what you need. So you want a new world to be generated upon restarts? If so do you want it to unload your previous world, or flat out delete it?
     
  3. Offline

    Inthezone

    I want it to first delete the world, then generate a complete new one, I am creating a hunger games plugin and need this for random maps
     
  4. Offline

    Milkywayz

    AFAIK, there isnt a bukkit method that deletes a world, because deleting a world when the server is running would give you errors. You should create a method that you call in onDisable(), use java io to find the world folder and delete it (its a directory so you need to delete recursively i believe) then use
    Code:
    Bukkit.getServer().createWorld(arg0);
    to create a world. If this world your regenerating isnt a default world you can create it on enable, because if its default the world can generate before your plugin loads. ex :
    Code:
    17:51:33 [INFO] [Vault][Chat] iChat hooked.
    17:51:33 [INFO] Preparing level "world"
    17:51:33 [INFO] Default game type: 0
    17:51:34 [INFO] Preparing start region for level 0 (Seed: -1766643422)
    17:51:34 [INFO] Preparing start region for level 1 (Seed: -2496159691856274554)
    17:51:35 [INFO] Preparing spawn area: 69%
    17:51:35 [INFO] [WorldEdit] Enabling WorldEdit v1183-e20e2f2
    
    Note how preparing worlds happens pretty much in the middle of the server starting.
     
  5. Offline

    Inthezone

    Yeah I already have onDisable, could you go into more detail on the java io thing, I am the not the best at java
     
Thread Status:
Not open for further replies.

Share This Page