1.15.2 Proper way to retrieve a List of ConfigurationSerializable objects

Discussion in 'Spigot Plugin Development' started by Toxic_Tyler, Mar 7, 2020.

  1. What is the proper way to retrieve a List of serializable objects? I found FileConfiguration#getMapList though I haven't tested it and it's giving me a lot of typecasting warnings and the like.
     
  2. Choco

    Moderator

    You should be able to use FileConfiguration#getList() which will return a List<?>. Those should be able to be casted to your objects. That being said, lists of ConfigurationSerializable objects is a bit strange. Those objects are practically sections with key/value pairs, which is extremely awkward in a list.
     
    • Funny Funny x 1
  3. I'll try that out thanks. I was getting a List of Maps of Strings to Objects and manually deserializing each object to store in a new List and I figured it was kinda asinine.