From 2bc4bc34736b3b117c2bd5007f63c8755d83a61b Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Tue, 5 May 2020 03:56:21 +0200 Subject: [PATCH] Added stub for old logger so plugins don't break. --- src/main/java/com/eu/habbo/Emulator.java | 10 ++ src/main/java/com/eu/habbo/core/Logging.java | 97 ++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 src/main/java/com/eu/habbo/core/Logging.java diff --git a/src/main/java/com/eu/habbo/Emulator.java b/src/main/java/com/eu/habbo/Emulator.java index e361e1e5..e5ca801e 100644 --- a/src/main/java/com/eu/habbo/Emulator.java +++ b/src/main/java/com/eu/habbo/Emulator.java @@ -66,6 +66,7 @@ public final class Emulator { private static GameServer gameServer; private static RCONServer rconServer; private static CameraClient cameraClient; + private static Logging logging; private static Database database; private static DatabaseLogger databaseLogger; private static ThreadPooling threading; @@ -100,6 +101,7 @@ public final class Emulator { setBuild(); Emulator.stopped = false; ConsoleCommand.load(); + Emulator.logging = new Logging(); System.out.println(logo); @@ -319,6 +321,14 @@ public final class Emulator { return rconServer; } + /** + * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log. + */ + @Deprecated + public static Logging getLogging() { + return logging; + } + public static ThreadPooling getThreading() { return threading; } diff --git a/src/main/java/com/eu/habbo/core/Logging.java b/src/main/java/com/eu/habbo/core/Logging.java new file mode 100644 index 00000000..b1384a42 --- /dev/null +++ b/src/main/java/com/eu/habbo/core/Logging.java @@ -0,0 +1,97 @@ +package com.eu.habbo.core; + +import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.sql.SQLException; + +public class Logging { + + private static final Logger LOGGER = LoggerFactory.getLogger("LegacyLogger"); + + /** + * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log. + */ + @Deprecated + public void logStart(Object line) { + LOGGER.info("[LOADING] {}", line); + } + + /** + * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log. + */ + @Deprecated + public void logShutdownLine(Object line) { + LOGGER.info("[SHUTDOWN] {}", line); + } + + /** + * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log. + */ + @Deprecated + public void logUserLine(Object line) { + LOGGER.info("[USER] {}", line); + } + + /** + * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log. + */ + @Deprecated + public void logDebugLine(Object line) { + LOGGER.debug("[DEBUG] {}", line); + } + + /** + * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log. + */ + @Deprecated + public void logPacketLine(Object line) { + if (Emulator.getConfig().getBoolean("debug.show.packets")) { + LOGGER.debug("[PACKET] {}", line); + } + } + + /** + * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log. + */ + @Deprecated + public void logUndefinedPacketLine(Object line) { + if (Emulator.getConfig().getBoolean("debug.show.packets.undefined")) { + LOGGER.debug("[PACKET] [UNDEFINED] {}", line); + } + } + + /** + * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log. + */ + @Deprecated + public void logErrorLine(Object line) { + LOGGER.error("[ERROR] {}", line); + } + + /** + * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log. + */ + @Deprecated + public void logSQLException(SQLException e) { + LOGGER.error("[ERROR] SQLException", e); + } + + /** + * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log. + */ + @Deprecated + public void logPacketError(Object e) { + LOGGER.error("[ERROR] PacketError {}", e); + } + + /** + * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log. + */ + @Deprecated + public void handleException(Exception e) { + LOGGER.error("[ERROR] Exception", e); + } + +}