79091580

Date: 2024-10-15 20:08:32
Score: 0.5
Natty:
Report link

The problem could not be directly solved at this moment, was however averted using ObjectOutputStream.

I'm simply writing all the data containers to their own file when the server shuts down

ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(
    "plugins/MyPlugin/data/some_data.bin"));
oos.writeObject(myObjectContainingAllTheData);
oos.close();

... and read them back in when starting again.

ObjectInputStream ois = new ObjectInputStream(new FileInputStream( 
    "plugins/MyPlugin/data/some_data.bin"));
myObjectContainingAllTheData = (HashMap<UUID, SomeSerializableType>)ois.readObject();
ois.close();

(try-catch left out for simplicity)

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: ToneXum