Bläddra i källkod

Loading improvement

Lortseam 4 år sedan
förälder
incheckning
20726b3c79

+ 3 - 1
src/main/java/me/lortseam/completeconfig/Config.java

@@ -21,7 +21,9 @@ public class Config extends CollectionMap {
     }
 
     void registerTopLevelCategory(ConfigCategory category) {
-        fill(modTranslationKey, category);
+        if (!fill(modTranslationKey, category)) {
+            return;
+        }
         try {
             new GsonBuilder()
                     .registerTypeAdapter(CollectionMapDeserializer.TYPE, new CollectionMapDeserializer(this, category.getConfigCategoryID()))

+ 3 - 2
src/main/java/me/lortseam/completeconfig/collection/CollectionMap.java

@@ -13,14 +13,15 @@ public class CollectionMap extends ConfigMap<Collection> {
         super(modTranslationKey);
     }
 
-    protected void fill(String parentTranslationKey, ConfigCategory category) {
+    protected boolean fill(String parentTranslationKey, ConfigCategory category) {
         String categoryID = category.getConfigCategoryID();
         Collection collection = new Collection(modTranslationKey, parentTranslationKey, category);
         if (collection.getEntries().isEmpty() && collection.getCollections().isEmpty()) {
             LOGGER.warn("[CompleteConfig] Category " + categoryID + " is empty!");
-            return;
+            return false;
         }
         put(categoryID, collection);
+        return true;
     }
 
 }