Serializing ConfigurationSerializable

Discussion in 'Spigot Plugin Development' started by ohnx, May 8, 2015.

  1. I'm trying to serialize some items right so they can be written into a file, but I'm running into some issues with some particular objects.
    Most of the itemswork, but there are a few that don't...

    All of the ones that don't work appear to implement the interface "ConfigurationSerializable".
    Everything else works, just not these ones.
    I'm wondering, how would I serialize these?
    In case you're wondering, here's the stack trace for fireworks (I have others as well, but they all just say java.io.NotSerializableException):
    http://paste.md-5.net/wucodamaqu.avrasm
     
  2. Bukkit api already serialize itemstacks. For example if you want to save a player inventory to your config you can do getConfig.set("player_inv", player.getInventory().getContents());
     
  3. U̶s̶e̶ ̶#̶t̶o̶S̶t̶r̶i̶n̶g̶ ̶a̶n̶d̶ ̶#̶v̶a̶l̶u̶e̶O̶f̶ ̶f̶o̶r̶ ̶e̶n̶u̶m̶s̶,̶ ̶b̶u̶k̶k̶i̶t̶'̶s̶ ̶s̶y̶s̶t̶e̶m̶ ̶d̶o̶e̶s̶n̶'̶t̶ ̶n̶a̶t̶i̶v̶e̶l̶y̶ ̶s̶u̶p̶p̶o̶r̶t̶ ̶t̶h̶e̶m̶.̶

    ConfigurationSerialization isn't the same as java's Serializable, you can't interchange them.