Saving a Player object and two Location objects to a config.yml?

Discussion in 'Plugin Development' started by supersonicsauce, Jun 24, 2014.

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

    supersonicsauce

    Hey guys.
    How would I go about saving a Player object and two Location objects to a text file, and then reading them later? I'm trying to make a regioning-type plugin, where a region is defined by two points and then saved to a config file along with the player object that created the region..
    If I want to save these regions and the players that own them and access them later through a config.yml, how would I do so?

    So far, I've tried making a subclass with the three listed objects, but I couldn't figure that one out.

    All help and example code is appreciated.
     
  2. Offline

    fireblast709

    supersonicsauce instead of a Player object, use a UUID. Locations can be saved using the worldname and a Vector (or x, y and z separately)
     
  3. Offline

    supersonicsauce

    How do I get the UUID? And how would I store the world name and vector in a config file? The only way I could think of was to use a list of some kind.
     
  4. Offline

    fireblast709

    supersonicsauce for the UUID, that's just one method you can find in the javadocs (hint: (U)UID means (Universal)UniqueID). For the config, the wiki has a page dedicated to it.
     
  5. Offline

    jthort

    supersonicsauce fireblast709 Just a suggestion, you can see one of the library's too handle object serialization just to make your life easier (Although i wouldn't bother with just the location and player objects) but for future reference
     
Thread Status:
Not open for further replies.

Share This Page