Getting World by name?

Discussion in 'Plugin Development' started by Jayjay110, May 25, 2011.

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

    Jayjay110

    is it possible to get all the worlds available in the game for a certain task, I want to get all the living entities (i think) in the server, and check something against them, anyway to do this?
     
  2. Offline

    garbagemule

    getWorlds() in the Server class will return a list of all the worlds on the server. I think maybe I misunderstood your question though, because I would assume you have already tried that :confused:
     
  3. Code:
                for(World w:getServer().getWorlds()){
                    for( Entity e:w.getEntities()){
                        //do stuff here                    }
                    }
    
                }
     
  4. Offline

    narrowtux

    Server class has a method World getWorld(String name)
    So you'd basically do getServer().getWorld("superduperworld");
     
  5. Offline

    Windwaker

    Disregard this post...
     
  6. Offline

    Jayjay110

    I did this, works well, but I already figured it out b4 u posted it Lol :p thanks lol
     
Thread Status:
Not open for further replies.

Share This Page