Solved Getting The End/Nether

Discussion in 'Plugin Development' started by Ghost_Sailor, Dec 27, 2014.

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

    Ghost_Sailor

    I'm looking to grab a World object for The End, and the Nether. I've searched up and down the forums, and all over Google, to no avail. Is there a method that can accomplish this, or should I just shotgun it and regex the worlds list looking for end and nether?
     
  2. Offline

    DemKazoo

    I don't really understand what you mean? Are you trying to getWorld?

    Code:
    Bukkit.getWorld()
     
    BlazingBroGamer and msnijder30 like this.
  3. Offline

    Ghost_Sailor

    Yes, but I don't know the exact name of the world, because they can change.
     
  4. Offline

    nitrousspark

    @Ghost_Sailor you can get a world by id i believe.
    0 = world
    1 = nether
    2 = end
    Code:
    Bukkit.getWorld(1);
     
  5. Offline

    Ghost_Sailor

    Okay. Thanks.
     
  6. @nitrousspark
    That method doesn't exist.


    @Ghost_Sailor
    Loop through all worlds with Bukkit#getWorlds(), then check their environment with World#getEnvironment() and compare that to some Environment.
     
  7. Offline

    nitrousspark

    @Assist i know there is a way, i've done it before.
     
  8. Offline

    SuperOriginal

    Unless you manually change it, it's going to be world_nether or world_end
     
  9. Offline

    API_Tutorials

    @Ghost_Sailor

    Code:
    public boolean hasEnvironment(World w, Environment e){
    
    if (e == Environment.THE_END){
    if (Bukkit.getWorld(w.getName() + "_the_end") != null) return true;
    ]
    else if (e == Environment.NETHER){
    
    if (Bukkit.getWorld(w.getName() + "_nether") != null) return true;
    }
    
    return false;
    }
    (typed on phone, might have some issues)
     
  10. Offline

    Evaluations

    getWorld().getEnvironment().equals(World.Environment.NORMAL)) ?
     
Thread Status:
Not open for further replies.

Share This Page