From 081958db599bb9ad3ae7e2a21ea982fa657f4aa0 Mon Sep 17 00:00:00 2001 From: Ran <10044908-_Ran@users.noreply.gitlab.com> Date: Sun, 20 Feb 2022 13:17:35 +0000 Subject: [PATCH] Update src/main/java/com/seibel/lod/core/config/ConfigBase.java --- .../com/seibel/lod/core/config/ConfigBase.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/seibel/lod/core/config/ConfigBase.java b/src/main/java/com/seibel/lod/core/config/ConfigBase.java index 97363082f..6a2f7721b 100644 --- a/src/main/java/com/seibel/lod/core/config/ConfigBase.java +++ b/src/main/java/com/seibel/lod/core/config/ConfigBase.java @@ -1,10 +1,5 @@ package com.seibel.lod.core.config; -import com.seibel.lod.core.ModInfo; -import com.seibel.lod.core.util.SingletonHandler; -import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftWrapper; - -import java.io.File; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; @@ -13,9 +8,10 @@ import java.util.List; * Indexes and sets everything up for the file handling and gui * * @author coolGi2007 + * @author Ran */ public class ConfigBase { - public static final List entries = new ArrayList<>(); + public static final List> entries = new ArrayList>(); public static final List categories = new ArrayList<>(); public static void init(Class config) { @@ -36,9 +32,13 @@ public class ConfigBase { for (Field field : config.getFields()) { if (ConfigEntry.class.isAssignableFrom(field.getType())) { // If item is type ConfigEntry -// entries.add(ConfigEntry.class.cast(field)); -// entries.get(entries.size() - 1).category = (category.isEmpty() ? "" : category + "."); -// entries.get(entries.size() - 1).category = field.getName(); + try { + entries.add((ConfigEntry) field.get(field.getType())); // Add to entries + } catch (IllegalAccessException exception) { + exception.printStackTrace(); + } + entries.get(entries.size() - 1).category = (category.isEmpty() ? "" : category + "."); + entries.get(entries.size() - 1).category = field.getName(); } if (field.isAnnotationPresent(ConfigAnnotations.Category.class)) { // If it's a category then init the stuff inside it and put it in the category list