get default world and nether world...

Discussion in 'Plugin Development' started by totokaka, Sep 24, 2011.

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

    totokaka

    Ok, so for a plugin i'm making for a friend i need to find the default world and the nether world.
    i suppose i could get if nether is allowed by player.getServer().getAllowNether();?
    thx
     
  2. If you only use it for yourself and you do not change the standard world generation, then
    Bukkit.getServer().getWorld("world");
    and
    Bukkit.getServer().getWorld("world_nether");
    should work.
     
  3. Offline

    totokaka

    ok, any other methods for non default generator
     
  4. Offline

    stelar7

    I think this would work...

    Code:java
    1. public World getNether(Player player) {
    2. for (World world : Bukkit.getServer().getWorlds()) {
    3. if (world.getPlayers().contains(player)) {
    4. nethers = world.getName() + "_nether";
    5. break;
    6. }
    7. }
    8. nether = Bukkit.getServer().getWorld(nethers);
    9. return nether;
    10.  
    11. }
    12.  
    13. public World getNormal(Player player) {
    14. World world = player.getWorld();
    15. String[] normals = world.getName().split("_");
    16. World normal = Bukkit.getServer().getWorld(normals[0]);
    17. return normal;
    18. }
     
  5. Offline

    Nitnelave

    I'm not sure, but doesn't getServer().getWorlds().get(0) always return the main world, and 1 the nether world?
     
    Firzen likes this.
  6. Offline

    K900

    It's not documented IIRC, but it works.
     
  7. Offline

    iffa

    That should be the case.
     
Thread Status:
Not open for further replies.

Share This Page