@@ -103,14 +103,22 @@ public static void save(FileConfiguration config, File file, Charset charset) th
103103 @ NotNull
104104 public static List <ConfigurationSection > getSectionList (ConfigurationSection config , String key ) {
105105 List <ConfigurationSection > list = new ArrayList <>();
106- List <Map <?, ?>> rawList = config .getMapList (key );
107- for (Map <?, ?> map : rawList ) {
108- MemoryConfiguration section = new MemoryConfiguration ();
109- for (Map .Entry <?, ?> entry : map .entrySet ()) {
110- String sectionKey = entry .getKey ().toString ();
111- section .set (sectionKey , processValue (section , sectionKey , entry .getValue ()));
106+ List <?> rawList = config .getList (key , null );
107+ if (rawList == null ) return list ;
108+ for (Object obj : rawList ) {
109+ if (obj instanceof Map ) {
110+ Map <?, ?> map = (Map <?, ?>) obj ;
111+ MemoryConfiguration section = new MemoryConfiguration ();
112+ for (Map .Entry <?, ?> entry : map .entrySet ()) {
113+ String sectionKey = entry .getKey ().toString ();
114+ section .set (sectionKey , processValue (section , sectionKey , entry .getValue ()));
115+ }
116+ list .add (section );
117+ continue ;
118+ }
119+ if (obj instanceof ConfigurationSection ) {
120+ list .add ((ConfigurationSection ) obj );
112121 }
113- list .add (section );
114122 }
115123 return list ;
116124 }
0 commit comments