From 538df6000cd4ca23a3dab1d23ada733951903f7d Mon Sep 17 00:00:00 2001 From: TomTheFurry <46843632+TomTheFurry@users.noreply.github.com> Date: Tue, 8 Mar 2022 17:04:16 +0800 Subject: [PATCH] Fixup that one line. With comments --- .../lod/core/config/file/ConfigFileHandling.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/seibel/lod/core/config/file/ConfigFileHandling.java b/src/main/java/com/seibel/lod/core/config/file/ConfigFileHandling.java index e14f29c13..c0e0fd8d3 100644 --- a/src/main/java/com/seibel/lod/core/config/file/ConfigFileHandling.java +++ b/src/main/java/com/seibel/lod/core/config/file/ConfigFileHandling.java @@ -74,10 +74,16 @@ public class ConfigFileHandling { config.close(); } - public static void loadEntry(ConfigEntry entry, CommentedFileConfig workConfig) { + + @SuppressWarnings("unchecked") // Suppress due to its always safe. (I think. See reasons below.) + public static void loadEntry(ConfigEntry entry, CommentedFileConfig workConfig) { if (workConfig.contains(entry.getNameWCategory())) { if (entry.get().getClass().isEnum()) { -// entry.setWTSave(workConfig.getEnum(entry.getNameWCategory(), entry.get().getClass())); // FIXME[config] LEETOM, FIX THIS + // Safe cast due to above checking that is indeed a Enum + // And the second cast back to is safe due to the template + entry.setWTSave((T)( + workConfig.getEnum(entry.getNameWCategory(), (Class) entry.get().getClass()) + )); } else { entry.setWTSave(workConfig.get(entry.getNameWCategory())); }