Serializing block state

Discussion in 'Spigot Plugin Development' started by dallabonalucas, Jul 4, 2015.

  1. Hi spigot community,
    i'm working on a plugin that i need to save the block state in the config, how can i do that ?

    Thank you
     
  2. Are you talking about saving the block information into a String?
     
  3. Store the X,Y,Z in the config and pull the data from the world. You can write a serializable class but I think XYZ is better for you.
     
    • Optimistic Optimistic x 1
  4. What are you using this for?
     
  5. I want to save the current block state

    I don't need only coordinates, i need the Type of the block and the respective location, to restore the state another time

    Minigame operation to restore the map
     
  6. Are you planning on regenerating an entire map block by block...? That will probably crash your server.
     
  7. A little area, not a entire map.
     
  8. I would suggest using something like the WorldEdit API to just save and restore a region. It'll all be handled for you and it's gonna work a lot better than what you'll come up with.
     
  9. As @bo0tzz mentioned, you could make use of existing libraries to save/load schematics. As far as I know, schematics are one of the easiest and most efficient ways to save/load areas as there are also quite a lot of existing libraries out there for you to use such as WorldEdit.