Replace remainder sout with logger.

This commit is contained in:
Mike 2020-05-05 00:28:25 +02:00
parent 1bd9db75a6
commit a7946b4adc
7 changed files with 42 additions and 23 deletions

View File

@ -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<String, ConsoleCommand> 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);
}
}
}

View File

@ -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");
}
}

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

@ -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);