From a7946b4adcce7c496c3298a62da22321d46687e4 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Tue, 5 May 2020 00:28:25 +0200 Subject: [PATCH] Replace remainder sout with logger. --- .../core/consolecommands/ConsoleCommand.java | 7 ++-- .../consolecommands/ConsoleInfoCommand.java | 32 +++++++++++-------- .../ConsoleReconnectCameraCommand.java | 6 +++- .../consolecommands/ConsoleTestCommand.java | 6 +++- .../ShowInteractionsCommand.java | 6 +++- .../consolecommands/ShowRCONCommands.java | 6 +++- .../teleport/TeleportActionThree.java | 2 +- 7 files changed, 42 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java index 43aa98d0..23604f3e 100644 --- a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java +++ b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java @@ -5,7 +5,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public abstract class ConsoleCommand { - private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleCommand.class); private static final THashMap commands = new THashMap<>(); @@ -48,11 +47,11 @@ public abstract class ConsoleCommand { LOGGER.error("Caught exception", e); } } else { - System.out.println("Unknown Console Command " + message[0]); - System.out.println("Commands Available (" + commands.size() + "): "); + LOGGER.info("Unknown Console Command " + message[0]); + LOGGER.info("Commands Available (" + commands.size() + "): "); for (ConsoleCommand c : commands.values()) { - System.out.println(c.key + " - " + c.usage); + LOGGER.info(c.key + " - " + c.usage); } } } diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java index c36f82bf..db7c22bf 100644 --- a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java +++ b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java @@ -2,10 +2,14 @@ package com.eu.habbo.core.consolecommands; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.catalog.CatalogManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.concurrent.TimeUnit; public class ConsoleInfoCommand extends ConsoleCommand { + private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleInfoCommand.class); + public ConsoleInfoCommand() { super("info", "Show current statistics."); } @@ -18,21 +22,21 @@ public class ConsoleInfoCommand extends ConsoleCommand { long minute = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60); long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) * 60); - System.out.println("Emulator version: " + Emulator.version); - System.out.println("Emulator build: " + Emulator.build); + LOGGER.info("Emulator version: " + Emulator.version); + LOGGER.info("Emulator build: " + Emulator.build); - System.out.println(""); + LOGGER.info(""); - System.out.println("Hotel Statistics"); - System.out.println("- Users: " + Emulator.getGameEnvironment().getHabboManager().getOnlineCount()); - System.out.println("- Rooms: " + Emulator.getGameEnvironment().getRoomManager().getActiveRooms().size()); - System.out.println("- Shop: " + Emulator.getGameEnvironment().getCatalogManager().catalogPages.size() + " pages and " + CatalogManager.catalogItemAmount + " items."); - System.out.println("- Furni: " + Emulator.getGameEnvironment().getItemManager().getItems().size() + " items."); - System.out.println(""); - System.out.println("Server Statistics"); - System.out.println("- Uptime: " + day + (day > 1 ? " days, " : " day, ") + hours + (hours > 1 ? " hours, " : " hour, ") + minute + (minute > 1 ? " minutes, " : " minute, ") + second + (second > 1 ? " seconds!" : " second!")); - System.out.println("- RAM Usage: " + (Emulator.getRuntime().totalMemory() - Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "/" + (Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "MB"); - System.out.println("- CPU Cores: " + Emulator.getRuntime().availableProcessors()); - System.out.println("- Total Memory: " + Emulator.getRuntime().maxMemory() / (1024 * 1024) + "MB"); + LOGGER.info("Hotel Statistics"); + LOGGER.info("- Users: " + Emulator.getGameEnvironment().getHabboManager().getOnlineCount()); + LOGGER.info("- Rooms: " + Emulator.getGameEnvironment().getRoomManager().getActiveRooms().size()); + LOGGER.info("- Shop: " + Emulator.getGameEnvironment().getCatalogManager().catalogPages.size() + " pages and " + CatalogManager.catalogItemAmount + " items."); + LOGGER.info("- Furni: " + Emulator.getGameEnvironment().getItemManager().getItems().size() + " items."); + LOGGER.info(""); + LOGGER.info("Server Statistics"); + LOGGER.info("- Uptime: " + day + (day > 1 ? " days, " : " day, ") + hours + (hours > 1 ? " hours, " : " hour, ") + minute + (minute > 1 ? " minutes, " : " minute, ") + second + (second > 1 ? " seconds!" : " second!")); + LOGGER.info("- RAM Usage: " + (Emulator.getRuntime().totalMemory() - Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "/" + (Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "MB"); + LOGGER.info("- CPU Cores: " + Emulator.getRuntime().availableProcessors()); + LOGGER.info("- Total Memory: " + Emulator.getRuntime().maxMemory() / (1024 * 1024) + "MB"); } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleReconnectCameraCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleReconnectCameraCommand.java index 0520a5e3..587130d1 100644 --- a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleReconnectCameraCommand.java +++ b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleReconnectCameraCommand.java @@ -1,15 +1,19 @@ package com.eu.habbo.core.consolecommands; import com.eu.habbo.networking.camera.CameraClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ConsoleReconnectCameraCommand extends ConsoleCommand { + private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleReconnectCameraCommand.class); + public ConsoleReconnectCameraCommand() { super("camera", "Attempt to reconnect to the camera server."); } @Override public void handle(String[] args) throws Exception { - System.out.println("Connecting to the camera..."); + LOGGER.info("Connecting to the camera..."); CameraClient.attemptReconnect = true; } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleTestCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleTestCommand.java index d40fb13e..cd02b90c 100644 --- a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleTestCommand.java +++ b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleTestCommand.java @@ -3,8 +3,12 @@ package com.eu.habbo.core.consolecommands; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.Habbo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ConsoleTestCommand extends ConsoleCommand { + private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleTestCommand.class); + public ConsoleTestCommand() { super("test", "This is just a test."); } @@ -12,7 +16,7 @@ public class ConsoleTestCommand extends ConsoleCommand { @Override public void handle(String[] args) throws Exception { if (Emulator.debugging) { - System.out.println("This is a test command for live debugging."); + LOGGER.info("This is a test command for live debugging."); //AchievementManager.progressAchievement(4, Emulator.getGameEnvironment().getAchievementManager().getAchievement("AllTimeHotelPresence"), 30); diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ShowInteractionsCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ShowInteractionsCommand.java index 9aa6eee9..e8487a92 100644 --- a/src/main/java/com/eu/habbo/core/consolecommands/ShowInteractionsCommand.java +++ b/src/main/java/com/eu/habbo/core/consolecommands/ShowInteractionsCommand.java @@ -1,8 +1,12 @@ package com.eu.habbo.core.consolecommands; import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ShowInteractionsCommand extends ConsoleCommand { + private static final Logger LOGGER = LoggerFactory.getLogger(ShowInteractionsCommand.class); + public ShowInteractionsCommand() { super("interactions", "Show a list of available furniture interactions."); } @@ -10,7 +14,7 @@ public class ShowInteractionsCommand extends ConsoleCommand { @Override public void handle(String[] args) throws Exception { for (String interaction : Emulator.getGameEnvironment().getItemManager().getInteractionList()) { - System.out.println(interaction); + LOGGER.info(interaction); } } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ShowRCONCommands.java b/src/main/java/com/eu/habbo/core/consolecommands/ShowRCONCommands.java index a7df7bf3..821d2f1f 100644 --- a/src/main/java/com/eu/habbo/core/consolecommands/ShowRCONCommands.java +++ b/src/main/java/com/eu/habbo/core/consolecommands/ShowRCONCommands.java @@ -1,8 +1,12 @@ package com.eu.habbo.core.consolecommands; import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ShowRCONCommands extends ConsoleCommand { + private static final Logger LOGGER = LoggerFactory.getLogger(ShowRCONCommands.class); + public ShowRCONCommands() { super("rconcommands", "Show a list of all RCON commands"); } @@ -10,7 +14,7 @@ public class ShowRCONCommands extends ConsoleCommand { @Override public void handle(String[] args) throws Exception { for (String command : Emulator.getRconServer().getCommands()) { - System.out.println(command); + LOGGER.info(command); } } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionThree.java b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionThree.java index 036ce89c..8289a1b6 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionThree.java +++ b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionThree.java @@ -66,7 +66,7 @@ class TeleportActionThree implements Runnable { targetTeleport.setExtradata("2"); targetRoom.updateItem(targetTeleport); //targetRoom.updateHabbo(this.client.getHabbo()); - //System.out.println(targetTeleport.getX() + " | " + targetTeleport.getY()); + //LOGGER.info((targetTeleport.getX() + " | " + targetTeleport.getY()); this.client.getHabbo().getHabboInfo().setCurrentRoom(targetRoom); //Emulator.getThreading().run(new HabboItemNewState(this.currentTeleport, this.room, "0"), 500); Emulator.getThreading().run(new TeleportActionFour(targetTeleport, targetRoom, this.client), this.currentTeleport instanceof InteractionTeleportTile ? 0 : 500);