How to convert a String to a World

Discussion in 'Plugin Development' started by JoshyDEWstive, Nov 8, 2015.

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

    JoshyDEWstive

    Hey!

    Im stuck on trying to convert a string grabbed from a config file to a world, could you help me?
    I have tried casting and making multiple variables like:
    Code:
    String setWorldS = plugin.getConfig().getString("world");
    World setWorld = (World) setWorldS;
    
    Please help me, that would be much help to me and maybe others who are having the same problem!
    Thanks,
    Joshy

    EDIT by Timtower: removed useless poll
     
    Last edited by a moderator: Nov 8, 2015
  2. Offline

    Scimiguy

    Use Bukkit.getWorld(String);
     
    ZP18 likes this.
  3. Offline

    Zombie_Striker

    @JoshyDEWstive
    1. Your poll is useless and should not be here
    2. Your poll makes it sound like this thread should have been in resources, yet this is about how to solve a problem that already has dozens of threads about how to go about this.
     
  4. Offline

    FreeMotion45

    Code:
    String stringworld = getConfig().getString("path.world");
    World world = getServer().getWorld(stringworld);
    
    // I wrote it right here, so it might be a bit wrong .
    // Hope I helped :)
    EDIT by Timtower: fixed code.
     
Thread Status:
Not open for further replies.

Share This Page