From 5183b542850689652b773787ec4e67b385b47866 Mon Sep 17 00:00:00 2001 From: Motschen Date: Tue, 22 Feb 2022 12:44:28 +0100 Subject: [PATCH] Ditch Log4j for future-proofing --- .../java/eu/midnightdust/hats/web/HatLoader.java | 13 +++++-------- .../hats/witch/WitchHatFeatureRenderer.java | 1 - 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/eu/midnightdust/hats/web/HatLoader.java b/src/main/java/eu/midnightdust/hats/web/HatLoader.java index f50732b..79f1f76 100755 --- a/src/main/java/eu/midnightdust/hats/web/HatLoader.java +++ b/src/main/java/eu/midnightdust/hats/web/HatLoader.java @@ -4,9 +4,6 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import net.minecraft.client.MinecraftClient; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import java.io.IOException; import java.io.InputStreamReader; @@ -19,7 +16,7 @@ @SuppressWarnings("UnstableApiUsage") public class HatLoader { - public static final Logger logger = LogManager.getLogger("MidnightLib"); + public static final System.Logger logger = System.getLogger("MidnightLib"); private final static String HATS_URL = "https://raw.githubusercontent.com/TeamMidnightDust/MidnightHats/master/hats.json"; public static final Type HAT_TYPE = new TypeToken>(){}.getType(); public static Map PLAYER_HATS; @@ -31,19 +28,19 @@ public static void init() { try (Reader reader = new InputStreamReader(new URL(HATS_URL).openStream())) { return GSON.>fromJson(reader, HAT_TYPE); } catch (MalformedURLException error) { - logger.log(Level.ERROR, "Unable to load player hats because of connection problems: " + error.getMessage()); + logger.log(System.Logger.Level.ERROR, "Unable to load player hats because of connection problems: " + error.getMessage()); } catch (IOException error) { - logger.log(Level.ERROR, "Unable to load player hats because of an I/O Exception: " + error.getMessage()); + logger.log(System.Logger.Level.ERROR, "Unable to load player hats because of an I/O Exception: " + error.getMessage()); } return null; }).thenAcceptAsync(playerData -> { if (playerData != null) { PLAYER_HATS = playerData; - logger.log(Level.INFO, "Player hats successfully loaded!"); + System.out.println("(MidnightLib) Player hats successfully loaded!"); } else { PLAYER_HATS = Collections.emptyMap(); - logger.log(Level.WARN, "A problem with the database occurred, the hats could not be initialized."); + logger.log(System.Logger.Level.WARNING, "A problem with the database occurred, the hats could not be initialized."); } }, MinecraftClient.getInstance()); } diff --git a/src/main/java/eu/midnightdust/hats/witch/WitchHatFeatureRenderer.java b/src/main/java/eu/midnightdust/hats/witch/WitchHatFeatureRenderer.java index a41069d..da0889e 100755 --- a/src/main/java/eu/midnightdust/hats/witch/WitchHatFeatureRenderer.java +++ b/src/main/java/eu/midnightdust/hats/witch/WitchHatFeatureRenderer.java @@ -1,7 +1,6 @@ package eu.midnightdust.hats.witch; import eu.midnightdust.hats.web.HatLoader; -import eu.midnightdust.lib.config.MidnightConfig; import eu.midnightdust.lib.util.MidnightColorUtil; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment;