diff --git a/common/src/main/java/com/deathmotion/antihealthindicator/AHIPlatform.java b/common/src/main/java/com/deathmotion/antihealthindicator/AHIPlatform.java index d5d8d93..a206cae 100644 --- a/common/src/main/java/com/deathmotion/antihealthindicator/AHIPlatform.java +++ b/common/src/main/java/com/deathmotion/antihealthindicator/AHIPlatform.java @@ -22,7 +22,7 @@ import com.deathmotion.antihealthindicator.managers.CacheManager; import com.deathmotion.antihealthindicator.managers.PacketManager; import com.deathmotion.antihealthindicator.managers.UpdateManager; -import com.deathmotion.antihealthindicator.wrappers.PlatformLoggerWrapperImpl; +import com.deathmotion.antihealthindicator.wrappers.LogManager; import com.deathmotion.antihealthindicator.wrappers.interfaces.Scheduler; import com.github.retrooper.packetevents.PacketEvents; import lombok.Getter; @@ -34,7 +34,7 @@ @Getter public abstract class AHIPlatform

{ - private final PlatformLoggerWrapperImpl loggerWrapper = new PlatformLoggerWrapperImpl(); + private final LogManager logManager = new LogManager(); protected Scheduler scheduler; private CacheManager

cacheManager; diff --git a/common/src/main/java/com/deathmotion/antihealthindicator/managers/UpdateManager.java b/common/src/main/java/com/deathmotion/antihealthindicator/managers/UpdateManager.java index 79e0e3f..524f8b1 100644 --- a/common/src/main/java/com/deathmotion/antihealthindicator/managers/UpdateManager.java +++ b/common/src/main/java/com/deathmotion/antihealthindicator/managers/UpdateManager.java @@ -121,8 +121,8 @@ private void compareVersions(List currentVersion, List latestV private void printUpdateInfo(boolean printToConsole, String formattedVersion) { if (printToConsole) { - platform.getLoggerWrapper().info("Found a new version " + formattedVersion); - platform.getLoggerWrapper().info(GITHUB_RELEASES_URL); + platform.getLogManager().info("Found a new version " + formattedVersion); + platform.getLogManager().info(GITHUB_RELEASES_URL); } if (shouldNotifyInGame()) { @@ -136,10 +136,10 @@ private void printUpdateInfo(boolean printToConsole, String formattedVersion) { * @param e An instance of IOException representing the occurred error. */ private void LogUpdateError(IOException e) { - platform.getLoggerWrapper().error("<--------------------------------------------------------------->"); - platform.getLoggerWrapper().error("Failed to check for a new release!"); - platform.getLoggerWrapper().error("Error message:\n" + e.getMessage()); - platform.getLoggerWrapper().info(GITHUB_RELEASES_URL); - platform.getLoggerWrapper().error("<--------------------------------------------------------------->"); + platform.getLogManager().error("<--------------------------------------------------------------->"); + platform.getLogManager().error("Failed to check for a new release!"); + platform.getLogManager().error("Error message:\n" + e.getMessage()); + platform.getLogManager().info(GITHUB_RELEASES_URL); + platform.getLogManager().error("<--------------------------------------------------------------->"); } } \ No newline at end of file diff --git a/common/src/main/java/com/deathmotion/antihealthindicator/wrappers/PlatformLoggerWrapperImpl.java b/common/src/main/java/com/deathmotion/antihealthindicator/wrappers/LogManager.java similarity index 80% rename from common/src/main/java/com/deathmotion/antihealthindicator/wrappers/PlatformLoggerWrapperImpl.java rename to common/src/main/java/com/deathmotion/antihealthindicator/wrappers/LogManager.java index 3568563..2b35ea2 100644 --- a/common/src/main/java/com/deathmotion/antihealthindicator/wrappers/PlatformLoggerWrapperImpl.java +++ b/common/src/main/java/com/deathmotion/antihealthindicator/wrappers/LogManager.java @@ -18,31 +18,21 @@ package com.deathmotion.antihealthindicator.wrappers; -import com.deathmotion.antihealthindicator.wrappers.interfaces.LoggerWrapper; - import java.util.logging.Logger; -public final class PlatformLoggerWrapperImpl implements LoggerWrapper { +public final class LogManager { private final Logger logger = Logger.getLogger("AntiHealthIndicator"); - @Override public void info(String message) { logger.info(message); } - @Override public void warning(String message) { logger.warning(message); } - @Override public void error(String message) { logger.severe(message); } - - @Override - public void debug(String message) { - logger.fine(message); - } } \ No newline at end of file diff --git a/common/src/main/java/com/deathmotion/antihealthindicator/wrappers/interfaces/LoggerWrapper.java b/common/src/main/java/com/deathmotion/antihealthindicator/wrappers/interfaces/LoggerWrapper.java deleted file mode 100644 index d7401fb..0000000 --- a/common/src/main/java/com/deathmotion/antihealthindicator/wrappers/interfaces/LoggerWrapper.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * This file is part of AntiHealthIndicator - https://github.com/Bram1903/AntiHealthIndicator - * Copyright (C) 2024 Bram and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.deathmotion.antihealthindicator.wrappers.interfaces; - -public interface LoggerWrapper { - - void info(String message); - - void warning(String message); - - void error(String message); - - void debug(String message); - -}