Getting locations from config

Discussion in 'Plugin Development' started by AoH_Ruthless, Dec 20, 2013.

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

    AoH_Ruthless

    This is just a quick question (hopefully) where I am asking if my method is correct.

    I am trying to make a minigame plugin and instead of storing lobby location as x, y, z, yaw and pitch separately, I am trying to put them in one node separated by a comma like below:

    Code:
    lobby: 0,0,0,0.0,0.0
    Is the following correct for loading that?
    Code:java
    1. String lobbyPath = fc.getString(path + "lobby"); //Ignore path variable.
    2. String[] lobbyLocation = lobbyPath.split(",");
    3. Location lobby = new Location(world, Double.parseDouble(lobbyLocation[0]), Double.parseDouble(lobbyLocation[1]), Double.parseDouble(lobbyLocation[2]), Float.parseFloat(lobbyLocation[3]), Float.parseFloat(lobbyLocation[4]));
    4. //Ignore the world variable


    Thank you!
     
  2. Offline

    Gater12

  3. Offline

    AoH_Ruthless

    Gater12
    Nope, while that is the logical answer I would give, should that code work granted my other variables are correct?
     
  4. Offline

    Gater12

  5. Offline

    AoH_Ruthless

    Gater12
    Awesome. Thank you.
    I'm not marking thread as solved incase it doesn't work when I do test it.
     
Thread Status:
Not open for further replies.

Share This Page