1.14.4 How can I store world edit changes to flat file

Discussion in 'Spigot Plugin Development' started by Harry0198, Feb 17, 2020.

  1. My end goal is to be able to rollback changes from the world edit api after x amount of time.
    So far, I'm storing everything in a .json format and I've tried formatting via gson. Here's what I've got so far:
    Code (Text):
     private String serializeObject(EditSession editS) {
            return gson.toJson(editS);
        }

        private EditSession deserializeObject(String serializedObject) {
            EditSession session = gson.fromJson(serializedObject, EditSession.class);
            return session;
        }
    Now, what happens when this code runs is I get a stack overflow error because of the cyclic dependencies and whatnot (through gson) I've also tried ChangeSet and even individual Change class from world edit.

    How would I go about being able to store the changes made and then retrieving the changes at a later date?
     
  2. Create a custom class to stores that you need, using gson on that and creating a EditSession when you redoit?