Location Save??

Discussion in 'Plugin Development' started by TomTheDeveloper, Feb 24, 2013.

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

    TomTheDeveloper

    Hey, I have a question, a friend of me told me, that you can do this, but i don't believe him.

    So can you do this:
    Code:
    Location loc1 = p.getLocation();
    config.set("spawn.loc1", loc1);
    So can you save a location in your config?
    Or do you need to save everytime the x, y, z coordinate?
     
  2. Offline

    gomeow

    It depends how bloated you want it to get. Yes, you can do that, as Location implements ConfigurationSerializable, but it stores everything about it, which is like 10 lines when all you might need is the world, x, y, and z
     
  3. Offline

    TomTheDeveloper

    I only need the world, x, y, z. I don't understand you very well

    Can you give me a small example?
     
  4. Offline

    gomeow

    If you only need the world, x, y, and z, then don't just save the Location, but save them manually
     
  5. Offline

    gamerzap

    Because if you save the location, it saves a bunch of extra junk like the block x and the direction.
     
  6. Offline

    TomTheDeveloper

    so if i do:
    Code:
    Loction PVPspawn = p.getLocation();
    Config.set("PVP.spawn", PVPspawn);
    how can i get the location back?

    So??:
    Code:
    Location PVPSPAWN = (Location) config.get("PVP.spawn");
    ?
     
  7. Offline

    gomeow

    TomTheDeveloper
    Yes, but when you save, it will save a ton of things you really don't need
     
Thread Status:
Not open for further replies.

Share This Page