diff --git a/core/src/main/java/com/seibel/lod/core/api/internal/a7/SharedApi.java b/core/src/main/java/com/seibel/lod/core/api/internal/a7/SharedApi.java index ae597bb46..904f8fe5d 100644 --- a/core/src/main/java/com/seibel/lod/core/api/internal/a7/SharedApi.java +++ b/core/src/main/java/com/seibel/lod/core/api/internal/a7/SharedApi.java @@ -7,15 +7,12 @@ import com.seibel.lod.core.a7.world.DhWorld; import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftSharedWrapper; import org.apache.logging.log4j.Logger; -public class SharedApi { - public static final Logger LOGGER = DhLoggerBuilder.getLogger("DH Events"); +public class SharedApi +{ public static IMinecraftSharedWrapper MC; public static DhWorld currentWorld; - public static WorldEnvironment getEnvironment() { - return currentWorld==null ? null : currentWorld.environment; - } + public static WorldEnvironment getEnvironment() { return currentWorld==null ? null : currentWorld.environment; } - public static void init() { - Initializer.init(); - } + public static void init() { Initializer.init(); } + } diff --git a/core/src/main/java/com/seibel/lod/core/config/ConfigBase.java b/core/src/main/java/com/seibel/lod/core/config/ConfigBase.java index 6319a37bb..d69ba4d4a 100644 --- a/core/src/main/java/com/seibel/lod/core/config/ConfigBase.java +++ b/core/src/main/java/com/seibel/lod/core/config/ConfigBase.java @@ -1,10 +1,11 @@ package com.seibel.lod.core.config; -import com.seibel.lod.core.api.internal.a7.ClientApi; import com.seibel.lod.core.config.file.ConfigFileHandling; import com.seibel.lod.core.config.types.AbstractConfigType; import com.seibel.lod.core.config.types.ConfigCategory; import com.seibel.lod.core.config.types.ConfigEntry; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import java.lang.reflect.Field; import java.util.ArrayList; @@ -18,7 +19,10 @@ import java.util.Map; * @author Ran */ // Init the config after singletons have been blinded -public class ConfigBase { +public class ConfigBase +{ + public static final Logger LOGGER = LogManager.getLogger(ConfigBase.class.getSimpleName()); + /* What the config works with @@ -76,8 +80,8 @@ public class ConfigBase { if (ConfigEntry.class.isAssignableFrom(field.getType())) { // If item is type ConfigEntry if (!isAcceptableType(((ConfigEntry) entry).get().getClass())) { - ClientApi.LOGGER.error("Invalid variable type at [" + (category.isEmpty() ? "" : category + ".") + field.getName() + "]."); - ClientApi.LOGGER.error("Type [" + ((ConfigEntry) entry).get().getClass() + "] is not one of these types [" + acceptableInputs.toString() + "]"); + LOGGER.error("Invalid variable type at [" + (category.isEmpty() ? "" : category + ".") + field.getName() + "]."); + LOGGER.error("Type [" + ((ConfigEntry) entry).get().getClass() + "] is not one of these types [" + acceptableInputs.toString() + "]"); entries.remove(entries.size() -1); // Delete the entry if it is invalid so the game can still run } } diff --git a/core/src/main/java/com/seibel/lod/core/config/file/ConfigFileHandling.java b/core/src/main/java/com/seibel/lod/core/config/file/ConfigFileHandling.java index cbb61ba6d..a1a1be0d3 100644 --- a/core/src/main/java/com/seibel/lod/core/config/file/ConfigFileHandling.java +++ b/core/src/main/java/com/seibel/lod/core/config/file/ConfigFileHandling.java @@ -2,13 +2,14 @@ package com.seibel.lod.core.config.file; import com.electronwill.nightconfig.core.file.CommentedFileConfig; import com.seibel.lod.core.ModInfo; -import com.seibel.lod.core.api.internal.a7.ClientApi; import com.seibel.lod.core.config.ConfigBase; import com.seibel.lod.core.config.types.AbstractConfigType; import com.seibel.lod.core.config.types.ConfigEntry; import com.seibel.lod.core.handlers.dependencyInjection.SingletonInjector; import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftSharedWrapper; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; @@ -23,8 +24,11 @@ import java.nio.file.Path; * @author coolGi * @version 2022-5-26 */ -public class ConfigFileHandling { - public static final Path ConfigPath = SingletonInjector.INSTANCE.get(IMinecraftSharedWrapper.class) +public class ConfigFileHandling +{ + public static final Logger LOGGER = LogManager.getLogger(ConfigBase.class.getSimpleName()); + + public static final Path ConfigPath = SingletonInjector.INSTANCE.get(IMinecraftSharedWrapper.class) .getInstallationDirectory().toPath().resolve("config").resolve(ModInfo.NAME+".toml"); /** Saves the config to the file */ @@ -128,13 +132,13 @@ public class ConfigFileHandling { else if (entry.isValid() == -1) entry.setWithoutSaving(entry.getMin()); else if (entry.isValid() == 1) entry.setWithoutSaving(entry.getMax()); } else { - ClientApi.LOGGER.warn("Entry ["+ entry.getNameWCategory() +"] is invalid. Expected " + entry.getType() + " but got " + workConfig.get(entry.getNameWCategory()).getClass() + ". Using default value."); + LOGGER.warn("Entry ["+ entry.getNameWCategory() +"] is invalid. Expected " + entry.getType() + " but got " + workConfig.get(entry.getNameWCategory()).getClass() + ". Using default value."); saveEntry(entry, workConfig); } } } catch (Exception e) { // e.printStackTrace(); - ClientApi.LOGGER.warn("Entry ["+entry.getNameWCategory()+"] had an invalid value when loading the config. Using default value."); + LOGGER.warn("Entry ["+entry.getNameWCategory()+"] had an invalid value when loading the config. Using default value."); saveEntry(entry, workConfig); } } else { diff --git a/core/src/main/java/com/seibel/lod/core/handlers/dependencyInjection/DhApiEventInjector.java b/core/src/main/java/com/seibel/lod/core/handlers/dependencyInjection/DhApiEventInjector.java index f59029b71..d96d70b20 100644 --- a/core/src/main/java/com/seibel/lod/core/handlers/dependencyInjection/DhApiEventInjector.java +++ b/core/src/main/java/com/seibel/lod/core/handlers/dependencyInjection/DhApiEventInjector.java @@ -20,7 +20,6 @@ package com.seibel.lod.core.handlers.dependencyInjection; import com.seibel.lod.core.api.implementation.interfaces.events.IDhApiEvent; -import com.seibel.lod.core.api.internal.a7.ClientApi; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/core/src/main/java/com/seibel/lod/core/logging/ConfigBasedLogger.java b/core/src/main/java/com/seibel/lod/core/logging/ConfigBasedLogger.java index 318e2901c..e08fbbe77 100644 --- a/core/src/main/java/com/seibel/lod/core/logging/ConfigBasedLogger.java +++ b/core/src/main/java/com/seibel/lod/core/logging/ConfigBasedLogger.java @@ -19,7 +19,6 @@ package com.seibel.lod.core.logging; -import com.seibel.lod.core.api.internal.a7.ClientApi; import com.seibel.lod.core.enums.config.ELoggerMode; import com.seibel.lod.core.handlers.dependencyInjection.SingletonInjector; import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; diff --git a/core/src/main/java/com/seibel/lod/core/logging/ConfigBasedSpamLogger.java b/core/src/main/java/com/seibel/lod/core/logging/ConfigBasedSpamLogger.java index 192173d91..65290b1ea 100644 --- a/core/src/main/java/com/seibel/lod/core/logging/ConfigBasedSpamLogger.java +++ b/core/src/main/java/com/seibel/lod/core/logging/ConfigBasedSpamLogger.java @@ -19,7 +19,6 @@ package com.seibel.lod.core.logging; -import com.seibel.lod.core.api.internal.a7.ClientApi; import com.seibel.lod.core.enums.config.ELoggerMode; import com.seibel.lod.core.handlers.dependencyInjection.SingletonInjector; import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;