Merge branch 'feature/rework-logging' into 'new-logging'

Rework logging, upgrade dependencies and remove unused dependencies

See merge request morningstar/Arcturus-Community!139
This commit is contained in:
Harmonic 2020-05-08 17:19:14 -04:00
commit e96c9492a4
217 changed files with 1969 additions and 1336 deletions

1
.gitignore vendored
View File

@ -6,7 +6,6 @@ target/**
TODO.txt TODO.txt
packet.pkt packet.pkt
plugins/** plugins/**
src/main/resources/
src/test/ src/test/
target/ target/
config.ini config.ini

72
pom.xml
View File

@ -32,7 +32,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version> <version>3.8.1</version>
<configuration> <configuration>
<source>1.8</source> <source>1.8</source>
<target>1.8</target> <target>1.8</target>
@ -42,7 +42,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId> <artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version> <version>3.3.0</version>
<configuration> <configuration>
<descriptorRefs> <descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef> <descriptorRef>jar-with-dependencies</descriptorRef>
@ -67,7 +67,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0</version> <version>3.2.0</version>
<configuration> <configuration>
<additionalOptions><additionalOption>-Xdoclint:none</additionalOption></additionalOptions> <additionalOptions><additionalOption>-Xdoclint:none</additionalOption></additionalOptions>
<show>public</show> <show>public</show>
@ -92,50 +92,21 @@
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-all</artifactId> <artifactId>netty-all</artifactId>
<version>4.1.36.Final</version> <version>4.1.49.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.fusesource.jansi/jansi -->
<dependency>
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
<version>1.18</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http</artifactId>
<version>4.1.36.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http2</artifactId>
<version>4.1.36.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
<version>4.1.36.Final</version>
<scope>compile</scope>
</dependency> </dependency>
<!-- GSON --> <!-- GSON -->
<dependency> <dependency>
<groupId>com.google.code.gson</groupId> <groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId> <artifactId>gson</artifactId>
<version>2.8.4</version> <version>2.8.6</version>
</dependency> </dependency>
<!-- MySQL Connector --> <!-- MySQL Connector -->
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<version>5.1.46</version> <version>5.1.49</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
@ -151,16 +122,17 @@
<dependency> <dependency>
<groupId>com.zaxxer</groupId> <groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId> <artifactId>HikariCP</artifactId>
<version>3.1.0</version> <version>3.4.3</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
<version>3.7</version> <version>3.10</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId> <artifactId>commons-math3</artifactId>
@ -171,35 +143,27 @@
<dependency> <dependency>
<groupId>org.jsoup</groupId> <groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId> <artifactId>jsoup</artifactId>
<version>1.11.3</version> <version>1.13.1</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>ch.qos.logback</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>logback-classic</artifactId>
<version>1.7.25</version> <version>1.2.3</version>
<scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.fusesource.jansi</groupId>
<artifactId>slf4j-simple</artifactId> <artifactId>jansi</artifactId>
<version>1.7.25</version> <version>1.18</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>joda-time</groupId> <groupId>joda-time</groupId>
<artifactId>joda-time</artifactId> <artifactId>joda-time</artifactId>
<version>2.9.9</version> <version>2.10.6</version>
</dependency> </dependency>
</dependencies> </dependencies>
<distributionManagement>
<repository>
<id>internal.repo</id>
<name>Internal repo</name>
<url>file:///home/thara/testesb/in</url>
</repository>
</distributionManagement>
</project> </project>

View File

@ -1,5 +1,8 @@
package com.eu.habbo; package com.eu.habbo;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.ConsoleAppender;
import com.eu.habbo.core.*; import com.eu.habbo.core.*;
import com.eu.habbo.core.consolecommands.ConsoleCommand; import com.eu.habbo.core.consolecommands.ConsoleCommand;
import com.eu.habbo.database.Database; import com.eu.habbo.database.Database;
@ -14,7 +17,8 @@ import com.eu.habbo.plugin.events.emulator.EmulatorStartShutdownEvent;
import com.eu.habbo.plugin.events.emulator.EmulatorStoppedEvent; import com.eu.habbo.plugin.events.emulator.EmulatorStoppedEvent;
import com.eu.habbo.threading.ThreadPooling; import com.eu.habbo.threading.ThreadPooling;
import com.eu.habbo.util.imager.badges.BadgeImager; import com.eu.habbo.util.imager.badges.BadgeImager;
import org.fusesource.jansi.AnsiConsole; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*; import java.io.*;
import java.security.MessageDigest; import java.security.MessageDigest;
@ -23,20 +27,19 @@ import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Locale; import java.util.Locale;
import java.util.Random; import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
public final class Emulator { public final class Emulator {
private static final Logger LOGGER = LoggerFactory.getLogger(Emulator.class);
private static final String OS_NAME = System.getProperty("os.name");
private static final String CLASS_PATH = System.getProperty("java.class.path");
public final static int MAJOR = 2; public final static int MAJOR = 2;
public final static int MINOR = 4; public final static int MINOR = 4;
public final static int BUILD = 0; public final static int BUILD = 0;
public static final String ANSI_RED = "\u001B[31m";
public static final String ANSI_BLUE = "\u001B[34m";
public static final String ANSI_PURPLE = "\u001B[35m";
public static final String ANSI_WHITE = "\u001B[37m";
public static final String ANSI_YELLOW = "\u001B[33m";
// This Build of 2.4.0 will not be released anytime soon. :)
// This Build of 2.4.0 will not be released anytime soon. :)
public final static String PREVIEW = "RC-1"; public final static String PREVIEW = "RC-1";
public static final String version = "Arcturus Morningstar" + " " + MAJOR + "." + MINOR + "." + BUILD + "-" + PREVIEW; public static final String version = "Arcturus Morningstar" + " " + MAJOR + "." + MINOR + "." + BUILD + "-" + PREVIEW;
@ -55,8 +58,6 @@ public final class Emulator {
public static boolean isShuttingDown = false; public static boolean isShuttingDown = false;
public static boolean stopped = false; public static boolean stopped = false;
public static boolean debugging = false; public static boolean debugging = false;
private static String classPath = System.getProperty("java.class.path");
private static String osName = System.getProperty("os.name");
private static int timeStarted = 0; private static int timeStarted = 0;
private static Runtime runtime; private static Runtime runtime;
private static ConfigurationManager config; private static ConfigurationManager config;
@ -65,12 +66,12 @@ public final class Emulator {
private static GameServer gameServer; private static GameServer gameServer;
private static RCONServer rconServer; private static RCONServer rconServer;
private static CameraClient cameraClient; private static CameraClient cameraClient;
private static Database database;
private static Logging logging; private static Logging logging;
private static Database database;
private static DatabaseLogger databaseLogger;
private static ThreadPooling threading; private static ThreadPooling threading;
private static GameEnvironment gameEnvironment; private static GameEnvironment gameEnvironment;
private static PluginManager pluginManager; private static PluginManager pluginManager;
private static Random random;
private static BadgeImager badgeImager; private static BadgeImager badgeImager;
static { static {
@ -85,21 +86,31 @@ public final class Emulator {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
try { try {
if (osName.startsWith("Windows") && (!classPath.contains("idea_rt.jar"))) { // Check if running on Windows and not in IntelliJ.
AnsiConsole.systemInstall(); // If so, we need to reconfigure the console appender and enable Jansi for colors.
if (OS_NAME.startsWith("Windows") && !CLASS_PATH.contains("idea_rt.jar")) {
ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
ConsoleAppender<ILoggingEvent> appender = (ConsoleAppender<ILoggingEvent>) root.getAppender("Console");
appender.stop();
appender.setWithJansi(true);
appender.start();
} }
Locale.setDefault(new Locale("en")); Locale.setDefault(new Locale("en"));
setBuild(); setBuild();
Emulator.stopped = false; Emulator.stopped = false;
ConsoleCommand.load(); ConsoleCommand.load();
Emulator.logging = new Logging(); Emulator.logging = new Logging();
System.out.println(ANSI_PURPLE + logo );
System.out.println(ANSI_WHITE + "This project is for educational purposes only. This Emulator is an open-source fork of Arcturus created by TheGeneral."); System.out.println(logo);
System.out.println(ANSI_BLUE + "[VERSION] " + ANSI_WHITE + version);
System.out.println(ANSI_RED + "[BUILD] " + ANSI_WHITE + build + "\n"); LOGGER.info("This project is for educational purposes only. This Emulator is an open-source fork of Arcturus created by TheGeneral.");
System.out.println(ANSI_YELLOW + "[KREWS] " + ANSI_WHITE + "Remember to sign up your hotel to join our toplist beta at https://bit.ly/2NN0rxq" ); LOGGER.info("Version: {}", version);
System.out.println(ANSI_YELLOW + "[KREWS] " + ANSI_WHITE + "Join our discord at https://discord.gg/syuqgN" + "\n"); LOGGER.info("Build: {}", build);
random = new Random(); LOGGER.info("Remember to sign up your hotel to join our toplist beta at https://bit.ly/2NN0rxq");
LOGGER.info("Join our discord at https://discord.gg/syuqgN");
long startTime = System.nanoTime(); long startTime = System.nanoTime();
Emulator.runtime = Runtime.getRuntime(); Emulator.runtime = Runtime.getRuntime();
@ -110,6 +121,7 @@ public final class Emulator {
Emulator.getConfig().getValue("enc.n"), Emulator.getConfig().getValue("enc.n"),
Emulator.getConfig().getValue("enc.d")); Emulator.getConfig().getValue("enc.d"));
Emulator.database = new Database(Emulator.getConfig()); Emulator.database = new Database(Emulator.getConfig());
Emulator.databaseLogger = new DatabaseLogger();
Emulator.config.loaded = true; Emulator.config.loaded = true;
Emulator.config.loadFromDatabase(); Emulator.config.loadFromDatabase();
Emulator.threading = new ThreadPooling(Emulator.getConfig().getInt("runtime.threads")); Emulator.threading = new ThreadPooling(Emulator.getConfig().getInt("runtime.threads"));
@ -129,13 +141,17 @@ public final class Emulator {
Emulator.rconServer.initializePipeline(); Emulator.rconServer.initializePipeline();
Emulator.rconServer.connect(); Emulator.rconServer.connect();
Emulator.badgeImager = new BadgeImager(); Emulator.badgeImager = new BadgeImager();
Emulator.getLogging().logStart("Arcturus Morningstar has succesfully loaded. You're running: " + Emulator.version);
Emulator.getLogging().logStart("System launched in: " + (System.nanoTime() - startTime) / 1e6 + "ms. Using: " + (Runtime.getRuntime().availableProcessors() * 2) + " threads!"); LOGGER.info("Arcturus Morningstar has succesfully loaded.");
Emulator.getLogging().logStart("Memory: " + (runtime.totalMemory() - runtime.freeMemory()) / (1024 * 1024) + "/" + (runtime.freeMemory()) / (1024 * 1024) + "MB"); LOGGER.info("System launched in: {}ms. Using {} threads!", (System.nanoTime() - startTime) / 1e6, Runtime.getRuntime().availableProcessors() * 2);
LOGGER.info("Memory: {}/{}MB", (runtime.totalMemory() - runtime.freeMemory()) / (1024 * 1024), (runtime.freeMemory()) / (1024 * 1024));
Emulator.debugging = Emulator.getConfig().getBoolean("debug.mode"); Emulator.debugging = Emulator.getConfig().getBoolean("debug.mode");
if (debugging) { if (debugging) {
Emulator.getLogging().logDebugLine("Debugging Enabled!"); ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
root.setLevel(Level.DEBUG);
LOGGER.debug("Debugging enabled.");
} }
Emulator.getPluginManager().fireEvent(new EmulatorLoadedEvent()); Emulator.getPluginManager().fireEvent(new EmulatorLoadedEvent());
@ -143,7 +159,9 @@ public final class Emulator {
Emulator.timeStarted = getIntUnixTimestamp(); Emulator.timeStarted = getIntUnixTimestamp();
if (Emulator.getConfig().getInt("runtime.threads") < (Runtime.getRuntime().availableProcessors() * 2)) { if (Emulator.getConfig().getInt("runtime.threads") < (Runtime.getRuntime().availableProcessors() * 2)) {
Emulator.getLogging().logStart("Emulator settings runtime.threads (" + Emulator.getConfig().getInt("runtime.threads") + ") can be increased to " + (Runtime.getRuntime().availableProcessors() * 2) + " to possibly increase performance."); LOGGER.warn("Emulator settings runtime.threads ({}) can be increased to {} to possibly increase performance.",
Emulator.getConfig().getInt("runtime.threads"),
Runtime.getRuntime().availableProcessors() * 2);
} }
@ -154,7 +172,6 @@ public final class Emulator {
while (!isShuttingDown && isReady) { while (!isShuttingDown && isReady) {
try { try {
String line = reader.readLine(); String line = reader.readLine();
if (line != null) { if (line != null) {
@ -163,7 +180,7 @@ public final class Emulator {
System.out.println("Waiting for command: "); System.out.println("Waiting for command: ");
} catch (Exception e) { } catch (Exception e) {
if (!(e instanceof IOException && e.getMessage().equals("Bad file descriptor"))) { if (!(e instanceof IOException && e.getMessage().equals("Bad file descriptor"))) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Error while reading command", e);
} }
} }
} }
@ -199,11 +216,12 @@ public final class Emulator {
} }
private static void dispose() { private static void dispose() {
Emulator.getThreading().setCanAdd(false); Emulator.getThreading().setCanAdd(false);
Emulator.isShuttingDown = true; Emulator.isShuttingDown = true;
Emulator.isReady = false; Emulator.isReady = false;
Emulator.getLogging().logShutdownLine("Stopping Arcturus Emulator " + version + "...");
LOGGER.info("Stopping Arcturus Morningstar {}", version);
try { try {
if (Emulator.getPluginManager() != null) if (Emulator.getPluginManager() != null)
Emulator.getPluginManager().fireEvent(new EmulatorStartShutdownEvent()); Emulator.getPluginManager().fireEvent(new EmulatorStartShutdownEvent());
@ -222,7 +240,6 @@ public final class Emulator {
} catch (Exception e) { } catch (Exception e) {
} }
try { try {
if (Emulator.gameEnvironment != null) if (Emulator.gameEnvironment != null)
Emulator.gameEnvironment.dispose(); Emulator.gameEnvironment.dispose();
@ -241,8 +258,6 @@ public final class Emulator {
} catch (Exception e) { } catch (Exception e) {
} }
Emulator.getLogging().saveLogs();
try { try {
if (Emulator.config != null) { if (Emulator.config != null) {
Emulator.config.saveToDatabase(); Emulator.config.saveToDatabase();
@ -255,16 +270,17 @@ public final class Emulator {
Emulator.gameServer.stop(); Emulator.gameServer.stop();
} catch (Exception e) { } catch (Exception e) {
} }
Emulator.getLogging().logShutdownLine("Stopped Arcturus Emulator " + version + "...");
LOGGER.info("Stopped Arcturus Morningstar {}", version);
if (Emulator.database != null) { if (Emulator.database != null) {
Emulator.getDatabase().dispose(); Emulator.getDatabase().dispose();
} }
Emulator.stopped = true; Emulator.stopped = true;
if (osName.startsWith("Windows") && (!classPath.contains("idea_rt.jar"))) { // if (osName.startsWith("Windows") && (!classPath.contains("idea_rt.jar"))) {
AnsiConsole.systemUninstall(); // AnsiConsole.systemUninstall();
} // }
try { try {
if (Emulator.threading != null) if (Emulator.threading != null)
@ -289,6 +305,10 @@ public final class Emulator {
return database; return database;
} }
public static DatabaseLogger getDatabaseLogger() {
return databaseLogger;
}
public static Runtime getRuntime() { public static Runtime getRuntime() {
return runtime; return runtime;
} }
@ -301,6 +321,10 @@ public final class Emulator {
return rconServer; return rconServer;
} }
/**
* @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
*/
@Deprecated
public static Logging getLogging() { public static Logging getLogging() {
return logging; return logging;
} }
@ -318,7 +342,7 @@ public final class Emulator {
} }
public static Random getRandom() { public static Random getRandom() {
return random; return ThreadLocalRandom.current();
} }
public static BadgeImager getBadgeImager() { public static BadgeImager getBadgeImager() {
@ -361,7 +385,7 @@ public final class Emulator {
try { try {
res = format.parse(date); res = format.parse(date);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Error parsing date", e);
} }
return res; return res;
} }

View File

@ -6,6 +6,8 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.incoming.friends.SearchUserEvent; import com.eu.habbo.messages.incoming.friends.SearchUserEvent;
import com.eu.habbo.messages.incoming.navigator.SearchRoomsEvent; import com.eu.habbo.messages.incoming.navigator.SearchRoomsEvent;
import com.eu.habbo.threading.runnables.AchievementUpdater; import com.eu.habbo.threading.runnables.AchievementUpdater;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -15,57 +17,26 @@ import java.util.Map;
public class CleanerThread implements Runnable { public class CleanerThread implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(CleanerThread.class);
public static final int DELAY = 10000; private static final int DELAY = 10000;
private static final int RELOAD_HALL_OF_FAME = 1800;
private static final int RELOAD_NEWS_LIST = 3600;
public static final int RELOAD_HALL_OF_FAME = 1800; private static final int REMOVE_INACTIVE_ROOMS = 120;
private static final int REMOVE_INACTIVE_GUILDS = 60;
private static final int REMOVE_INACTIVE_TOURS = 600;
public static final int RELOAD_NEWS_LIST = 3600; private static final int SAVE_ERROR_LOGS = 30;
private static final int CLEAR_CACHED_VALUES = 60 * 60;
public static final int REMOVE_INACTIVE_ROOMS = 120;
public static final int REMOVE_INACTIVE_GUILDS = 60;
public static final int REMOVE_INACTIVE_TOURS = 600;
public static final int SAVE_ERROR_LOGS = 30;
public static final int CLEAR_CACHED_VALUES = 60 * 60;
private static final int CALLBACK_TIME = 60 * 15; private static final int CALLBACK_TIME = 60 * 15;
private static int LAST_HOF_RELOAD = Emulator.getIntUnixTimestamp(); private static int LAST_HOF_RELOAD = Emulator.getIntUnixTimestamp();
private static int LAST_NL_RELOAD = Emulator.getIntUnixTimestamp(); private static int LAST_NL_RELOAD = Emulator.getIntUnixTimestamp();
private static int LAST_INACTIVE_ROOMS_CLEARED = Emulator.getIntUnixTimestamp(); private static int LAST_INACTIVE_ROOMS_CLEARED = Emulator.getIntUnixTimestamp();
private static int LAST_INACTIVE_GUILDS_CLEARED = Emulator.getIntUnixTimestamp(); private static int LAST_INACTIVE_GUILDS_CLEARED = Emulator.getIntUnixTimestamp();
private static int LAST_INACTIVE_TOURS_CLEARED = Emulator.getIntUnixTimestamp(); private static int LAST_INACTIVE_TOURS_CLEARED = Emulator.getIntUnixTimestamp();
private static int LAST_ERROR_LOGS_SAVED = Emulator.getIntUnixTimestamp(); private static int LAST_ERROR_LOGS_SAVED = Emulator.getIntUnixTimestamp();
private static int LAST_DAILY_REFILL = Emulator.getIntUnixTimestamp(); private static int LAST_DAILY_REFILL = Emulator.getIntUnixTimestamp();
private static int LAST_CALLBACK = Emulator.getIntUnixTimestamp(); private static int LAST_CALLBACK = Emulator.getIntUnixTimestamp();
private static int LAST_HABBO_CACHE_CLEARED = Emulator.getIntUnixTimestamp(); private static int LAST_HABBO_CACHE_CLEARED = Emulator.getIntUnixTimestamp();
public CleanerThread() { public CleanerThread() {
@ -110,7 +81,7 @@ public class CleanerThread implements Runnable {
} }
if (time - LAST_ERROR_LOGS_SAVED > SAVE_ERROR_LOGS) { if (time - LAST_ERROR_LOGS_SAVED > SAVE_ERROR_LOGS) {
Emulator.getLogging().saveLogs(); Emulator.getDatabaseLogger().save();
LAST_ERROR_LOGS_SAVED = time; LAST_ERROR_LOGS_SAVED = time;
} }
@ -156,9 +127,10 @@ public class CleanerThread implements Runnable {
statement.execute("DELETE FROM users_effects WHERE total <= 0"); statement.execute("DELETE FROM users_effects WHERE total <= 0");
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
Emulator.getLogging().logStart("Database -> Cleaned!");
LOGGER.info("Database -> Cleaned!");
} }
public void refillDailyRespects() { public void refillDailyRespects() {
@ -167,7 +139,7 @@ public class CleanerThread implements Runnable {
statement.setInt(2, Emulator.getConfig().getInt("hotel.daily.respect.pets")); statement.setInt(2, Emulator.getConfig().getInt("hotel.daily.respect.pets"));
statement.executeUpdate(); statement.executeUpdate();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
if (Emulator.isReady) { if (Emulator.isReady) {
@ -188,7 +160,7 @@ public class CleanerThread implements Runnable {
habbo.clearCaches(); habbo.clearCaches();
} }
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
} }

View File

@ -6,8 +6,9 @@ import com.eu.habbo.habbohotel.commands.Command;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
public class CommandLog implements Loggable { public class CommandLog implements DatabaseLoggable {
public static final String insertQuery = "INSERT INTO commandlogs (`user_id`, `timestamp`, `command`, `params`, `succes`) VALUES (?, ?, ?, ?, ?)";
private static final String INSERT_QUERY = "INSERT INTO commandlogs (`user_id`, `timestamp`, `command`, `params`, `succes`) VALUES (?, ?, ?, ?, ?)";
private final int userId; private final int userId;
private final int timestamp = Emulator.getIntUnixTimestamp(); private final int timestamp = Emulator.getIntUnixTimestamp();
@ -15,7 +16,6 @@ public class CommandLog implements Loggable {
private final String params; private final String params;
private final boolean succes; private final boolean succes;
public CommandLog(int userId, Command command, String params, boolean succes) { public CommandLog(int userId, Command command, String params, boolean succes) {
this.userId = userId; this.userId = userId;
this.command = command; this.command = command;
@ -23,6 +23,11 @@ public class CommandLog implements Loggable {
this.succes = succes; this.succes = succes;
} }
@Override
public String getQuery() {
return CommandLog.INSERT_QUERY;
}
@Override @Override
public void log(PreparedStatement statement) throws SQLException { public void log(PreparedStatement statement) throws SQLException {
statement.setInt(1, this.userId); statement.setInt(1, this.userId);
@ -32,4 +37,5 @@ public class CommandLog implements Loggable {
statement.setString(5, this.succes ? "yes" : "no"); statement.setString(5, this.succes ? "yes" : "no");
statement.addBatch(); statement.addBatch();
} }
} }

View File

@ -3,6 +3,8 @@ package com.eu.habbo.core;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.plugin.events.emulator.EmulatorConfigUpdatedEvent; import com.eu.habbo.plugin.events.emulator.EmulatorConfigUpdatedEvent;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
@ -14,6 +16,8 @@ import java.util.Properties;
public class ConfigurationManager { public class ConfigurationManager {
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationManager.class);
private final Properties properties; private final Properties properties;
private final String configurationPath; private final String configurationPath;
public boolean loaded = false; public boolean loaded = false;
@ -25,7 +29,6 @@ public class ConfigurationManager {
this.reload(); this.reload();
} }
public void reload() { public void reload() {
this.isLoading = true; this.isLoading = true;
this.properties.clear(); this.properties.clear();
@ -43,7 +46,7 @@ public class ConfigurationManager {
this.properties.load(input); this.properties.load(input);
} catch (IOException ex) { } catch (IOException ex) {
Emulator.getLogging().logErrorLine("[CRITICAL] FAILED TO LOAD CONFIG FILE! (" + this.configurationPath + ")"); LOGGER.error("Failed to load config file.", ex);
ex.printStackTrace(); ex.printStackTrace();
} finally { } finally {
if (input != null) { if (input != null) {
@ -80,35 +83,31 @@ public class ConfigurationManager {
envMapping.put("runtime.threads", "RT_THREADS"); envMapping.put("runtime.threads", "RT_THREADS");
envMapping.put("logging.errors.runtime", "RT_LOG_ERRORS"); envMapping.put("logging.errors.runtime", "RT_LOG_ERRORS");
for (Map.Entry<String, String> entry : envMapping.entrySet()) { for (Map.Entry<String, String> entry : envMapping.entrySet()) {
String envValue = System.getenv(entry.getValue()); String envValue = System.getenv(entry.getValue());
if (envValue == null || envValue.length() == 0) { if (envValue == null || envValue.length() == 0) {
Emulator.getLogging().logStart("Cannot find environment-value for variable `" + entry.getValue() + "`"); LOGGER.info("Cannot find environment-value for variable `" + entry.getValue() + "`");
} else { } else {
this.properties.setProperty(entry.getKey(), envValue); this.properties.setProperty(entry.getKey(), envValue);
} }
} }
} }
if (this.loaded) { if (this.loaded) {
this.loadFromDatabase(); this.loadFromDatabase();
} }
this.isLoading = false; this.isLoading = false;
Emulator.getLogging().logStart("Configuration Manager -> Loaded!"); LOGGER.info("Configuration Manager -> Loaded!");
if (Emulator.getPluginManager() != null) { if (Emulator.getPluginManager() != null) {
Emulator.getPluginManager().fireEvent(new EmulatorConfigUpdatedEvent()); Emulator.getPluginManager().fireEvent(new EmulatorConfigUpdatedEvent());
} }
} }
public void loadFromDatabase() { public void loadFromDatabase() {
Emulator.getLogging().logStart("Loading configuration from database..."); LOGGER.info("Loading configuration from database...");
long millis = System.currentTimeMillis(); long millis = System.currentTimeMillis();
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement()) { try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement()) {
@ -120,10 +119,10 @@ public class ConfigurationManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
Emulator.getLogging().logStart("Configuration -> loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); LOGGER.info("Configuration -> loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
} }
public void saveToDatabase() { public void saveToDatabase() {
@ -134,7 +133,7 @@ public class ConfigurationManager {
statement.executeUpdate(); statement.executeUpdate();
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -149,17 +148,15 @@ public class ConfigurationManager {
return defaultValue; return defaultValue;
if (!this.properties.containsKey(key)) { if (!this.properties.containsKey(key)) {
Emulator.getLogging().logErrorLine("[CONFIG] Key not found: " + key); LOGGER.error("Config key not found {}", key);
} }
return this.properties.getProperty(key, defaultValue); return this.properties.getProperty(key, defaultValue);
} }
public boolean getBoolean(String key) { public boolean getBoolean(String key) {
return this.getBoolean(key, false); return this.getBoolean(key, false);
} }
public boolean getBoolean(String key, boolean defaultValue) { public boolean getBoolean(String key, boolean defaultValue) {
if (this.isLoading) if (this.isLoading)
return defaultValue; return defaultValue;
@ -167,17 +164,15 @@ public class ConfigurationManager {
try { try {
return (this.getValue(key, "0").equals("1")) || (this.getValue(key, "false").equals("true")); return (this.getValue(key, "0").equals("1")) || (this.getValue(key, "false").equals("true"));
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine("Failed to parse key " + key + " with value " + this.getValue(key) + " to type boolean."); LOGGER.error("Failed to parse key {} with value '{}' to type boolean.", key, this.getValue(key));
} }
return defaultValue; return defaultValue;
} }
public int getInt(String key) { public int getInt(String key) {
return this.getInt(key, 0); return this.getInt(key, 0);
} }
public int getInt(String key, Integer defaultValue) { public int getInt(String key, Integer defaultValue) {
if (this.isLoading) if (this.isLoading)
return defaultValue; return defaultValue;
@ -185,17 +180,15 @@ public class ConfigurationManager {
try { try {
return Integer.parseInt(this.getValue(key, defaultValue.toString())); return Integer.parseInt(this.getValue(key, defaultValue.toString()));
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine("Failed to parse key " + key + " with value " + this.getValue(key) + " to type integer."); LOGGER.error("Failed to parse key {} with value '{}' to type integer.", key, this.getValue(key));
} }
return defaultValue; return defaultValue;
} }
public double getDouble(String key) { public double getDouble(String key) {
return this.getDouble(key, 0.0); return this.getDouble(key, 0.0);
} }
public double getDouble(String key, Double defaultValue) { public double getDouble(String key, Double defaultValue) {
if (this.isLoading) if (this.isLoading)
return defaultValue; return defaultValue;
@ -203,13 +196,12 @@ public class ConfigurationManager {
try { try {
return Double.parseDouble(this.getValue(key, defaultValue.toString())); return Double.parseDouble(this.getValue(key, defaultValue.toString()));
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine("Failed to parse key " + key + " with value " + this.getValue(key) + " to type double."); LOGGER.error("Failed to parse key {} with value '{}' to type double.", key, this.getValue(key));
} }
return defaultValue; return defaultValue;
} }
public void update(String key, String value) { public void update(String key, String value) {
this.properties.setProperty(key, value); this.properties.setProperty(key, value);
} }
@ -223,7 +215,7 @@ public class ConfigurationManager {
statement.setString(2, value); statement.setString(2, value);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
this.update(key, value); this.update(key, value);

View File

@ -2,11 +2,15 @@ package com.eu.habbo.core;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map; import java.util.Map;
public class CreditsScheduler extends Scheduler { public class CreditsScheduler extends Scheduler {
private static final Logger LOGGER = LoggerFactory.getLogger(CreditsScheduler.class);
public static boolean IGNORE_HOTEL_VIEW; public static boolean IGNORE_HOTEL_VIEW;
public static boolean IGNORE_IDLED; public static boolean IGNORE_IDLED;
@ -48,7 +52,7 @@ public class CreditsScheduler extends Scheduler {
habbo.giveCredits(habbo.getHabboInfo().getRank().getCreditsTimerAmount()); habbo.giveCredits(habbo.getHabboInfo().getRank().getCreditsTimerAmount());
} }
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
} }

View File

@ -3,6 +3,10 @@ package com.eu.habbo.core;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
public interface Loggable { public interface DatabaseLoggable {
String getQuery();
void log(PreparedStatement statement) throws SQLException; void log(PreparedStatement statement) throws SQLException;
} }

View File

@ -0,0 +1,46 @@
package com.eu.habbo.core;
import com.eu.habbo.Emulator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.concurrent.ConcurrentLinkedQueue;
public class DatabaseLogger {
private static final Logger LOGGER = LoggerFactory.getLogger(DatabaseLogger.class);
private final ConcurrentLinkedQueue<DatabaseLoggable> loggables = new ConcurrentLinkedQueue<>();
public void store(DatabaseLoggable loggable) {
this.loggables.add(loggable);
}
public void save() {
if (Emulator.getDatabase() == null || Emulator.getDatabase().getDataSource() == null) {
return;
}
if (this.loggables.isEmpty()) {
return;
}
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) {
while (!this.loggables.isEmpty()) {
DatabaseLoggable loggable = this.loggables.remove();
try (PreparedStatement statement = connection.prepareStatement(loggable.getQuery())) {
loggable.log(statement);
statement.executeBatch();
}
}
} catch (SQLException e) {
LOGGER.error("Exception caught while saving loggables to database.", e);
}
}
}

View File

@ -1,6 +1,8 @@
package com.eu.habbo.core; package com.eu.habbo.core;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
@ -8,9 +10,11 @@ import java.io.StringWriter;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
public class ErrorLog implements DatabaseLoggable {
private static final Logger LOGGER = LoggerFactory.getLogger(ErrorLog.class);
private static final String QUERY = "INSERT INTO emulator_errors (timestamp, version, build_hash, type, stacktrace) VALUES (?, ?, ?, ?, ?)";
public class ErrorLog implements Loggable {
public final static String insertQuery = "INSERT INTO emulator_errors (timestamp, version, build_hash, type, stacktrace) VALUES (?, ?, ?, ?, ?)";
public final String version; public final String version;
public final String buildHash; public final String buildHash;
@ -19,7 +23,6 @@ public class ErrorLog implements Loggable {
public final String stackTrace; public final String stackTrace;
public ErrorLog(String type, Throwable e) { public ErrorLog(String type, Throwable e) {
this.version = Emulator.version; this.version = Emulator.version;
this.buildHash = Emulator.version; this.buildHash = Emulator.version;
@ -35,7 +38,7 @@ public class ErrorLog implements Loggable {
pw.close(); pw.close();
sw.close(); sw.close();
} catch (IOException e1) { } catch (IOException e1) {
Emulator.getLogging().logErrorLine(e1); LOGGER.error("Exception caught", e1);
} }
} }
@ -48,6 +51,11 @@ public class ErrorLog implements Loggable {
this.stackTrace = message; this.stackTrace = message;
} }
@Override
public String getQuery() {
return QUERY;
}
@Override @Override
public void log(PreparedStatement statement) throws SQLException { public void log(PreparedStatement statement) throws SQLException {
statement.setInt(1, this.timeStamp); statement.setInt(1, this.timeStamp);

View File

@ -2,11 +2,15 @@ package com.eu.habbo.core;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map; import java.util.Map;
public class GotwPointsScheduler extends Scheduler { public class GotwPointsScheduler extends Scheduler {
private static final Logger LOGGER = LoggerFactory.getLogger(GotwPointsScheduler.class);
public static boolean IGNORE_HOTEL_VIEW; public static boolean IGNORE_HOTEL_VIEW;
public static boolean IGNORE_IDLED; public static boolean IGNORE_IDLED;
public static String GOTW_POINTS_NAME; public static String GOTW_POINTS_NAME;
@ -63,7 +67,7 @@ public class GotwPointsScheduler extends Scheduler {
} }
} }
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
} }

View File

@ -1,338 +1,97 @@
package com.eu.habbo.core; package com.eu.habbo.core;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage; import org.slf4j.Logger;
import gnu.trove.set.hash.THashSet; import org.slf4j.LoggerFactory;
import io.netty.util.internal.ConcurrentSet;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
public class Logging { public class Logging {
public static final String ANSI_BRIGHT = "\u001B[1m"; private static final Logger LOGGER = LoggerFactory.getLogger("LegacyLogger");
public static final String ANSI_ITALICS = "\u001B[3m";
public static final String ANSI_UNDERLINE = "\u001B[4m";
public static final String ANSI_RESET = "\u001B[0m";
public static final String ANSI_BLACK = "\u001B[30m";
public static final String ANSI_RED = "\u001B[31m";
public static final String ANSI_GREEN = "\u001B[32m";
public static final String ANSI_YELLOW = "\u001B[33m";
public static final String ANSI_BLUE = "\u001B[34m";
public static final String ANSI_PURPLE = "\u001B[35m";
public static final String ANSI_CYAN = "\u001B[36m";
public static final String ANSI_WHITE = "\u001B[37m";
private static PrintWriter packetsWriter;
private static PrintWriter packetsUndefinedWriter;
private static PrintWriter errorsPacketsWriter;
private static PrintWriter errorsSQLWriter;
private static PrintWriter errorsRuntimeWriter;
private static PrintWriter debugFileWriter;
private final THashSet<Loggable> errorLogs = new THashSet<>(100);
/**
private final THashSet<Loggable> commandLogs = new THashSet<>(100); * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
private ConcurrentSet<Loggable> chatLogs = new ConcurrentSet<>();
public Logging() {
File packets = new File("logging//packets//defined.txt");
File packetsUndefined = new File("logging//packets//packets.txt");
File errorsPackets = new File("logging//errors//packets.txt");
File errorsSQL = new File("logging//errors//sql.txt");
File errorsRuntime = new File("logging//errors//runtime.txt");
File debugFile = new File("logging//debug.txt");
try {
if (!packets.exists()) {
if (!packets.getParentFile().exists()) {
packets.getParentFile().mkdirs();
}
packets.createNewFile();
}
if (!packetsUndefined.exists()) {
if (!packetsUndefined.getParentFile().exists()) {
packetsUndefined.getParentFile().mkdirs();
}
packetsUndefined.createNewFile();
}
if (!errorsPackets.exists()) {
if (!errorsPackets.getParentFile().exists()) {
errorsPackets.getParentFile().mkdirs();
}
errorsPackets.createNewFile();
}
if (!errorsSQL.exists()) {
if (!errorsSQL.getParentFile().exists()) {
errorsSQL.getParentFile().mkdirs();
}
errorsSQL.createNewFile();
}
if (!errorsRuntime.exists()) {
if (!errorsRuntime.getParentFile().exists()) {
errorsRuntime.getParentFile().mkdirs();
}
errorsRuntime.createNewFile();
}
if (!debugFile.exists()) {
if (!debugFile.getParentFile().exists()) {
debugFile.getParentFile().mkdirs();
}
debugFile.createNewFile();
}
} catch (Exception e) {
e.printStackTrace();
}
try {
packetsWriter = new PrintWriter(new FileWriter(packets, true));
packetsUndefinedWriter = new PrintWriter(new FileWriter(packetsUndefined, true));
errorsPacketsWriter = new PrintWriter(new FileWriter(errorsPackets, true));
errorsSQLWriter = new PrintWriter(new FileWriter(errorsSQL, true));
errorsRuntimeWriter = new PrintWriter(new FileWriter(errorsRuntime, true));
debugFileWriter = new PrintWriter(new FileWriter(debugFile, true));
} catch (IOException e) {
System.out.println("[CRITICAL] FAILED TO LOAD LOGGING COMPONENT!");
}
}
public static PrintWriter getPacketsWriter() {
return packetsWriter;
}
public static PrintWriter getPacketsUndefinedWriter() {
return packetsUndefinedWriter;
}
public void logStart(Object line) {
System.out.println("[" + Logging.ANSI_BRIGHT + Logging.ANSI_GREEN + "LOADING" + Logging.ANSI_RESET + "] " + line.toString());
}
public void logShutdownLine(Object line) {
if (Emulator.getConfig().getBoolean("logging.debug")) {
this.write(debugFileWriter, line.toString());
}
System.out.println("[" + Logging.ANSI_BRIGHT + Logging.ANSI_RED + "SHUTDOWN" + Logging.ANSI_RESET + "] " + line.toString());
}
public void logUserLine(Object line) {
if (Emulator.getConfig().getBoolean("logging.debug")) {
this.write(debugFileWriter, line.toString());
}
if (Emulator.getConfig().getBoolean("debug.show.users")) {
System.out.println("[USER] " + line.toString());
}
}
public synchronized void logDebugLine(Object line) {
if (line instanceof Throwable) {
this.logErrorLine(line);
return;
}
if (Emulator.getConfig().getBoolean("debug.mode")) {
System.out.println("[DEBUG] " + line.toString());
}
if (Emulator.getConfig().getBoolean("logging.debug")) {
this.write(debugFileWriter, line.toString());
}
}
public synchronized void logPacketLine(Object line) {
if (Emulator.getConfig().getBoolean("debug.show.packets")) {
System.out.println("[" + Logging.ANSI_BLUE + "PACKET" + Logging.ANSI_RESET + "]" + line.toString());
}
if (Emulator.getConfig().getBoolean("logging.packets")) {
this.write(packetsWriter, line.toString());
}
}
public synchronized void logUndefinedPacketLine(Object line) {
if (Emulator.getConfig().getBoolean("debug.show.packets.undefined")) {
System.out.println("[PACKET] [UNDEFINED] " + line.toString());
}
if (Emulator.getConfig().getBoolean("logging.packets.undefined")) {
this.write(packetsUndefinedWriter, line.toString());
}
}
public synchronized void logErrorLine(Object line) {
if (Emulator.isReady && Emulator.getConfig().getBoolean("debug.show.errors")) {
System.err.println("[ERROR] " + line.toString());
}
if (Emulator.getConfig().loaded && Emulator.getConfig().getBoolean("logging.errors.runtime")) {
this.write(errorsRuntimeWriter, line);
}
if (line instanceof Throwable) {
((Throwable) line).printStackTrace();
if (line instanceof SQLException) {
this.logSQLException((SQLException) line);
return;
}
// Emulator.getThreading().run(new HTTPPostError((Throwable) line));
this.errorLogs.add(new ErrorLog("Exception", (Throwable) line));
return;
}
this.errorLogs.add(new ErrorLog("Emulator", line.toString()));
}
public void logSQLException(SQLException e) {
if (Emulator.getConfig().getBoolean("logging.errors.sql")) {
e.printStackTrace();
this.write(errorsSQLWriter, e);
//Emulator.getThreading().run(new HTTPPostError(e));
}
}
public void logPacketError(Object e) {
if (Emulator.getConfig().getBoolean("logging.errors.packets")) {
if (e instanceof Throwable)
((Exception) e).printStackTrace();
this.write(errorsPacketsWriter, e);
}
if (e instanceof Throwable) {
((Throwable) e).printStackTrace();
if (e instanceof SQLException) {
this.logSQLException((SQLException) e);
return;
}
// Emulator.getThreading().run(new HTTPPostError((Throwable) e));
}
}
public void handleException(Exception e) {
e.printStackTrace();
}
private synchronized void write(PrintWriter printWriter, Object message) {
if (printWriter != null && message != null) {
if (message instanceof Throwable) {
((Exception) message).printStackTrace(printWriter);
} else {
printWriter.write("MSG: " + message.toString() + "\r\n");
}
printWriter.flush();
}
}
public void addLog(Loggable log) {
if (log instanceof ErrorLog) {
synchronized (this.errorLogs) {
this.errorLogs.add(log);
}
} else if (log instanceof CommandLog) {
synchronized (this.commandLogs) {
this.commandLogs.add(log);
}
}
}
public void addChatLog(Loggable chatLog) {
this.chatLogs.add(chatLog);
}
public void saveLogs() {
if (Emulator.getDatabase() != null && Emulator.getDatabase().getDataSource() != null) {
if (!this.errorLogs.isEmpty() || !this.commandLogs.isEmpty() || !this.chatLogs.isEmpty()) {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) {
if (!this.errorLogs.isEmpty()) {
synchronized (this.errorLogs) {
try (PreparedStatement statement = connection.prepareStatement(ErrorLog.insertQuery)) {
for (Loggable log : this.errorLogs) {
log.log(statement);
}
statement.executeBatch();
}
this.errorLogs.clear();
}
}
if (!this.commandLogs.isEmpty()) {
synchronized (this.commandLogs) {
try (PreparedStatement statement = connection.prepareStatement(CommandLog.insertQuery)) {
for (Loggable log : this.commandLogs) {
log.log(statement);
}
statement.executeBatch();
}
this.commandLogs.clear();
}
}
if (!this.chatLogs.isEmpty()) {
ConcurrentSet<Loggable> chatLogs = this.chatLogs;
this.chatLogs = new ConcurrentSet<>();
try (PreparedStatement statement = connection.prepareStatement(RoomChatMessage.insertQuery)) {
for (Loggable log : chatLogs) {
log.log(statement);
}
statement.executeBatch();
}
chatLogs.clear();
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
}
}
}
}
/*
public static PrintWriter getErrorsPacketsWriter()
{
return errorsPacketsWriter;
}
public static PrintWriter getErrorsSQLWriter()
{
return errorsSQLWriter;
}
public static PrintWriter getErrorsRuntimeWriter()
{
return errorsRuntimeWriter;
}
public static PrintWriter getDebugFileWriter()
{
return debugFileWriter;
}
*/ */
@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);
}
} }

View File

@ -2,11 +2,15 @@ package com.eu.habbo.core;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map; import java.util.Map;
public class PixelScheduler extends Scheduler { public class PixelScheduler extends Scheduler {
private static final Logger LOGGER = LoggerFactory.getLogger(PixelScheduler.class);
public static boolean IGNORE_HOTEL_VIEW; public static boolean IGNORE_HOTEL_VIEW;
public static boolean IGNORE_IDLED; public static boolean IGNORE_IDLED;
@ -46,7 +50,7 @@ public class PixelScheduler extends Scheduler {
habbo.givePixels(habbo.getHabboInfo().getRank().getPixelsTimerAmount()); habbo.givePixels(habbo.getHabboInfo().getRank().getPixelsTimerAmount());
} }
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
} }

View File

@ -2,11 +2,15 @@ package com.eu.habbo.core;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map; import java.util.Map;
public class PointsScheduler extends Scheduler { public class PointsScheduler extends Scheduler {
private static final Logger LOGGER = LoggerFactory.getLogger(PointsScheduler.class);
public static boolean IGNORE_HOTEL_VIEW; public static boolean IGNORE_HOTEL_VIEW;
public static boolean IGNORE_IDLED; public static boolean IGNORE_IDLED;
@ -49,7 +53,7 @@ public class PointsScheduler extends Scheduler {
habbo.givePoints(habbo.getHabboInfo().getRank().getDiamondsTimerAmount()); habbo.givePoints(habbo.getHabboInfo().getRank().getDiamondsTimerAmount());
} }
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
} }

View File

@ -1,12 +1,16 @@
package com.eu.habbo.core; package com.eu.habbo.core;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.*; import java.sql.*;
import java.util.Properties; import java.util.Properties;
public class TextsManager { public class TextsManager {
private static final Logger LOGGER = LoggerFactory.getLogger(TextsManager.class);
private final Properties texts; private final Properties texts;
public TextsManager() { public TextsManager() {
@ -15,16 +19,14 @@ public class TextsManager {
this.texts = new Properties(); this.texts = new Properties();
try { try {
this.reload(); this.reload();
Emulator.getLogging().logStart("Texts Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); LOGGER.info("Texts Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public void reload() throws Exception { public void reload() throws Exception {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM emulator_texts")) { try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM emulator_texts")) {
while (set.next()) { while (set.next()) {
@ -35,54 +37,47 @@ public class TextsManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
public String getValue(String key) { public String getValue(String key) {
return this.getValue(key, ""); return this.getValue(key, "");
} }
public String getValue(String key, String defaultValue) { public String getValue(String key, String defaultValue) {
if (!this.texts.containsKey(key)) { if (!this.texts.containsKey(key)) {
Emulator.getLogging().logErrorLine("[TEXTS] Text key not found: " + key); LOGGER.error("Text key not found: {}", key);
} }
return this.texts.getProperty(key, defaultValue); return this.texts.getProperty(key, defaultValue);
} }
public boolean getBoolean(String key) { public boolean getBoolean(String key) {
return this.getBoolean(key, false); return this.getBoolean(key, false);
} }
public boolean getBoolean(String key, Boolean defaultValue) { public boolean getBoolean(String key, Boolean defaultValue) {
try { try {
return (this.getValue(key, "0").equals("1")) || (this.getValue(key, "false").equals("true")); return (this.getValue(key, "0").equals("1")) || (this.getValue(key, "false").equals("true"));
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
return defaultValue; return defaultValue;
} }
public int getInt(String key) { public int getInt(String key) {
return this.getInt(key, 0); return this.getInt(key, 0);
} }
public int getInt(String key, Integer defaultValue) { public int getInt(String key, Integer defaultValue) {
try { try {
return Integer.parseInt(this.getValue(key, defaultValue.toString())); return Integer.parseInt(this.getValue(key, defaultValue.toString()));
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
return defaultValue; return defaultValue;
} }
public void update(String key, String value) { public void update(String key, String value) {
this.texts.setProperty(key, value); this.texts.setProperty(key, value);
} }
@ -96,7 +91,7 @@ public class TextsManager {
statement.setString(2, value); statement.setString(2, value);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
this.update(key, value); this.update(key, value);

View File

@ -1,25 +1,21 @@
package com.eu.habbo.core.consolecommands; package com.eu.habbo.core.consolecommands;
import com.eu.habbo.Emulator;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class ConsoleCommand { public abstract class ConsoleCommand {
private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleCommand.class);
private static final THashMap<String, ConsoleCommand> commands = new THashMap<>(); private static final THashMap<String, ConsoleCommand> commands = new THashMap<>();
public final String key; public final String key;
public final String usage; public final String usage;
public ConsoleCommand(String key, String usage) { public ConsoleCommand(String key, String usage) {
this.key = key; this.key = key;
this.usage = usage; this.usage = usage;
} }
public static void load() { public static void load() {
addCommand(new ConsoleShutdownCommand()); addCommand(new ConsoleShutdownCommand());
addCommand(new ConsoleInfoCommand()); addCommand(new ConsoleInfoCommand());
@ -48,14 +44,14 @@ public abstract class ConsoleCommand {
command.handle(message); command.handle(message);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} else { } else {
System.out.println("Unknown Console Command " + message[0]); LOGGER.info("Unknown Console Command " + message[0]);
System.out.println("Commands Available (" + commands.size() + "): "); LOGGER.info("Commands Available (" + commands.size() + "): ");
for (ConsoleCommand c : commands.values()) { for (ConsoleCommand c : commands.values()) {
System.out.println(c.key + " - " + c.usage); LOGGER.info(c.key + " - " + c.usage);
} }
} }
} }
@ -64,4 +60,5 @@ public abstract class ConsoleCommand {
} }
public abstract void handle(String[] args) throws Exception; public abstract void handle(String[] args) throws Exception;
} }

View File

@ -2,10 +2,14 @@ package com.eu.habbo.core.consolecommands;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.catalog.CatalogManager; import com.eu.habbo.habbohotel.catalog.CatalogManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
public class ConsoleInfoCommand extends ConsoleCommand { public class ConsoleInfoCommand extends ConsoleCommand {
private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleInfoCommand.class);
public ConsoleInfoCommand() { public ConsoleInfoCommand() {
super("info", "Show current statistics."); 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 minute = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60);
long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) * 60); long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) * 60);
System.out.println("Emulator version: " + Emulator.version); LOGGER.info("Emulator version: " + Emulator.version);
System.out.println("Emulator build: " + Emulator.build); LOGGER.info("Emulator build: " + Emulator.build);
System.out.println(""); LOGGER.info("");
System.out.println("Hotel Statistics"); LOGGER.info("Hotel Statistics");
System.out.println("- Users: " + Emulator.getGameEnvironment().getHabboManager().getOnlineCount()); LOGGER.info("- Users: " + Emulator.getGameEnvironment().getHabboManager().getOnlineCount());
System.out.println("- Rooms: " + Emulator.getGameEnvironment().getRoomManager().getActiveRooms().size()); LOGGER.info("- Rooms: " + Emulator.getGameEnvironment().getRoomManager().getActiveRooms().size());
System.out.println("- Shop: " + Emulator.getGameEnvironment().getCatalogManager().catalogPages.size() + " pages and " + CatalogManager.catalogItemAmount + " items."); LOGGER.info("- Shop: " + Emulator.getGameEnvironment().getCatalogManager().catalogPages.size() + " pages and " + CatalogManager.catalogItemAmount + " items.");
System.out.println("- Furni: " + Emulator.getGameEnvironment().getItemManager().getItems().size() + " items."); LOGGER.info("- Furni: " + Emulator.getGameEnvironment().getItemManager().getItems().size() + " items.");
System.out.println(""); LOGGER.info("");
System.out.println("Server Statistics"); LOGGER.info("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!")); LOGGER.info("- 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"); LOGGER.info("- RAM Usage: " + (Emulator.getRuntime().totalMemory() - Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "/" + (Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "MB");
System.out.println("- CPU Cores: " + Emulator.getRuntime().availableProcessors()); LOGGER.info("- CPU Cores: " + Emulator.getRuntime().availableProcessors());
System.out.println("- Total Memory: " + Emulator.getRuntime().maxMemory() / (1024 * 1024) + "MB"); LOGGER.info("- Total Memory: " + Emulator.getRuntime().maxMemory() / (1024 * 1024) + "MB");
} }
} }

View File

@ -1,15 +1,19 @@
package com.eu.habbo.core.consolecommands; package com.eu.habbo.core.consolecommands;
import com.eu.habbo.networking.camera.CameraClient; import com.eu.habbo.networking.camera.CameraClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ConsoleReconnectCameraCommand extends ConsoleCommand { public class ConsoleReconnectCameraCommand extends ConsoleCommand {
private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleReconnectCameraCommand.class);
public ConsoleReconnectCameraCommand() { public ConsoleReconnectCameraCommand() {
super("camera", "Attempt to reconnect to the camera server."); super("camera", "Attempt to reconnect to the camera server.");
} }
@Override @Override
public void handle(String[] args) throws Exception { public void handle(String[] args) throws Exception {
System.out.println("Connecting to the camera..."); LOGGER.info("Connecting to the camera...");
CameraClient.attemptReconnect = true; CameraClient.attemptReconnect = true;
} }
} }

View File

@ -3,8 +3,12 @@ package com.eu.habbo.core.consolecommands;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ConsoleTestCommand extends ConsoleCommand { public class ConsoleTestCommand extends ConsoleCommand {
private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleTestCommand.class);
public ConsoleTestCommand() { public ConsoleTestCommand() {
super("test", "This is just a test."); super("test", "This is just a test.");
} }
@ -12,7 +16,7 @@ public class ConsoleTestCommand extends ConsoleCommand {
@Override @Override
public void handle(String[] args) throws Exception { public void handle(String[] args) throws Exception {
if (Emulator.debugging) { 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); //AchievementManager.progressAchievement(4, Emulator.getGameEnvironment().getAchievementManager().getAchievement("AllTimeHotelPresence"), 30);

View File

@ -1,8 +1,12 @@
package com.eu.habbo.core.consolecommands; package com.eu.habbo.core.consolecommands;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ShowInteractionsCommand extends ConsoleCommand { public class ShowInteractionsCommand extends ConsoleCommand {
private static final Logger LOGGER = LoggerFactory.getLogger(ShowInteractionsCommand.class);
public ShowInteractionsCommand() { public ShowInteractionsCommand() {
super("interactions", "Show a list of available furniture interactions."); super("interactions", "Show a list of available furniture interactions.");
} }
@ -10,7 +14,7 @@ public class ShowInteractionsCommand extends ConsoleCommand {
@Override @Override
public void handle(String[] args) throws Exception { public void handle(String[] args) throws Exception {
for (String interaction : Emulator.getGameEnvironment().getItemManager().getInteractionList()) { 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; package com.eu.habbo.core.consolecommands;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ShowRCONCommands extends ConsoleCommand { public class ShowRCONCommands extends ConsoleCommand {
private static final Logger LOGGER = LoggerFactory.getLogger(ShowRCONCommands.class);
public ShowRCONCommands() { public ShowRCONCommands() {
super("rconcommands", "Show a list of all RCON commands"); super("rconcommands", "Show a list of all RCON commands");
} }
@ -10,7 +14,7 @@ public class ShowRCONCommands extends ConsoleCommand {
@Override @Override
public void handle(String[] args) throws Exception { public void handle(String[] args) throws Exception {
for (String command : Emulator.getRconServer().getCommands()) { for (String command : Emulator.getRconServer().getCommands()) {
System.out.println(command); LOGGER.info(command);
} }
} }
} }

View File

@ -2,7 +2,7 @@ package com.eu.habbo.crypto;
import com.eu.habbo.crypto.exceptions.HabboCryptoException; import com.eu.habbo.crypto.exceptions.HabboCryptoException;
import com.eu.habbo.crypto.utils.BigIntegerUtils; import com.eu.habbo.crypto.utils.BigIntegerUtils;
import com.eu.habbo.crypto.utils.HexUtils; import com.eu.habbo.util.HexUtils;
import java.math.BigInteger; import java.math.BigInteger;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;

View File

@ -3,16 +3,17 @@ package com.eu.habbo.database;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.core.ConfigurationManager; import com.eu.habbo.core.ConfigurationManager;
import com.zaxxer.hikari.HikariDataSource; import com.zaxxer.hikari.HikariDataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Database { public class Database {
private static final Logger LOGGER = LoggerFactory.getLogger(Database.class);
private HikariDataSource dataSource; private HikariDataSource dataSource;
private DatabasePool databasePool; private DatabasePool databasePool;
public Database(ConfigurationManager config) { public Database(ConfigurationManager config) {
long millis = System.currentTimeMillis(); long millis = System.currentTimeMillis();
boolean SQLException = false; boolean SQLException = false;
@ -20,24 +21,22 @@ public class Database {
try { try {
this.databasePool = new DatabasePool(); this.databasePool = new DatabasePool();
if (!this.databasePool.getStoragePooling(config)) { if (!this.databasePool.getStoragePooling(config)) {
Emulator.getLogging().logStart("Failed to connect to the database. Please check config.ini and make sure the MySQL process is running. Shutting down..."); LOGGER.info("Failed to connect to the database. Please check config.ini and make sure the MySQL process is running. Shutting down...");
SQLException = true; SQLException = true;
return; return;
} }
this.dataSource = this.databasePool.getDatabase(); this.dataSource = this.databasePool.getDatabase();
} catch (Exception e) { } catch (Exception e) {
SQLException = true; SQLException = true;
e.printStackTrace(); LOGGER.error("Failed to connect to your database.", e);
Emulator.getLogging().logStart("Failed to connect to your database.");
Emulator.getLogging().logStart(e.getMessage());
} finally { } finally {
if (SQLException) if (SQLException) {
Emulator.prepareShutdown(); Emulator.prepareShutdown();
} }
Emulator.getLogging().logStart("Database -> Connected! (" + (System.currentTimeMillis() - millis) + " MS)");
} }
LOGGER.info("Database -> Connected! ({} MS)", System.currentTimeMillis() - millis);
}
public void dispose() { public void dispose() {
if (this.databasePool != null) { if (this.databasePool != null) {
@ -55,4 +54,3 @@ public class Database {
return this.databasePool; return this.databasePool;
} }
} }

View File

@ -1,10 +1,7 @@
package com.eu.habbo.habbohotel; package com.eu.habbo.habbohotel;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.core.CreditsScheduler; import com.eu.habbo.core.*;
import com.eu.habbo.core.GotwPointsScheduler;
import com.eu.habbo.core.PixelScheduler;
import com.eu.habbo.core.PointsScheduler;
import com.eu.habbo.habbohotel.achievements.AchievementManager; import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.bots.BotManager; import com.eu.habbo.habbohotel.bots.BotManager;
import com.eu.habbo.habbohotel.catalog.CatalogManager; import com.eu.habbo.habbohotel.catalog.CatalogManager;
@ -23,8 +20,13 @@ import com.eu.habbo.habbohotel.pets.PetManager;
import com.eu.habbo.habbohotel.polls.PollManager; import com.eu.habbo.habbohotel.polls.PollManager;
import com.eu.habbo.habbohotel.rooms.RoomManager; import com.eu.habbo.habbohotel.rooms.RoomManager;
import com.eu.habbo.habbohotel.users.HabboManager; import com.eu.habbo.habbohotel.users.HabboManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class GameEnvironment { public class GameEnvironment {
private static final Logger LOGGER = LoggerFactory.getLogger(GameEnvironment.class);
public CreditsScheduler creditsScheduler; public CreditsScheduler creditsScheduler;
public PixelScheduler pixelScheduler; public PixelScheduler pixelScheduler;
public PointsScheduler pointsScheduler; public PointsScheduler pointsScheduler;
@ -49,7 +51,7 @@ public class GameEnvironment {
private PollManager pollManager; private PollManager pollManager;
public void load() throws Exception { public void load() throws Exception {
Emulator.getLogging().logStart("GameEnvironment -> Loading..."); LOGGER.info("GameEnvironment -> Loading...");
this.permissionsManager = new PermissionsManager(); this.permissionsManager = new PermissionsManager();
this.habboManager = new HabboManager(); this.habboManager = new HabboManager();
@ -85,7 +87,7 @@ public class GameEnvironment {
Emulator.getThreading().run(this.gotwPointsScheduler); Emulator.getThreading().run(this.gotwPointsScheduler);
Emulator.getLogging().logStart("GameEnvironment -> Loaded!"); LOGGER.info("GameEnvironment -> Loaded!");
} }
public void dispose() { public void dispose() {
@ -101,7 +103,7 @@ public class GameEnvironment {
this.roomManager.dispose(); this.roomManager.dispose();
this.itemManager.dispose(); this.itemManager.dispose();
this.hotelViewManager.dispose(); this.hotelViewManager.dispose();
Emulator.getLogging().logShutdownLine("GameEnvironment -> Disposed!"); LOGGER.info("GameEnvironment -> Disposed!");
} }
public HabboManager getHabboManager() { public HabboManager getHabboManager() {

View File

@ -18,20 +18,21 @@ import com.eu.habbo.plugin.events.users.achievements.UserAchievementLeveledEvent
import com.eu.habbo.plugin.events.users.achievements.UserAchievementProgressEvent; import com.eu.habbo.plugin.events.users.achievements.UserAchievementProgressEvent;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import gnu.trove.procedure.TObjectIntProcedure; import gnu.trove.procedure.TObjectIntProcedure;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.*; import java.sql.*;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
public class AchievementManager { public class AchievementManager {
private static final Logger LOGGER = LoggerFactory.getLogger(AchievementManager.class);
public static boolean TALENTTRACK_ENABLED = false; public static boolean TALENTTRACK_ENABLED = false;
private final THashMap<String, Achievement> achievements; private final THashMap<String, Achievement> achievements;
private final THashMap<TalentTrackType, LinkedHashMap<Integer, TalentTrackLevel>> talentTrackLevels; private final THashMap<TalentTrackType, LinkedHashMap<Integer, TalentTrackLevel>> talentTrackLevels;
public AchievementManager() { public AchievementManager() {
this.achievements = new THashMap<>(); this.achievements = new THashMap<>();
this.talentTrackLevels = new THashMap<>(); this.talentTrackLevels = new THashMap<>();
@ -58,7 +59,7 @@ public class AchievementManager {
statement.setInt(4, amount); statement.setInt(4, amount);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
@ -140,7 +141,7 @@ public class AchievementManager {
try { try {
badge = habbo.getInventory().getBadgesComponent().getBadge(("ACH_" + achievement.name + oldLevel.level).toLowerCase()); badge = habbo.getInventory().getBadgesComponent().getBadge(("ACH_" + achievement.name + oldLevel.level).toLowerCase());
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
return; return;
} }
} }
@ -203,7 +204,7 @@ public class AchievementManager {
statement.setInt(3, 1); statement.setInt(3, 1);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -217,7 +218,7 @@ public class AchievementManager {
} }
statement.executeBatch(); statement.executeBatch();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -231,7 +232,7 @@ public class AchievementManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return 0; return 0;
@ -254,9 +255,9 @@ public class AchievementManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
@ -276,13 +277,13 @@ public class AchievementManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
Emulator.getLogging().logErrorLine("Achievement Manager -> Failed to load!"); LOGGER.error("Achievement Manager -> Failed to load!");
return; return;
} }
} }
Emulator.getLogging().logStart("Achievement Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); LOGGER.info("Achievement Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
} }
public Achievement getAchievement(String name) { public Achievement getAchievement(String name) {

View File

@ -5,27 +5,20 @@ import com.eu.habbo.habbohotel.items.Item;
import gnu.trove.map.TObjectIntMap; import gnu.trove.map.TObjectIntMap;
import gnu.trove.map.hash.TObjectIntHashMap; import gnu.trove.map.hash.TObjectIntHashMap;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class TalentTrackLevel { public class TalentTrackLevel {
private static final Logger LOGGER = LoggerFactory.getLogger(TalentTrackLevel.class);
public TalentTrackType type; public TalentTrackType type;
public int level; public int level;
public TObjectIntMap<Achievement> achievements; public TObjectIntMap<Achievement> achievements;
public THashSet<Item> items; public THashSet<Item> items;
public String[] perks; public String[] perks;
public String[] badges; public String[] badges;
public TalentTrackLevel(ResultSet set) throws SQLException { public TalentTrackLevel(ResultSet set) throws SQLException {
@ -46,7 +39,7 @@ public class TalentTrackLevel {
if (achievement != null) { if (achievement != null) {
this.achievements.put(achievement, Integer.valueOf(achievementLevels[i])); this.achievements.put(achievement, Integer.valueOf(achievementLevels[i]));
} else { } else {
Emulator.getLogging().logErrorLine("Could not find achievement with ID " + achievements[i] + " for talenttrack level " + this.level + " of type " + this.type); LOGGER.error("Could not find achievement with ID " + achievements[i] + " for talenttrack level " + this.level + " of type " + this.type);
} }
} }
} }
@ -57,7 +50,7 @@ public class TalentTrackLevel {
if (item != null) { if (item != null) {
this.items.add(item); this.items.add(item);
} else { } else {
Emulator.getLogging().logStart("Incorrect reward furni (ID: " + s + ") for talent track level " + this.level); LOGGER.error("Incorrect reward furni (ID: " + s + ") for talent track level " + this.level);
} }
} }

View File

@ -12,6 +12,8 @@ import com.eu.habbo.plugin.events.bots.BotShoutEvent;
import com.eu.habbo.plugin.events.bots.BotTalkEvent; import com.eu.habbo.plugin.events.bots.BotTalkEvent;
import com.eu.habbo.plugin.events.bots.BotWhisperEvent; import com.eu.habbo.plugin.events.bots.BotWhisperEvent;
import com.eu.habbo.threading.runnables.BotFollowHabbo; import com.eu.habbo.threading.runnables.BotFollowHabbo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -21,6 +23,8 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
public class Bot implements Runnable { public class Bot implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(Bot.class);
public static final String NO_CHAT_SET = "${bot.skill.chatter.configuration.text.placeholder}"; public static final String NO_CHAT_SET = "${bot.skill.chatter.configuration.text.placeholder}";
public static String[] PLACEMENT_MESSAGES = "Yo!;Hello I'm a real party animal!;Hello!".split(";"); public static String[] PLACEMENT_MESSAGES = "Yo!;Hello I'm a real party animal!;Hello!".split(";");
@ -155,7 +159,7 @@ public class Bot implements Runnable {
statement.execute(); statement.execute();
this.needsUpdate = false; this.needsUpdate = false;
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.*; import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.users.cache.HabboOfferPurchase;
import com.eu.habbo.messages.outgoing.generic.alerts.BotErrorComposer; import com.eu.habbo.messages.outgoing.generic.alerts.BotErrorComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
@ -15,12 +16,15 @@ import com.eu.habbo.messages.outgoing.rooms.users.RoomUsersComposer;
import com.eu.habbo.plugin.events.bots.BotPickUpEvent; import com.eu.habbo.plugin.events.bots.BotPickUpEvent;
import com.eu.habbo.plugin.events.bots.BotPlacedEvent; import com.eu.habbo.plugin.events.bots.BotPlacedEvent;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.sql.*; import java.sql.*;
import java.util.Map; import java.util.Map;
public class BotManager { public class BotManager {
private static final Logger LOGGER = LoggerFactory.getLogger(BotManager.class);
final private static THashMap<String, Class<? extends Bot>> botDefenitions = new THashMap<>(); final private static THashMap<String, Class<? extends Bot>> botDefenitions = new THashMap<>();
public static int MINIMUM_CHAT_SPEED = 7; public static int MINIMUM_CHAT_SPEED = 7;
@ -38,7 +42,7 @@ public class BotManager {
this.reload(); this.reload();
Emulator.getLogging().logStart("Bot Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); LOGGER.info("Bot Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
} }
public static void addBotDefinition(String type, Class<? extends Bot> botClazz) throws Exception { public static void addBotDefinition(String type, Class<? extends Bot> botClazz) throws Exception {
@ -58,10 +62,10 @@ public class BotManager {
m.setAccessible(true); m.setAccessible(true);
m.invoke(null); m.invoke(null);
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
Emulator.getLogging().logStart("Bot Manager -> Failed to execute initialise method upon bot type '" + set.getKey() + "'. No Such Method!"); LOGGER.info("Bot Manager -> Failed to execute initialise method upon bot type '" + set.getKey() + "'. No Such Method!");
return false; return false;
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logStart("Bot Manager -> Failed to execute initialise method upon bot type '" + set.getKey() + "'. Error: " + e.getMessage()); LOGGER.info("Bot Manager -> Failed to execute initialise method upon bot type '" + set.getKey() + "'. Error: " + e.getMessage());
return false; return false;
} }
} }
@ -88,12 +92,12 @@ public class BotManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return bot; return bot;
@ -143,7 +147,7 @@ public class BotManager {
try { try {
topItem.onWalkOn(bot.getRoomUnit(), room, null); topItem.onWalkOn(bot.getRoomUnit(), room, null);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
bot.cycle(false); bot.cycle(false);
@ -193,11 +197,11 @@ public class BotManager {
if (botClazz != null) if (botClazz != null)
return botClazz.getDeclaredConstructor(ResultSet.class).newInstance(set); return botClazz.getDeclaredConstructor(ResultSet.class).newInstance(set);
else else
Emulator.getLogging().logErrorLine("Unknown Bot Type: " + type); LOGGER.error("Unknown Bot Type: " + type);
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
return null; return null;
@ -208,7 +212,7 @@ public class BotManager {
statement.setInt(1, bot.getId()); statement.setInt(1, bot.getId());
return statement.execute(); return statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return false; return false;
@ -221,9 +225,9 @@ public class BotManager {
m.setAccessible(true); m.setAccessible(true);
m.invoke(null); m.invoke(null);
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
Emulator.getLogging().logStart("Bot Manager -> Failed to execute dispose method upon bot type '" + set.getKey() + "'. No Such Method!"); LOGGER.info("Bot Manager -> Failed to execute dispose method upon bot type '" + set.getKey() + "'. No Such Method!");
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logStart("Bot Manager -> Failed to execute dispose method upon bot type '" + set.getKey() + "'. Error: " + e.getMessage()); LOGGER.info("Bot Manager -> Failed to execute dispose method upon bot type '" + set.getKey() + "'. Error: " + e.getMessage());
} }
} }
} }

View File

@ -8,6 +8,8 @@ import com.eu.habbo.threading.runnables.RoomUnitGiveHanditem;
import com.eu.habbo.threading.runnables.RoomUnitWalkToRoomUnit; import com.eu.habbo.threading.runnables.RoomUnitWalkToRoomUnit;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -19,6 +21,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class ButlerBot extends Bot { public class ButlerBot extends Bot {
private static final Logger LOGGER = LoggerFactory.getLogger(ButlerBot.class);
public static THashMap<THashSet<String>, Integer> serveItems = new THashMap<>(); public static THashMap<THashSet<String>, Integer> serveItems = new THashMap<>();
public ButlerBot(ResultSet set) throws SQLException { public ButlerBot(ResultSet set) throws SQLException {
@ -43,7 +46,7 @@ public class ButlerBot extends Bot {
serveItems.put(ks, set.getInt("item")); serveItems.put(ks, set.getInt("item"));
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }

View File

@ -3,9 +3,12 @@ package com.eu.habbo.habbohotel.catalog;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.FurnitureType; import com.eu.habbo.habbohotel.items.FurnitureType;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.users.HabboBadge;
import com.eu.habbo.messages.ISerialize; import com.eu.habbo.messages.ISerialize;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -14,7 +17,7 @@ import java.sql.SQLException;
import java.util.HashMap; import java.util.HashMap;
public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem> { public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem> {
private static final Logger LOGGER = LoggerFactory.getLogger(CatalogItem.class);
int id; int id;
int limitedStack; int limitedStack;
private int pageId; private int pageId;
@ -211,7 +214,7 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
identifier = Integer.parseInt(itemId); identifier = Integer.parseInt(itemId);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logStart("Invalid value (" + itemId + ") for items_base column for catalog_item id (" + this.id + "). Value must be integer or of the format of integer:amount;integer:amount"); LOGGER.info("Invalid value (" + itemId + ") for items_base column for catalog_item id (" + this.id + "). Value must be integer or of the format of integer:amount;integer:amount");
continue; continue;
} }
if (identifier > 0) { if (identifier > 0) {
@ -258,8 +261,8 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
} }
} }
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logDebugLine("Failed to load " + this.itemId); LOGGER.debug("Failed to load " + this.itemId);
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} else { } else {
try { try {
@ -343,7 +346,7 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
statement.setInt(3, this.getId()); statement.setInt(3, this.getId());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
this.needsUpdate = false; this.needsUpdate = false;

View File

@ -3,6 +3,8 @@ package com.eu.habbo.habbohotel.catalog;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -11,6 +13,8 @@ import java.util.Collections;
import java.util.LinkedList; import java.util.LinkedList;
public class CatalogLimitedConfiguration implements Runnable { public class CatalogLimitedConfiguration implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(CatalogLimitedConfiguration.class);
private final int itemId; private final int itemId;
private final LinkedList<Integer> limitedNumbers; private final LinkedList<Integer> limitedNumbers;
private int totalSet; private int totalSet;
@ -47,7 +51,7 @@ public class CatalogLimitedConfiguration implements Runnable {
statement.setInt(5, item.getLimitedSells()); statement.setInt(5, item.getLimitedSells());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
@ -65,7 +69,7 @@ public class CatalogLimitedConfiguration implements Runnable {
statement.executeBatch(); statement.executeBatch();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
this.totalSet += amount; this.totalSet += amount;
@ -98,7 +102,7 @@ public class CatalogLimitedConfiguration implements Runnable {
statement.setInt(3, this.itemId); statement.setInt(3, this.itemId);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.catalog.layouts.*; import com.eu.habbo.habbohotel.catalog.layouts.*;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.guilds.Guild; import com.eu.habbo.habbohotel.guilds.Guild;
import com.eu.habbo.habbohotel.guilds.GuildManager;
import com.eu.habbo.habbohotel.items.FurnitureType; import com.eu.habbo.habbohotel.items.FurnitureType;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.SoundTrack; import com.eu.habbo.habbohotel.items.SoundTrack;
@ -39,6 +40,8 @@ import gnu.trove.map.hash.TIntIntHashMap;
import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.procedure.TObjectProcedure; import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.sql.*; import java.sql.*;
@ -47,6 +50,8 @@ import java.util.stream.Collectors;
public class CatalogManager { public class CatalogManager {
private static final Logger LOGGER = LoggerFactory.getLogger(CatalogManager.class);
public static final THashMap<String, Class<? extends CatalogPage>> pageDefinitions = new THashMap<String, Class<? extends CatalogPage>>(CatalogPageLayouts.values().length) { public static final THashMap<String, Class<? extends CatalogPage>> pageDefinitions = new THashMap<String, Class<? extends CatalogPage>>(CatalogPageLayouts.values().length) {
{ {
for (CatalogPageLayouts layout : CatalogPageLayouts.values()) { for (CatalogPageLayouts layout : CatalogPageLayouts.values()) {
@ -209,7 +214,7 @@ public class CatalogManager {
this.ecotronItem = Emulator.getGameEnvironment().getItemManager().getItem("ecotron_box"); this.ecotronItem = Emulator.getGameEnvironment().getItemManager().getItem("ecotron_box");
Emulator.getLogging().logStart("Catalog Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); LOGGER.info("Catalog Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
} }
@ -249,7 +254,7 @@ public class CatalogManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
for (Map.Entry<Integer, LinkedList<Integer>> set : limiteds.entrySet()) { for (Map.Entry<Integer, LinkedList<Integer>> set : limiteds.entrySet()) {
@ -269,7 +274,7 @@ public class CatalogManager {
Class<? extends CatalogPage> pageClazz = pageDefinitions.get(set.getString("page_layout")); Class<? extends CatalogPage> pageClazz = pageDefinitions.get(set.getString("page_layout"));
if (pageClazz == null) { if (pageClazz == null) {
Emulator.getLogging().logStart("Unknown Page Layout: " + set.getString("page_layout")); LOGGER.info("Unknown Page Layout: " + set.getString("page_layout"));
continue; continue;
} }
@ -277,12 +282,12 @@ public class CatalogManager {
CatalogPage page = pageClazz.getConstructor(ResultSet.class).newInstance(set); CatalogPage page = pageClazz.getConstructor(ResultSet.class).newInstance(set);
pages.put(page.getId(), page); pages.put(page.getId(), page);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine("Failed to load layout: " + set.getString("page_layout")); LOGGER.error("Failed to load layout: {}", set.getString("page_layout"));
} }
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
pages.forEachValue((object) -> { pages.forEachValue((object) -> {
@ -294,7 +299,7 @@ public class CatalogManager {
} }
} else { } else {
if (object.parentId != -2) { if (object.parentId != -2) {
Emulator.getLogging().logStart("Parent Page not found for " + object.getPageName() + " (ID: " + object.id + ", parent_id: " + object.parentId + ")"); LOGGER.info("Parent Page not found for " + object.getPageName() + " (ID: " + object.id + ", parent_id: " + object.parentId + ")");
} }
} }
return true; return true;
@ -302,7 +307,7 @@ public class CatalogManager {
this.catalogPages.putAll(pages); this.catalogPages.putAll(pages);
Emulator.getLogging().logStart("Loaded " + this.catalogPages.size() + " Catalog Pages!"); LOGGER.info("Loaded " + this.catalogPages.size() + " Catalog Pages!");
} }
@ -323,7 +328,7 @@ public class CatalogManager {
)); ));
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -367,7 +372,7 @@ public class CatalogManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
for (CatalogPage page : this.catalogPages.valueCollection()) { for (CatalogPage page : this.catalogPages.valueCollection()) {
@ -392,7 +397,7 @@ public class CatalogManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -408,7 +413,7 @@ public class CatalogManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
@ -423,7 +428,7 @@ public class CatalogManager {
this.vouchers.add(new Voucher(set)); this.vouchers.add(new Voucher(set));
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
@ -443,11 +448,11 @@ public class CatalogManager {
this.prizes.get(set.getInt("rarity")).add(item); this.prizes.get(set.getInt("rarity")).add(item);
} else { } else {
Emulator.getLogging().logErrorLine("Cannot load item with ID:" + set.getInt("item_id") + " as recycler reward!"); LOGGER.error("Cannot load item with ID: {} as recycler reward!", set.getInt("item_id"));
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
@ -472,7 +477,7 @@ public class CatalogManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
@ -489,7 +494,7 @@ public class CatalogManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
@ -504,7 +509,7 @@ public class CatalogManager {
this.clothing.put(set.getInt("id"), new ClothItem(set)); this.clothing.put(set.getInt("id"), new ClothItem(set));
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
@ -594,7 +599,7 @@ public class CatalogManager {
return statement.executeUpdate() >= 1; return statement.executeUpdate() >= 1;
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return false; return false;
@ -699,7 +704,7 @@ public class CatalogManager {
if (this.prizes.containsKey(level) && !this.prizes.get(level).isEmpty()) { if (this.prizes.containsKey(level) && !this.prizes.get(level).isEmpty()) {
return (Item) this.prizes.get(level).toArray()[Emulator.getRandom().nextInt(this.prizes.get(level).size())]; return (Item) this.prizes.get(level).toArray()[Emulator.getRandom().nextInt(this.prizes.get(level).size())];
} else { } else {
Emulator.getLogging().logErrorLine("[Recycler] No rewards specified for rarity level " + level); LOGGER.error("No rewards specified for rarity level {}", level);
} }
return null; return null;
@ -730,13 +735,11 @@ public class CatalogManager {
if (pageClazz != null) { if (pageClazz != null) {
try { try {
catalogPage = pageClazz.getConstructor(ResultSet.class).newInstance(page); catalogPage = pageClazz.getConstructor(ResultSet.class).newInstance(page);
} catch (InvocationTargetException e) {
Emulator.getLogging().logErrorLine(e.getCause());
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} else { } else {
Emulator.getLogging().logErrorLine("Unknown Page Layout: " + page.getString("page_layout")); LOGGER.error("Unknown page layout: {}", page.getString("page_layout"));
} }
} }
} }
@ -744,7 +747,7 @@ public class CatalogManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
if (catalogPage != null) { if (catalogPage != null) {
@ -803,7 +806,7 @@ public class CatalogManager {
} }
} }
Emulator.getLogging().logShutdownLine("Catalog Manager -> Disposed!"); LOGGER.info("Catalog Manager -> Disposed!");
} }
@ -872,7 +875,7 @@ public class CatalogManager {
if (amount > 1 && !CatalogItem.haveOffer(item)) { if (amount > 1 && !CatalogItem.haveOffer(item)) {
String message = Emulator.getTexts().getValue("scripter.warning.catalog.amount").replace("%username%", habbo.getHabboInfo().getUsername()).replace("%itemname%", item.getName()).replace("%pagename%", page.getCaption()); String message = Emulator.getTexts().getValue("scripter.warning.catalog.amount").replace("%username%", habbo.getHabboInfo().getUsername()).replace("%itemname%", item.getName()).replace("%pagename%", page.getCaption());
ScripterManager.scripterDetected(habbo.getClient(), message); ScripterManager.scripterDetected(habbo.getClient(), message);
Emulator.getLogging().logUserLine(message); LOGGER.info(message);
habbo.getClient().sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.ILLEGAL)); habbo.getClient().sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.ILLEGAL));
return; return;
} }
@ -957,7 +960,7 @@ public class CatalogManager {
try { try {
pet = Emulator.getGameEnvironment().getPetManager().createPet(baseItem, data[0], data[1], data[2], habbo.getClient()); pet = Emulator.getGameEnvironment().getPetManager().createPet(baseItem, data[0], data[1], data[2], habbo.getClient());
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
} }
@ -1012,7 +1015,7 @@ public class CatalogManager {
try { try {
guildId = Integer.parseInt(extradata); guildId = Integer.parseInt(extradata);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
return; return;
} }
@ -1120,7 +1123,7 @@ public class CatalogManager {
habbo.getClient().sendResponse(new InventoryRefreshComposer()); habbo.getClient().sendResponse(new InventoryRefreshComposer());
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logPacketError(e); LOGGER.error("Exception caught", e);
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
} }
} finally { } finally {
@ -1158,7 +1161,7 @@ public class CatalogManager {
statement.setInt(3, Emulator.getIntUnixTimestamp()); statement.setInt(3, Emulator.getIntUnixTimestamp());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -1,6 +1,5 @@
package com.eu.habbo.habbohotel.catalog; package com.eu.habbo.habbohotel.catalog;
import com.eu.habbo.Emulator;
import com.eu.habbo.messages.ISerialize; import com.eu.habbo.messages.ISerialize;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import gnu.trove.TCollections; import gnu.trove.TCollections;
@ -8,12 +7,16 @@ import gnu.trove.list.array.TIntArrayList;
import gnu.trove.map.TIntObjectMap; import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.map.hash.TIntObjectHashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
public abstract class CatalogPage implements Comparable<CatalogPage>, ISerialize { public abstract class CatalogPage implements Comparable<CatalogPage>, ISerialize {
private static final Logger LOGGER = LoggerFactory.getLogger(CatalogPage.class);
protected final TIntArrayList offerIds = new TIntArrayList(); protected final TIntArrayList offerIds = new TIntArrayList();
protected final THashMap<Integer, CatalogPage> childPages = new THashMap<>(); protected final THashMap<Integer, CatalogPage> childPages = new THashMap<>();
private final TIntObjectMap<CatalogItem> catalogItems = TCollections.synchronizedMap(new TIntObjectHashMap<>()); private final TIntObjectMap<CatalogItem> catalogItems = TCollections.synchronizedMap(new TIntObjectHashMap<>());
@ -70,8 +73,8 @@ public abstract class CatalogPage implements Comparable<CatalogPage>, ISerialize
try { try {
this.included.add(Integer.valueOf(id)); this.included.add(Integer.valueOf(id));
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
Emulator.getLogging().logErrorLine("Failed to parse includes column value of (" + id + ") for catalog page (" + this.id + ")"); LOGGER.error("Failed to parse includes column value of (" + id + ") for catalog page (" + this.id + ")");
} }
} }
} }

View File

@ -1,6 +1,8 @@
package com.eu.habbo.habbohotel.catalog; package com.eu.habbo.habbohotel.catalog;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -10,6 +12,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class Voucher { public class Voucher {
private static final Logger LOGGER = LoggerFactory.getLogger(Voucher.class);
public final int id; public final int id;
public final String code; public final String code;
public final int credits; public final int credits;
@ -41,7 +45,7 @@ public class Voucher {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -64,7 +68,7 @@ public class Voucher {
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -13,11 +13,15 @@ import com.eu.habbo.messages.outgoing.navigator.CanCreateRoomComposer;
import gnu.trove.map.TIntObjectMap; import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import gnu.trove.procedure.TObjectProcedure; import gnu.trove.procedure.TObjectProcedure;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.*; import java.sql.*;
import java.util.Map; import java.util.Map;
public class RoomBundleLayout extends SingleBundle { public class RoomBundleLayout extends SingleBundle {
private static final Logger LOGGER = LoggerFactory.getLogger(RoomBundleLayout.class);
public int roomId; public int roomId;
public Room room; public Room room;
private int lastUpdate = 0; private int lastUpdate = 0;
@ -43,7 +47,7 @@ public class RoomBundleLayout extends SingleBundle {
if (this.room != null) if (this.room != null)
this.room.preventUnloading = true; this.room.preventUnloading = true;
} else { } else {
Emulator.getLogging().logErrorLine("No room id specified for room bundle " + this.getPageName() + "(" + this.getId() + ")"); LOGGER.error("No room id specified for room bundle " + this.getPageName() + "(" + this.getId() + ")");
} }
} }
@ -185,7 +189,7 @@ public class RoomBundleLayout extends SingleBundle {
statement.setInt(3, this.room.getId()); statement.setInt(3, this.room.getId());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -219,7 +223,7 @@ public class RoomBundleLayout extends SingleBundle {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
Room r = Emulator.getGameEnvironment().getRoomManager().loadRoom(roomId); Room r = Emulator.getGameEnvironment().getRoomManager().loadRoom(roomId);

View File

@ -16,6 +16,8 @@ import com.eu.habbo.plugin.events.marketplace.MarketPlaceItemCancelledEvent;
import com.eu.habbo.plugin.events.marketplace.MarketPlaceItemOfferedEvent; import com.eu.habbo.plugin.events.marketplace.MarketPlaceItemOfferedEvent;
import com.eu.habbo.plugin.events.marketplace.MarketPlaceItemSoldEvent; import com.eu.habbo.plugin.events.marketplace.MarketPlaceItemSoldEvent;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -26,6 +28,8 @@ import java.util.List;
public class MarketPlace { public class MarketPlace {
private static final Logger LOGGER = LoggerFactory.getLogger(MarketPlace.class);
//Configuration. Loaded from database & updated accordingly. //Configuration. Loaded from database & updated accordingly.
public static boolean MARKETPLACE_ENABLED = true; public static boolean MARKETPLACE_ENABLED = true;
@ -43,7 +47,7 @@ public class MarketPlace {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return offers; return offers;
@ -101,7 +105,7 @@ public class MarketPlace {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
habbo.getClient().sendResponse(new MarketplaceCancelSaleComposer(offer, false)); habbo.getClient().sendResponse(new MarketplaceCancelSaleComposer(offer, false));
} }
} }
@ -163,7 +167,7 @@ public class MarketPlace {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return offers; return offers;
@ -193,7 +197,7 @@ public class MarketPlace {
message.appendInt(1); message.appendInt(1);
message.appendInt(itemId); message.appendInt(itemId);
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -208,7 +212,7 @@ public class MarketPlace {
number = set.getInt("number"); number = set.getInt("number");
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return number; return number;
@ -226,7 +230,7 @@ public class MarketPlace {
avg = set.getInt("avg"); avg = set.getInt("avg");
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return calculateCommision(avg); return calculateCommision(avg);
@ -294,7 +298,7 @@ public class MarketPlace {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -321,7 +325,7 @@ public class MarketPlace {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -388,7 +392,7 @@ public class MarketPlace {
statement.setInt(2, offer.getOfferId()); statement.setInt(2, offer.getOfferId());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }

View File

@ -5,10 +5,14 @@ import com.eu.habbo.habbohotel.items.FurnitureType;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.*; import java.sql.*;
public class MarketPlaceOffer implements Runnable { public class MarketPlaceOffer implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(MarketPlaceOffer.class);
public int avarage; public int avarage;
public int count; public int count;
private int offerId; private int offerId;
@ -66,7 +70,7 @@ public class MarketPlaceOffer implements Runnable {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -86,7 +90,7 @@ public class MarketPlaceOffer implements Runnable {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -160,7 +164,7 @@ public class MarketPlaceOffer implements Runnable {
statement.setInt(3, this.offerId); statement.setInt(3, this.offerId);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -3,12 +3,16 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.YoutubeManager; import com.eu.habbo.habbohotel.items.YoutubeManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
public class AddYoutubePlaylistCommand extends Command { public class AddYoutubePlaylistCommand extends Command {
private static final Logger LOGGER = LoggerFactory.getLogger(AddYoutubePlaylistCommand.class);
public AddYoutubePlaylistCommand() { public AddYoutubePlaylistCommand() {
super("cmd_add_youtube_playlist", Emulator.getTexts().getValue("commands.keys.cmd_add_youtube_playlist").split(";")); super("cmd_add_youtube_playlist", Emulator.getTexts().getValue("commands.keys.cmd_add_youtube_playlist").split(";"));
} }
@ -49,7 +53,7 @@ public class AddYoutubePlaylistCommand extends Command {
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_add_youtube_playlist")); gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_add_youtube_playlist"));

View File

@ -6,6 +6,8 @@ import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.users.HabboManager; import com.eu.habbo.habbohotel.users.HabboManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -13,6 +15,8 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class BadgeCommand extends Command { public class BadgeCommand extends Command {
private static final Logger LOGGER = LoggerFactory.getLogger(BadgeCommand.class);
public BadgeCommand() { public BadgeCommand() {
super("cmd_badge", Emulator.getTexts().getValue("commands.keys.cmd_badge").split(";")); super("cmd_badge", Emulator.getTexts().getValue("commands.keys.cmd_badge").split(";"));
} }
@ -72,7 +76,7 @@ public class BadgeCommand extends Command {
return true; return true;
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -15,6 +15,8 @@ import com.eu.habbo.plugin.events.users.UserCommandEvent;
import com.eu.habbo.plugin.events.users.UserExecuteCommandEvent; import com.eu.habbo.plugin.events.users.UserExecuteCommandEvent;
import gnu.trove.iterator.TIntObjectIterator; import gnu.trove.iterator.TIntObjectIterator;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
@ -22,6 +24,9 @@ import java.util.List;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
public class CommandHandler { public class CommandHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(CommandHandler.class);
private final static THashMap<String, Command> commands = new THashMap<>(5); private final static THashMap<String, Command> commands = new THashMap<>(5);
private static final Comparator<Command> ALPHABETICAL_ORDER = new Comparator<Command>() { private static final Comparator<Command> ALPHABETICAL_ORDER = new Comparator<Command>() {
public int compare(Command c1, Command c2) { public int compare(Command c1, Command c2) {
@ -33,7 +38,7 @@ public class CommandHandler {
public CommandHandler() { public CommandHandler() {
long millis = System.currentTimeMillis(); long millis = System.currentTimeMillis();
this.reloadCommands(); this.reloadCommands();
Emulator.getLogging().logStart("Command Handler -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); LOGGER.info("Command Handler -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
} }
public static void addCommand(Command command) { public static void addCommand(Command command) {
@ -48,9 +53,9 @@ public class CommandHandler {
try { try {
//command.getConstructor().setAccessible(true); //command.getConstructor().setAccessible(true);
addCommand(command.newInstance()); addCommand(command.newInstance());
Emulator.getLogging().logDebugLine("Added command: " + command.getName()); LOGGER.debug("Added command: {}", command.getName());
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
@ -79,11 +84,11 @@ public class CommandHandler {
succes = event.succes; succes = event.succes;
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
if (gameClient.getHabbo().getHabboInfo().getRank().isLogCommands()) { if (gameClient.getHabbo().getHabboInfo().getRank().isLogCommands()) {
Emulator.getLogging().addLog(new CommandLog(gameClient.getHabbo().getHabboInfo().getId(), command, commandLine, succes)); Emulator.getDatabaseLogger().store(new CommandLog(gameClient.getHabbo().getHabboInfo().getId(), command, commandLine, succes));
} }
} }
@ -305,7 +310,6 @@ public class CommandHandler {
public void dispose() { public void dispose() {
commands.clear(); commands.clear();
LOGGER.info("Command Handler -> Disposed!");
Emulator.getLogging().logShutdownLine("Command Handler -> Disposed!");
} }
} }

View File

@ -4,8 +4,12 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class EnableCommand extends Command { public class EnableCommand extends Command {
private static final Logger LOGGER = LoggerFactory.getLogger(EnableCommand.class);
public EnableCommand() { public EnableCommand() {
super("cmd_enable", Emulator.getTexts().getValue("commands.keys.cmd_enable").split(";")); super("cmd_enable", Emulator.getTexts().getValue("commands.keys.cmd_enable").split(";"));
} }
@ -38,7 +42,7 @@ public class EnableCommand extends Command {
} }
} }
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
} }

View File

@ -4,12 +4,16 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.modtool.WordFilter; import com.eu.habbo.habbohotel.modtool.WordFilter;
import com.eu.habbo.habbohotel.modtool.WordFilterWord; import com.eu.habbo.habbohotel.modtool.WordFilterWord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
public class FilterWordCommand extends Command { public class FilterWordCommand extends Command {
private static final Logger LOGGER = LoggerFactory.getLogger(FilterWordCommand.class);
public FilterWordCommand() { public FilterWordCommand() {
super("cmd_filterword", Emulator.getTexts().getValue("commands.keys.cmd_filterword").split(";")); super("cmd_filterword", Emulator.getTexts().getValue("commands.keys.cmd_filterword").split(";"));
} }
@ -35,7 +39,7 @@ public class FilterWordCommand extends Command {
statement.setString(2, replacement); statement.setString(2, replacement);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_filterword.error")); gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_filterword.error"));
return true; return true;
} }

View File

@ -7,10 +7,14 @@ import com.eu.habbo.habbohotel.catalog.CatalogPageLayouts;
import com.eu.habbo.habbohotel.catalog.layouts.RoomBundleLayout; import com.eu.habbo.habbohotel.catalog.layouts.RoomBundleLayout;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.*; import java.sql.*;
public class RoomBundleCommand extends Command { public class RoomBundleCommand extends Command {
private static final Logger LOGGER = LoggerFactory.getLogger(RoomBundleCommand.class);
public RoomBundleCommand() { public RoomBundleCommand() {
super("cmd_bundle", Emulator.getTexts().getValue("commands.keys.cmd_bundle").split(";")); super("cmd_bundle", Emulator.getTexts().getValue("commands.keys.cmd_bundle").split(";"));
} }
@ -62,7 +66,7 @@ public class RoomBundleCommand extends Command {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
((RoomBundleLayout) page).loadItems(gameClient.getHabbo().getHabboInfo().getCurrentRoom()); ((RoomBundleLayout) page).loadItems(gameClient.getHabbo().getHabboInfo().getCurrentRoom());

View File

@ -4,6 +4,8 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import gnu.trove.procedure.TObjectProcedure; import gnu.trove.procedure.TObjectProcedure;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -11,6 +13,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class CraftingManager { public class CraftingManager {
private static final Logger LOGGER = LoggerFactory.getLogger(CraftingManager.class);
private final THashMap<Item, CraftingAltar> altars; private final THashMap<Item, CraftingAltar> altars;
@ -53,14 +56,14 @@ public class CraftingManager {
recipe.addIngredient(ingredientItem, set.getInt("crafting_recipes_ingredients.amount")); recipe.addIngredient(ingredientItem, set.getInt("crafting_recipes_ingredients.amount"));
altar.addIngredient(ingredientItem); altar.addIngredient(ingredientItem);
} else { } else {
Emulator.getLogging().logErrorLine("Unknown ingredient item " + set.getInt("crafting_recipes_ingredients.item_id")); LOGGER.error("Unknown ingredient item " + set.getInt("crafting_recipes_ingredients.item_id"));
} }
} }
} }
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -114,7 +117,7 @@ public class CraftingManager {
} }
statement.executeBatch(); statement.executeBatch();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
this.altars.clear(); this.altars.clear();

View File

@ -1,16 +1,14 @@
package com.eu.habbo.habbohotel.gameclients; package com.eu.habbo.habbohotel.gameclients;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.core.Logging;
import com.eu.habbo.crypto.HabboEncryption; import com.eu.habbo.crypto.HabboEncryption;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.PacketManager;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.MessageComposer;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -20,6 +18,8 @@ import java.util.concurrent.ConcurrentHashMap;
public class GameClient { public class GameClient {
private static final Logger LOGGER = LoggerFactory.getLogger(GameClient.class);
private final Channel channel; private final Channel channel;
private final HabboEncryption encryption; private final HabboEncryption encryption;
@ -81,7 +81,7 @@ public class GameClient {
statement.setInt(2, this.habbo.getHabboInfo().getId()); statement.setInt(2, this.habbo.getHabboInfo().getId());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
@ -92,7 +92,7 @@ public class GameClient {
this.channel.write(composer.compose().retain(), this.channel.voidPromise()); this.channel.write(composer.compose().retain(), this.channel.voidPromise());
this.channel.flush(); this.channel.flush();
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logPacketError(e); LOGGER.error("Caught exception", e);
} }
} }
} }
@ -135,7 +135,7 @@ public class GameClient {
this.habbo = null; this.habbo = null;
} }
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
} }

View File

@ -20,12 +20,14 @@ import com.eu.habbo.plugin.events.games.GameStartedEvent;
import com.eu.habbo.plugin.events.games.GameStoppedEvent; import com.eu.habbo.plugin.events.games.GameStoppedEvent;
import com.eu.habbo.threading.runnables.SaveScoreForTeam; import com.eu.habbo.threading.runnables.SaveScoreForTeam;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public abstract class Game implements Runnable { public abstract class Game implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(Game.class);
protected final THashMap<GameTeamColors, GameTeam> teams = new THashMap<>(); protected final THashMap<GameTeamColors, GameTeam> teams = new THashMap<>();
protected final Room room; protected final Room room;
private final Class<? extends GameTeam> gameTeamClazz; private final Class<? extends GameTeam> gameTeamClazz;
@ -73,7 +75,7 @@ public abstract class Game implements Runnable {
return true; return true;
} }
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
return false; return false;

View File

@ -17,12 +17,16 @@ import com.eu.habbo.messages.outgoing.rooms.users.RoomUserActionComposer;
import com.eu.habbo.threading.runnables.BattleBanzaiTilesFlicker; import com.eu.habbo.threading.runnables.BattleBanzaiTilesFlicker;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*; import java.util.*;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
public class BattleBanzaiGame extends Game { public class BattleBanzaiGame extends Game {
private static final Logger LOGGER = LoggerFactory.getLogger(BattleBanzaiGame.class);
public static final int effectId = 32; public static final int effectId = 32;
@ -149,7 +153,7 @@ public class BattleBanzaiGame extends Game {
} }
} }
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }

View File

@ -23,11 +23,15 @@ import com.eu.habbo.threading.runnables.freeze.FreezeThrowSnowball;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import gnu.trove.procedure.TObjectProcedure; import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class FreezeGame extends Game { public class FreezeGame extends Game {
private static final Logger LOGGER = LoggerFactory.getLogger(FreezeGame.class);
public static final int effectId = 39; public static final int effectId = 39;
public static int POWER_UP_POINTS; public static int POWER_UP_POINTS;
@ -261,7 +265,7 @@ public class FreezeGame extends Game {
} }
} }
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }

View File

@ -1,6 +1,8 @@
package com.eu.habbo.habbohotel.guilds; package com.eu.habbo.habbohotel.guilds;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -8,6 +10,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class Guild implements Runnable { public class Guild implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(Guild.class);
public boolean needsUpdate; public boolean needsUpdate;
public int lastRequested = Emulator.getIntUnixTimestamp(); public int lastRequested = Emulator.getIntUnixTimestamp();
private int id; private int id;
@ -91,7 +94,7 @@ public class Guild implements Runnable {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -116,7 +119,7 @@ public class Guild implements Runnable {
this.needsUpdate = false; this.needsUpdate = false;
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -13,6 +13,8 @@ import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.*; import java.sql.*;
import java.util.*; import java.util.*;
@ -20,6 +22,8 @@ import java.util.stream.Collectors;
public class GuildManager { public class GuildManager {
private static final Logger LOGGER = LoggerFactory.getLogger(GuildManager.class);
private final THashMap<GuildPartType, THashMap<Integer, GuildPart>> guildParts; private final THashMap<GuildPartType, THashMap<Integer, GuildPart>> guildParts;
private final TIntObjectMap<Guild> guilds; private final TIntObjectMap<Guild> guilds;
@ -34,7 +38,7 @@ public class GuildManager {
this.loadGuildParts(); this.loadGuildParts();
this.loadGuildViews(); this.loadGuildViews();
Emulator.getLogging().logStart("Guild Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); LOGGER.info("Guild Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
} }
@ -52,7 +56,7 @@ public class GuildManager {
this.guildParts.get(GuildPartType.valueOf(set.getString("type").toUpperCase())).put(set.getInt("id"), new GuildPart(set)); this.guildParts.get(GuildPartType.valueOf(set.getString("type").toUpperCase())).put(set.getInt("id"), new GuildPart(set));
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -66,7 +70,7 @@ public class GuildManager {
this.views.add(new ForumView(set)); this.views.add(new ForumView(set));
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -107,7 +111,7 @@ public class GuildManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
habbo.getHabboStats().addGuild(guild.getId()); habbo.getHabboStats().addGuild(guild.getId());
@ -155,7 +159,7 @@ public class GuildManager {
room.setGuild(0); room.setGuild(0);
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -276,7 +280,7 @@ public class GuildManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -288,7 +292,7 @@ public class GuildManager {
statement.setInt(3, guild.getId()); statement.setInt(3, guild.getId());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -303,7 +307,7 @@ public class GuildManager {
statement.setInt(3, guild.getId()); statement.setInt(3, guild.getId());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -325,7 +329,7 @@ public class GuildManager {
statement.setInt(2, guild.getId()); statement.setInt(2, guild.getId());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -352,7 +356,7 @@ public class GuildManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return member; return member;
@ -375,7 +379,7 @@ public class GuildManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return guildMembers; return guildMembers;
@ -397,7 +401,7 @@ public class GuildManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return guildMembers; return guildMembers;
@ -416,7 +420,7 @@ public class GuildManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return 0; return 0;
@ -434,7 +438,7 @@ public class GuildManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return guildAdmins; return guildAdmins;
@ -466,7 +470,7 @@ public class GuildManager {
if (g != null) if (g != null)
g.loadMemberCount(); g.loadMemberCount();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -494,7 +498,7 @@ public class GuildManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return guilds; return guilds;
@ -514,7 +518,7 @@ public class GuildManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return guilds; return guilds;
@ -593,7 +597,7 @@ public class GuildManager {
statement.setInt(2, furni.getId()); statement.setInt(2, furni.getId());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -608,7 +612,7 @@ public class GuildManager {
guildIterator.remove(); guildIterator.remove();
} }
Emulator.getLogging().logShutdownLine("Guild Manager -> Disposed!"); LOGGER.info("Guild Manager -> Disposed!");
} }
public boolean hasViewedForum(int userId, int guildId) { public boolean hasViewedForum(int userId, int guildId) {
@ -628,7 +632,7 @@ public class GuildManager {
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }

View File

@ -9,11 +9,15 @@ import com.eu.habbo.plugin.events.guilds.forums.GuildForumThreadBeforeCreated;
import com.eu.habbo.plugin.events.guilds.forums.GuildForumThreadCreated; import com.eu.habbo.plugin.events.guilds.forums.GuildForumThreadCreated;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.*; import java.sql.*;
import java.util.*; import java.util.*;
public class ForumThread implements Runnable, ISerialize { public class ForumThread implements Runnable, ISerialize {
private static final Logger LOGGER = LoggerFactory.getLogger(ForumThread.class);
private final static THashMap<Integer, THashSet<ForumThread>> guildThreadsCache = new THashMap<>(); private final static THashMap<Integer, THashSet<ForumThread>> guildThreadsCache = new THashMap<>();
private final static THashMap<Integer, ForumThread> forumThreadsCache = new THashMap<>(); private final static THashMap<Integer, ForumThread> forumThreadsCache = new THashMap<>();
@ -108,7 +112,7 @@ public class ForumThread implements Runnable, ISerialize {
Emulator.getPluginManager().fireEvent(new GuildForumThreadCreated(createdThread)); Emulator.getPluginManager().fireEvent(new GuildForumThreadCreated(createdThread));
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return createdThread; return createdThread;
@ -156,7 +160,7 @@ public class ForumThread implements Runnable, ISerialize {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return threads; return threads;
@ -195,7 +199,7 @@ public class ForumThread implements Runnable, ISerialize {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return foundThread; return foundThread;
@ -337,7 +341,7 @@ public class ForumThread implements Runnable, ISerialize {
addComment(comment); addComment(comment);
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
@ -461,7 +465,7 @@ public class ForumThread implements Runnable, ISerialize {
this.needsUpdate = false; this.needsUpdate = false;
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -8,10 +8,13 @@ import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.plugin.events.guilds.forums.GuildForumThreadCommentBeforeCreated; import com.eu.habbo.plugin.events.guilds.forums.GuildForumThreadCommentBeforeCreated;
import com.eu.habbo.plugin.events.guilds.forums.GuildForumThreadCommentCreated; import com.eu.habbo.plugin.events.guilds.forums.GuildForumThreadCommentCreated;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.*; import java.sql.*;
public class ForumThreadComment implements Runnable, ISerialize { public class ForumThreadComment implements Runnable, ISerialize {
private static final Logger LOGGER = LoggerFactory.getLogger(ForumThreadComment.class);
private static THashMap<Integer, ForumThreadComment> forumCommentsCache = new THashMap<>(); private static THashMap<Integer, ForumThreadComment> forumCommentsCache = new THashMap<>();
private final int commentId; private final int commentId;
@ -64,7 +67,7 @@ public class ForumThreadComment implements Runnable, ISerialize {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return foundComment; return foundComment;
@ -103,7 +106,7 @@ public class ForumThreadComment implements Runnable, ISerialize {
Emulator.getPluginManager().fireEvent(new GuildForumThreadCommentCreated(createdComment)); Emulator.getPluginManager().fireEvent(new GuildForumThreadCommentCreated(createdComment));
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return createdComment; return createdComment;
@ -200,7 +203,7 @@ public class ForumThreadComment implements Runnable, ISerialize {
this.needsUpdate = false; this.needsUpdate = false;
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -2,6 +2,8 @@ package com.eu.habbo.habbohotel.hotelview;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -9,6 +11,7 @@ import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
public class HallOfFame { public class HallOfFame {
private static final Logger LOGGER = LoggerFactory.getLogger(HallOfFame.class);
private final THashMap<Integer, HallOfFameWinner> winners = new THashMap<>(); private final THashMap<Integer, HallOfFameWinner> winners = new THashMap<>();
@ -32,7 +35,7 @@ public class HallOfFame {
this.winners.put(winner.getId(), winner); this.winners.put(winner.getId(), winner);
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -1,8 +1,12 @@
package com.eu.habbo.habbohotel.hotelview; package com.eu.habbo.habbohotel.hotelview;
import com.eu.habbo.Emulator; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HotelViewManager { public class HotelViewManager {
private static final Logger LOGGER = LoggerFactory.getLogger(HotelViewManager.class);
private final HallOfFame hallOfFame; private final HallOfFame hallOfFame;
private final NewsList newsList; private final NewsList newsList;
@ -11,7 +15,7 @@ public class HotelViewManager {
this.hallOfFame = new HallOfFame(); this.hallOfFame = new HallOfFame();
this.newsList = new NewsList(); this.newsList = new NewsList();
Emulator.getLogging().logStart("Hotelview Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); LOGGER.info("Hotelview Manager -> Loaded! ({} MS)", System.currentTimeMillis() - millis);
} }
public HallOfFame getHallOfFame() { public HallOfFame getHallOfFame() {
@ -23,6 +27,7 @@ public class HotelViewManager {
} }
public void dispose() { public void dispose() {
Emulator.getLogging().logShutdownLine("HotelView Manager -> Disposed!"); LOGGER.info("HotelView Manager -> Disposed!");
} }
} }

View File

@ -1,6 +1,8 @@
package com.eu.habbo.habbohotel.hotelview; package com.eu.habbo.habbohotel.hotelview;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -9,6 +11,8 @@ import java.sql.Statement;
import java.util.ArrayList; import java.util.ArrayList;
public class NewsList { public class NewsList {
private static final Logger LOGGER = LoggerFactory.getLogger(NewsList.class);
private final ArrayList<NewsWidget> newsWidgets; private final ArrayList<NewsWidget> newsWidgets;
public NewsList() { public NewsList() {
@ -25,7 +29,7 @@ public class NewsList {
this.newsWidgets.add(new NewsWidget(set)); this.newsWidgets.add(new NewsWidget(set));
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -1,6 +1,8 @@
package com.eu.habbo.habbohotel.items; package com.eu.habbo.habbohotel.items;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -9,6 +11,8 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class CrackableReward { public class CrackableReward {
private static final Logger LOGGER = LoggerFactory.getLogger(CrackableReward.class);
public final int itemId; public final int itemId;
public final int count; public final int count;
public final Map<Integer, Map.Entry<Integer, Integer>> prizes; public final Map<Integer, Map.Entry<Integer, Integer>> prizes;
@ -44,7 +48,7 @@ public class CrackableReward {
itemId = Integer.valueOf(prize.split(":")[0]); itemId = Integer.valueOf(prize.split(":")[0]);
chance = Integer.valueOf(prize.split(":")[1]); chance = Integer.valueOf(prize.split(":")[1]);
} else if (prize.contains(":")) { } else if (prize.contains(":")) {
Emulator.getLogging().logErrorLine("Invalid configuration of crackable prizes (item id: " + this.itemId + "). '" + prize + "' format should be itemId:chance."); LOGGER.error("Invalid configuration of crackable prizes (item id: " + this.itemId + "). '" + prize + "' format should be itemId:chance.");
} else { } else {
itemId = Integer.valueOf(prize.replace(":", "")); itemId = Integer.valueOf(prize.replace(":", ""));
} }
@ -52,7 +56,7 @@ public class CrackableReward {
this.prizes.put(itemId, new AbstractMap.SimpleEntry<>(this.totalChance, this.totalChance + chance)); this.prizes.put(itemId, new AbstractMap.SimpleEntry<>(this.totalChance, this.totalChance + chance));
this.totalChance += chance; this.totalChance += chance;
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
} }

View File

@ -60,12 +60,17 @@ import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.sql.*; import java.sql.*;
import java.util.*; import java.util.*;
public class ItemManager { public class ItemManager {
private static final Logger LOGGER = LoggerFactory.getLogger(ItemManager.class);
//Configuration. Loaded from database & updated accordingly. //Configuration. Loaded from database & updated accordingly.
public static boolean RECYCLER_ENABLED = true; public static boolean RECYCLER_ENABLED = true;
@ -100,7 +105,7 @@ public class ItemManager {
this.highscoreManager.load(); this.highscoreManager.load();
this.loadNewUserGifts(); this.loadNewUserGifts();
Emulator.getLogging().logStart("Item Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); LOGGER.info("Item Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
} }
protected void loadItemInteractions() { protected void loadItemInteractions() {
@ -354,7 +359,7 @@ public class ItemManager {
return interaction; return interaction;
} }
Emulator.getLogging().logDebugLine("Can't find interaction class:" + type.getName()); LOGGER.debug("Can't find interaction class: {}", type.getName());
return this.getItemInteraction(InteractionDefault.class); return this.getItemInteraction(InteractionDefault.class);
} }
@ -384,12 +389,12 @@ public class ItemManager {
else else
this.items.get(id).update(set); this.items.get(id).update(set);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine("Failed to load Item (" + set.getInt("id") + ")"); LOGGER.error("Failed to load Item ({})", set.getInt("id"));
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -402,16 +407,16 @@ public class ItemManager {
try { try {
reward = new CrackableReward(set); reward = new CrackableReward(set);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine("Failed to load items_crackable item_id = " + set.getInt("item_id")); LOGGER.error("Failed to load items_crackable item_id = {}", set.getInt("item_id"));
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
continue; continue;
} }
this.crackableRewards.put(set.getInt("item_id"), reward); this.crackableRewards.put(set.getInt("item_id"), reward);
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
@ -445,7 +450,7 @@ public class ItemManager {
this.soundTracks.put(set.getString("code"), new SoundTrack(set)); this.soundTracks.put(set.getString("code"), new SoundTrack(set));
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -478,16 +483,16 @@ public class ItemManager {
try { try {
return itemClass.getDeclaredConstructor(int.class, int.class, Item.class, String.class, int.class, int.class).newInstance(set.getInt(1), habboId, item, extraData, limitedStack, limitedSells); return itemClass.getDeclaredConstructor(int.class, int.class, Item.class, String.class, int.class, int.class).newInstance(set.getInt(1), habboId, item, extraData, limitedStack, limitedSells);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
return new InteractionDefault(set.getInt(1), habboId, item, extraData, limitedStack, limitedSells); return new InteractionDefault(set.getInt(1), habboId, item, extraData, limitedStack, limitedSells);
} }
} }
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
return null; return null;
} }
@ -502,7 +507,7 @@ public class ItemManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -527,7 +532,7 @@ public class ItemManager {
statement.setInt(1, item.getId()); statement.setInt(1, item.getId());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -554,7 +559,7 @@ public class ItemManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return item; return item;
@ -594,9 +599,9 @@ public class ItemManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
return item; return item;
@ -608,7 +613,7 @@ public class ItemManager {
statement.setInt(2, itemTwoId); statement.setInt(2, itemTwoId);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -618,7 +623,7 @@ public class ItemManager {
statement.setInt(2, hopper.getBaseItem().getId()); statement.setInt(2, hopper.getBaseItem().getId());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -633,7 +638,7 @@ public class ItemManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return a; return a;
@ -649,9 +654,9 @@ public class ItemManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
return item; return item;
@ -672,7 +677,7 @@ public class ItemManager {
return (HabboItem) c.newInstance(set, baseItem); return (HabboItem) c.newInstance(set, baseItem);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
@ -695,7 +700,7 @@ public class ItemManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -703,7 +708,7 @@ public class ItemManager {
return null; return null;
if (extraData.length() > 1000) { if (extraData.length() > 1000) {
Emulator.getLogging().logErrorLine("Extradata exceeds maximum length of 1000 characters:" + extraData); LOGGER.error("Extradata exceeds maximum length of 1000 characters: {}", extraData);
extraData = extraData.substring(0, 1000); extraData = extraData.substring(0, 1000);
} }
@ -720,7 +725,7 @@ public class ItemManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
if (gift != null) { if (gift != null) {
@ -774,7 +779,7 @@ public class ItemManager {
this.items.clear(); this.items.clear();
this.highscoreManager.dispose(); this.highscoreManager.dispose();
Emulator.getLogging().logShutdownLine("Item Manager -> Disposed!"); LOGGER.info("Item Manager -> Disposed!");
} }
public List<String> getInteractionList() { public List<String> getInteractionList() {

View File

@ -1,10 +1,13 @@
package com.eu.habbo.habbohotel.items; package com.eu.habbo.habbohotel.items;
import com.eu.habbo.Emulator; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays; import java.util.Arrays;
public class RandomStateParams { public class RandomStateParams {
private static final Logger LOGGER = LoggerFactory.getLogger(RandomStateParams.class);
private int states = -1; private int states = -1;
private int delay = -1; private int delay = -1;
@ -22,7 +25,7 @@ public class RandomStateParams {
this.delay = Integer.parseInt(keyValue[1]); this.delay = Integer.parseInt(keyValue[1]);
break; break;
default: default:
Emulator.getLogging().logDebugLine("RandomStateParams: unknown key: " + keyValue[0]); LOGGER.warn("RandomStateParams: unknown key: " + keyValue[0]);
break; break;
} }
}); });

View File

@ -6,12 +6,13 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.sql.*; import java.sql.*;
import java.util.ArrayList; import java.util.ArrayList;
@ -20,6 +21,8 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
public class YoutubeManager { public class YoutubeManager {
private static final Logger LOGGER = LoggerFactory.getLogger(YoutubeManager.class);
public class YoutubeVideo { public class YoutubeVideo {
private final String id; private final String id;
private final int duration; private final int duration;
@ -80,7 +83,7 @@ public class YoutubeManager {
Emulator.getThreading().run(() -> { Emulator.getThreading().run(() -> {
ExecutorService youtubeDataLoaderPool = Executors.newFixedThreadPool(10); ExecutorService youtubeDataLoaderPool = Executors.newFixedThreadPool(10);
Emulator.getLogging().logStart("YouTube Manager -> Loading..."); LOGGER.info("YouTube Manager -> Loading...");
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM youtube_playlists")) { try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM youtube_playlists")) {
try (ResultSet set = statement.executeQuery()) { try (ResultSet set = statement.executeQuery()) {
@ -95,7 +98,7 @@ public class YoutubeManager {
if (playlist != null) { if (playlist != null) {
playlists.add(playlist); playlists.add(playlist);
} else { } else {
Emulator.getLogging().logErrorLine("Failed to load YouTube playlist: " + playlistId); LOGGER.error("Failed to load YouTube playlist: " + playlistId);
} }
this.playlists.put(itemId, playlists); this.playlists.put(itemId, playlists);
@ -103,7 +106,7 @@ public class YoutubeManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
youtubeDataLoaderPool.shutdown(); youtubeDataLoaderPool.shutdown();
@ -113,7 +116,7 @@ public class YoutubeManager {
e.printStackTrace(); e.printStackTrace();
} }
Emulator.getLogging().logStart("YouTube Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); LOGGER.info("YouTube Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}); });
} }

View File

@ -1,14 +1,17 @@
package com.eu.habbo.habbohotel.items.interactions; package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class InteractionColorPlate extends InteractionDefault { public class InteractionColorPlate extends InteractionDefault {
private static final Logger LOGGER = LoggerFactory.getLogger(InteractionColorPlate.class);
public InteractionColorPlate(ResultSet set, Item baseItem) throws SQLException { public InteractionColorPlate(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem); super(set, baseItem);
} }
@ -41,7 +44,7 @@ public class InteractionColorPlate extends InteractionDefault {
try { try {
state = Integer.valueOf(this.getExtradata()); state = Integer.valueOf(this.getExtradata());
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
state += amount; state += amount;

View File

@ -1,6 +1,5 @@
package com.eu.habbo.habbohotel.items.interactions; package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
@ -10,11 +9,15 @@ import com.eu.habbo.habbohotel.users.HabboGender;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class InteractionDefault extends HabboItem { public class InteractionDefault extends HabboItem {
private static final Logger LOGGER = LoggerFactory.getLogger(InteractionDefault.class);
public InteractionDefault(ResultSet set, Item baseItem) throws SQLException { public InteractionDefault(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem); super(set, baseItem);
} }
@ -74,7 +77,7 @@ public class InteractionDefault extends HabboItem {
try { try {
currentState = Integer.valueOf(this.getExtradata()); currentState = Integer.valueOf(this.getExtradata());
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
Emulator.getLogging().logErrorLine("Incorrect extradata (" + this.getExtradata() + ") for item ID (" + this.getId() + ") of type (" + this.getBaseItem().getName() + ")"); LOGGER.error("Incorrect extradata (" + this.getExtradata() + ") for item ID (" + this.getId() + ") of type (" + this.getBaseItem().getName() + ")");
} }
this.setExtradata("" + (currentState + 1) % this.getBaseItem().getStateCount()); this.setExtradata("" + (currentState + 1) % this.getBaseItem().getStateCount());

View File

@ -8,11 +8,15 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class InteractionGift extends HabboItem { public class InteractionGift extends HabboItem {
private static final Logger LOGGER = LoggerFactory.getLogger(InteractionGift.class);
public boolean explode = false; public boolean explode = false;
private int[] itemId; private int[] itemId;
private int colorId = 0; private int colorId = 0;
@ -28,7 +32,7 @@ public class InteractionGift extends HabboItem {
try { try {
this.loadData(); this.loadData();
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logDebugLine("Incorrect extradata for gift with ID " + this.getId()); LOGGER.warn("Incorrect extradata for gift with ID " + this.getId());
} }
} }
@ -38,7 +42,7 @@ public class InteractionGift extends HabboItem {
try { try {
this.loadData(); this.loadData();
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logDebugLine("Incorrect extradata for gift with ID " + this.getId()); LOGGER.warn("Incorrect extradata for gift with ID " + this.getId());
} }
} }

View File

@ -1,17 +1,19 @@
package com.eu.habbo.habbohotel.items.interactions; package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.jukebox.JukeBoxMySongsComposer; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class InteractionMusicDisc extends HabboItem { public class InteractionMusicDisc extends HabboItem {
private static final Logger LOGGER = LoggerFactory.getLogger(InteractionMusicDisc.class);
private int songId; private int songId;
public InteractionMusicDisc(ResultSet set, Item baseItem) throws SQLException { public InteractionMusicDisc(ResultSet set, Item baseItem) throws SQLException {
@ -23,7 +25,7 @@ public class InteractionMusicDisc extends HabboItem {
try { try {
this.songId = Integer.valueOf(stuff[6]); this.songId = Integer.valueOf(stuff[6]);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine("Warning: Item " + this.getId() + " has an invalid song id set for its music disk!"); LOGGER.error("Warning: Item " + this.getId() + " has an invalid song id set for its music disk!");
} }
} }
} }
@ -37,7 +39,7 @@ public class InteractionMusicDisc extends HabboItem {
try { try {
this.songId = Integer.valueOf(stuff[6]); this.songId = Integer.valueOf(stuff[6]);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine("Warning: Item " + this.getId() + " has an invalid song id set for its music disk!"); LOGGER.error("Warning: Item " + this.getId() + " has an invalid song id set for its music disk!");
} }
} }
} }

View File

@ -12,6 +12,8 @@ import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.rentablespaces.RentableSpaceInfoComposer; import com.eu.habbo.messages.outgoing.rooms.items.rentablespaces.RentableSpaceInfoComposer;
import com.eu.habbo.threading.runnables.ClearRentedSpace; import com.eu.habbo.threading.runnables.ClearRentedSpace;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.awt.*; import java.awt.*;
import java.sql.Connection; import java.sql.Connection;
@ -20,6 +22,8 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class InteractionRentableSpace extends HabboItem { public class InteractionRentableSpace extends HabboItem {
private static final Logger LOGGER = LoggerFactory.getLogger(InteractionRentableSpace.class);
private int renterId; private int renterId;
private String renterName; private String renterName;
private int endTimestamp; private int endTimestamp;
@ -50,7 +54,7 @@ public class InteractionRentableSpace extends HabboItem {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} else { } else {
@ -180,7 +184,7 @@ public class InteractionRentableSpace extends HabboItem {
statement.setInt(1, zero); statement.setInt(1, zero);
statement.setInt(2, zero); statement.setInt(2, zero);
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }

View File

@ -7,6 +7,8 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer; import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -14,6 +16,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public abstract class InteractionWired extends HabboItem { public abstract class InteractionWired extends HabboItem {
private static final Logger LOGGER = LoggerFactory.getLogger(InteractionWired.class);
private long cooldown; private long cooldown;
InteractionWired(ResultSet set, Item baseItem) throws SQLException { InteractionWired(ResultSet set, Item baseItem) throws SQLException {
@ -71,7 +74,7 @@ public abstract class InteractionWired extends HabboItem {
statement.setInt(2, this.getId()); statement.setInt(2, this.getId());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
super.run(); super.run();

View File

@ -3,19 +3,23 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreRow;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreClearType; import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreClearType;
import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreRow;
import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreScoreType; import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreScoreType;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.List; import java.util.List;
public class InteractionWiredHighscore extends HabboItem { public class InteractionWiredHighscore extends HabboItem {
private static final Logger LOGGER = LoggerFactory.getLogger(InteractionWiredHighscore.class);
public WiredHighscoreScoreType scoreType; public WiredHighscoreScoreType scoreType;
public WiredHighscoreClearType clearType; public WiredHighscoreClearType clearType;
@ -33,7 +37,7 @@ public class InteractionWiredHighscore extends HabboItem {
this.scoreType = WiredHighscoreScoreType.valueOf(name); this.scoreType = WiredHighscoreScoreType.valueOf(name);
this.clearType = WiredHighscoreClearType.values()[ctype]; this.clearType = WiredHighscoreClearType.values()[ctype];
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
this.reloadData(); this.reloadData();
@ -51,7 +55,7 @@ public class InteractionWiredHighscore extends HabboItem {
this.scoreType = WiredHighscoreScoreType.valueOf(name); this.scoreType = WiredHighscoreScoreType.valueOf(name);
this.clearType = WiredHighscoreClearType.values()[ctype]; this.clearType = WiredHighscoreClearType.values()[ctype];
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
this.reloadData(); this.reloadData();
@ -83,7 +87,7 @@ public class InteractionWiredHighscore extends HabboItem {
this.setExtradata(Math.abs(state - 1) + ""); this.setExtradata(Math.abs(state - 1) + "");
room.updateItem(this); room.updateItem(this);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }

View File

@ -13,12 +13,16 @@ import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType; import com.eu.habbo.habbohotel.wired.WiredTriggerType;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.Arrays; import java.util.Arrays;
public class InteractionGameTimer extends HabboItem implements Runnable { public class InteractionGameTimer extends HabboItem implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(InteractionGameTimer.class);
private int[] TIMER_INTERVAL_STEPS = new int[] { 30, 60, 120, 180, 300, 600 }; private int[] TIMER_INTERVAL_STEPS = new int[] { 30, 60, 120, 180, 300, 600 };
private int baseTime = 0; private int baseTime = 0;
@ -89,7 +93,7 @@ public class InteractionGameTimer extends HabboItem implements Runnable {
} }
}).toArray(); }).toArray();
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
@ -117,7 +121,7 @@ public class InteractionGameTimer extends HabboItem implements Runnable {
room.addGame(game); room.addGame(game);
game.initialise(); game.initialise();
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
} }

View File

@ -1,6 +1,5 @@
package com.eu.habbo.habbohotel.items.interactions.wired.conditions; package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
@ -8,11 +7,15 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType; import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class WiredConditionHabboHasHandItem extends InteractionWiredCondition { public class WiredConditionHabboHasHandItem extends InteractionWiredCondition {
private static final Logger LOGGER = LoggerFactory.getLogger(WiredConditionHabboHasHandItem.class);
public static final WiredConditionType type = WiredConditionType.ACTOR_HAS_HANDITEM; public static final WiredConditionType type = WiredConditionType.ACTOR_HAS_HANDITEM;
private int handItem; private int handItem;
@ -71,7 +74,7 @@ public class WiredConditionHabboHasHandItem extends InteractionWiredCondition {
try { try {
this.handItem = Integer.valueOf(set.getString("wired_data")); this.handItem = Integer.valueOf(set.getString("wired_data"));
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }

View File

@ -17,11 +17,15 @@ import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer; import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class WiredEffectMatchFurni extends InteractionWiredEffect { public class WiredEffectMatchFurni extends InteractionWiredEffect {
private static final Logger LOGGER = LoggerFactory.getLogger(WiredEffectMatchFurni.class);
private static final WiredEffectType type = WiredEffectType.MATCH_SSHOT; private static final WiredEffectType type = WiredEffectType.MATCH_SSHOT;
public boolean checkForWiredResetPermission = true; public boolean checkForWiredResetPermission = true;
private THashSet<WiredMatchFurniSetting> settings; private THashSet<WiredMatchFurniSetting> settings;
@ -189,7 +193,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect {
} }
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }

View File

@ -19,6 +19,8 @@ import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import gnu.trove.procedure.TObjectProcedure; import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -26,6 +28,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class WiredEffectToggleFurni extends InteractionWiredEffect { public class WiredEffectToggleFurni extends InteractionWiredEffect {
private static final Logger LOGGER = LoggerFactory.getLogger(WiredEffectToggleFurni.class);
public static final WiredEffectType type = WiredEffectType.TOGGLE_STATE; public static final WiredEffectType type = WiredEffectType.TOGGLE_STATE;
private final THashSet<HabboItem> items; private final THashSet<HabboItem> items;
@ -136,7 +140,7 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
item.onClick(habbo != null && !(item instanceof InteractionGameTimer) ? habbo.getClient() : null, room, new Object[]{state, this.getType()}); item.onClick(habbo != null && !(item instanceof InteractionGameTimer) ? habbo.getClient() : null, room, new Object[]{state, this.getType()});
} }
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }

View File

@ -17,6 +17,8 @@ import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import gnu.trove.procedure.TObjectProcedure; import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -24,6 +26,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class WiredEffectToggleRandom extends InteractionWiredEffect { public class WiredEffectToggleRandom extends InteractionWiredEffect {
private static final Logger LOGGER = LoggerFactory.getLogger(WiredEffectToggleRandom.class);
public static final WiredEffectType type = WiredEffectType.TOGGLE_RANDOM; public static final WiredEffectType type = WiredEffectType.TOGGLE_RANDOM;
private final THashSet<HabboItem> items = new THashSet<>(); private final THashSet<HabboItem> items = new THashSet<>();
@ -120,7 +124,7 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
item.setExtradata(Emulator.getRandom().nextInt(item.getBaseItem().getStateCount() + 1) + ""); item.setExtradata(Emulator.getRandom().nextInt(item.getBaseItem().getStateCount() + 1) + "");
room.updateItem(item); room.updateItem(item);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
return true; return true;

View File

@ -1,22 +1,24 @@
package com.eu.habbo.habbohotel.items.interactions.wired.extra; package com.eu.habbo.habbohotel.items.interactions.wired.extra;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.games.GamePlayer; import com.eu.habbo.habbohotel.games.GamePlayer;
import com.eu.habbo.habbohotel.games.GameState; import com.eu.habbo.habbohotel.games.GameState;
import com.eu.habbo.habbohotel.games.battlebanzai.BattleBanzaiGame; import com.eu.habbo.habbohotel.games.battlebanzai.BattleBanzaiGame;
import com.eu.habbo.habbohotel.games.freeze.FreezeGame;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionDefault; import com.eu.habbo.habbohotel.items.interactions.InteractionDefault;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredEffectType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class WiredBlob extends InteractionDefault { public class WiredBlob extends InteractionDefault {
private static final Logger LOGGER = LoggerFactory.getLogger(WiredBlob.class);
enum WiredBlobState { enum WiredBlobState {
ACTIVE("0"), ACTIVE("0"),
USED("1"); USED("1");
@ -104,14 +106,14 @@ public class WiredBlob extends InteractionDefault {
String[] params = this.getBaseItem().getCustomParams().split(","); String[] params = this.getBaseItem().getCustomParams().split(",");
if (params.length != 2) { if (params.length != 2) {
Emulator.getLogging().logErrorLine("Wired blobs should have customparams with two parameters (points,resetsWithGame)"); LOGGER.error("Wired blobs should have customparams with two parameters (points,resetsWithGame)");
return; return;
} }
try { try {
this.POINTS_REWARD = Integer.parseInt(params[0]); this.POINTS_REWARD = Integer.parseInt(params[0]);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
Emulator.getLogging().logErrorLine("Wired blobs should have customparams with the first parameter being the amount of points (number)"); LOGGER.error("Wired blobs should have customparams with the first parameter being the amount of points (number)");
return; return;
} }

View File

@ -14,6 +14,8 @@ import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import gnu.trove.procedure.TObjectProcedure; import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -21,6 +23,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class WiredTriggerBotReachedFurni extends InteractionWiredTrigger { public class WiredTriggerBotReachedFurni extends InteractionWiredTrigger {
private static final Logger LOGGER = LoggerFactory.getLogger(WiredTriggerBotReachedFurni.class);
public final static WiredTriggerType type = WiredTriggerType.BOT_REACHED_STF; public final static WiredTriggerType type = WiredTriggerType.BOT_REACHED_STF;
private THashSet<HabboItem> items; private THashSet<HabboItem> items;
@ -157,7 +161,7 @@ public class WiredTriggerBotReachedFurni extends InteractionWiredTrigger {
if (item != null) if (item != null)
this.items.add(item); this.items.add(item);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
} }

View File

@ -1,12 +1,16 @@
package com.eu.habbo.habbohotel.messenger; package com.eu.habbo.habbohotel.messenger;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
public class Message implements Runnable { public class Message implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(Message.class);
private final int fromId; private final int fromId;
private final int toId; private final int toId;
private final int timestamp; private final int timestamp;
@ -31,7 +35,7 @@ public class Message implements Runnable {
statement.setInt(4, this.timestamp); statement.setInt(4, this.timestamp);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -11,6 +11,8 @@ import com.eu.habbo.plugin.events.users.friends.UserAcceptFriendRequestEvent;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -20,6 +22,9 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
public class Messenger { public class Messenger {
private static final Logger LOGGER = LoggerFactory.getLogger(Messenger.class);
//Configuration. Loaded from database & updated accordingly. //Configuration. Loaded from database & updated accordingly.
public static boolean SAVE_PRIVATE_CHATS = false; public static boolean SAVE_PRIVATE_CHATS = false;
public static int MAXIMUM_FRIENDS = 200; public static int MAXIMUM_FRIENDS = 200;
@ -41,7 +46,7 @@ public class Messenger {
statement.setInt(4, userOne); statement.setInt(4, userOne);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -55,7 +60,7 @@ public class Messenger {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return users; return users;
} }
@ -85,7 +90,7 @@ public class Messenger {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return false; return false;
@ -102,7 +107,7 @@ public class Messenger {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return false; return false;
@ -114,7 +119,7 @@ public class Messenger {
statement.setInt(2, userFrom); statement.setInt(2, userFrom);
statement.executeUpdate(); statement.executeUpdate();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -133,7 +138,7 @@ public class Messenger {
count = set.getInt("count"); count = set.getInt("count");
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return count; return count;
@ -157,7 +162,7 @@ public class Messenger {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return map; return map;
} }
@ -213,7 +218,7 @@ public class Messenger {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -237,7 +242,7 @@ public class Messenger {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return buddy; return buddy;
@ -252,7 +257,7 @@ public class Messenger {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -311,7 +316,7 @@ public class Messenger {
statement.setInt(1, userTo); statement.setInt(1, userTo);
statement.executeUpdate(); statement.executeUpdate();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -323,7 +328,7 @@ public class Messenger {
statement.setInt(3, userFrom); statement.setInt(3, userFrom);
return statement.executeUpdate(); return statement.executeUpdate();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return 0; return 0;
@ -345,7 +350,7 @@ public class Messenger {
statement.setInt(3, Emulator.getIntUnixTimestamp()); statement.setInt(3, Emulator.getIntUnixTimestamp());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
Habbo habboTo = Emulator.getGameServer().getGameClientManager().getHabbo(userTo); Habbo habboTo = Emulator.getGameServer().getGameClientManager().getHabbo(userTo);

View File

@ -7,6 +7,8 @@ import com.eu.habbo.habbohotel.users.HabboGender;
import com.eu.habbo.messages.ISerialize; import com.eu.habbo.messages.ISerialize;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.friends.FriendChatMessageComposer; import com.eu.habbo.messages.outgoing.friends.FriendChatMessageComposer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -14,6 +16,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class MessengerBuddy implements Runnable, ISerialize { public class MessengerBuddy implements Runnable, ISerialize {
private static final Logger LOGGER = LoggerFactory.getLogger(MessengerBuddy.class);
private int id; private int id;
private String username; private String username;
@ -44,7 +47,7 @@ public class MessengerBuddy implements Runnable, ISerialize {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -56,7 +59,7 @@ public class MessengerBuddy implements Runnable, ISerialize {
this.relation = 0; this.relation = 0;
this.userOne = 0; this.userOne = 0;
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -149,7 +152,7 @@ public class MessengerBuddy implements Runnable, ISerialize {
statement.setInt(3, this.id); statement.setInt(3, this.id);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }

View File

@ -1,6 +1,8 @@
package com.eu.habbo.habbohotel.modtool; package com.eu.habbo.habbohotel.modtool;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -9,6 +11,8 @@ import java.sql.SQLException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
public class ModToolBan implements Runnable { public class ModToolBan implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(ModToolBan.class);
public static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public int userId; public int userId;
public String ip; public String ip;
@ -63,7 +67,7 @@ public class ModToolBan implements Runnable {
statement.setInt(9, this.cfhTopic); statement.setInt(9, this.cfhTopic);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.modtool; package com.eu.habbo.habbohotel.modtool;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.bots.BotManager;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
@ -21,6 +22,8 @@ import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.procedure.TObjectProcedure; import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.sql.*; import java.sql.*;
@ -29,6 +32,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class ModToolManager { public class ModToolManager {
private static final Logger LOGGER = LoggerFactory.getLogger(ModToolManager.class);
private final TIntObjectMap<ModToolCategory> category; private final TIntObjectMap<ModToolCategory> category;
private final THashMap<String, THashSet<String>> presets; private final THashMap<String, THashSet<String>> presets;
private final THashMap<Integer, ModToolIssue> tickets; private final THashMap<Integer, ModToolIssue> tickets;
@ -41,7 +46,7 @@ public class ModToolManager {
this.tickets = new THashMap<>(); this.tickets = new THashMap<>();
this.cfhCategories = new TIntObjectHashMap<>(); this.cfhCategories = new TIntObjectHashMap<>();
this.loadModTool(); this.loadModTool();
Emulator.getLogging().logStart("ModTool Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); LOGGER.info("ModTool Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
} }
public static void requestUserInfo(GameClient client, ClientMessage packet) { public static void requestUserInfo(GameClient client, ClientMessage packet) {
@ -58,9 +63,9 @@ public class ModToolManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
@ -78,7 +83,7 @@ public class ModToolManager {
this.loadTickets(connection); this.loadTickets(connection);
this.loadCfhCategories(connection); this.loadCfhCategories(connection);
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -97,7 +102,7 @@ public class ModToolManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -108,7 +113,7 @@ public class ModToolManager {
this.presets.get(set.getString("type")).add(set.getString("preset")); this.presets.get(set.getString("type")).add(set.getString("preset"));
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
@ -120,7 +125,7 @@ public class ModToolManager {
this.tickets.put(set.getInt("id"), new ModToolIssue(set)); this.tickets.put(set.getInt("id"), new ModToolIssue(set));
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
@ -146,7 +151,7 @@ public class ModToolManager {
this.cfhCategories.get(set.getInt("support_cfh_category_id")).addTopic(new CfhTopic(set, this.getIssuePreset(set.getInt("default_sanction")))); this.cfhCategories.get(set.getInt("support_cfh_category_id")).addTopic(new CfhTopic(set, this.getIssuePreset(set.getInt("default_sanction"))));
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -198,7 +203,7 @@ public class ModToolManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return chatlogs; return chatlogs;
@ -215,7 +220,7 @@ public class ModToolManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return chatlogs; return chatlogs;
@ -235,7 +240,7 @@ public class ModToolManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return chatLogs; return chatLogs;
@ -272,7 +277,7 @@ public class ModToolManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return chatlogs; return chatlogs;
@ -290,7 +295,7 @@ public class ModToolManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return roomVisits; return roomVisits;
@ -348,7 +353,7 @@ public class ModToolManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return roomVisits; return roomVisits;
@ -378,7 +383,7 @@ public class ModToolManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return null; return null;
@ -495,7 +500,7 @@ public class ModToolManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return ban; return ban;
@ -519,7 +524,7 @@ public class ModToolManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return banned; return banned;
@ -543,7 +548,7 @@ public class ModToolManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return false; return false;
@ -557,7 +562,7 @@ public class ModToolManager {
statement.execute(); statement.execute();
return statement.getUpdateCount() > 0; return statement.getUpdateCount() > 0;
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return false; return false;
@ -662,7 +667,7 @@ public class ModToolManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return total; return total;

View File

@ -4,6 +4,8 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.plugin.events.sanctions.SanctionEvent; import com.eu.habbo.plugin.events.sanctions.SanctionEvent;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -13,6 +15,7 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
public class ModToolSanctions { public class ModToolSanctions {
private static final Logger LOGGER = LoggerFactory.getLogger(ModToolSanctions.class);
private final THashMap<Integer, ArrayList<ModToolSanctionItem>> sanctionHashmap; private final THashMap<Integer, ArrayList<ModToolSanctionItem>> sanctionHashmap;
private final THashMap<Integer, ModToolSanctionLevelItem> sanctionLevelsHashmap; private final THashMap<Integer, ModToolSanctionLevelItem> sanctionLevelsHashmap;
@ -22,8 +25,8 @@ public class ModToolSanctions {
this.sanctionHashmap = new THashMap<>(); this.sanctionHashmap = new THashMap<>();
this.sanctionLevelsHashmap = new THashMap<>(); this.sanctionLevelsHashmap = new THashMap<>();
this.loadModSanctions(); this.loadModSanctions();
Emulator.getLogging().logStart("Sanctions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
LOGGER.info("Sanctions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
} }
public synchronized void loadModSanctions() { public synchronized void loadModSanctions() {
@ -41,7 +44,7 @@ public class ModToolSanctions {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -68,7 +71,7 @@ public class ModToolSanctions {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return this.sanctionHashmap; return this.sanctionHashmap;
@ -87,7 +90,7 @@ public class ModToolSanctions {
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -98,7 +101,7 @@ public class ModToolSanctions {
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -109,7 +112,7 @@ public class ModToolSanctions {
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -120,7 +123,7 @@ public class ModToolSanctions {
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }

View File

@ -9,6 +9,8 @@ import com.eu.habbo.plugin.events.users.UserTriggerWordFilterEvent;
import gnu.trove.iterator.hash.TObjectHashIterator; import gnu.trove.iterator.hash.TObjectHashIterator;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -18,6 +20,8 @@ import java.text.Normalizer;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public class WordFilter { public class WordFilter {
private static final Logger LOGGER = LoggerFactory.getLogger(WordFilter.class);
private static final Pattern DIACRITICS_AND_FRIENDS = Pattern.compile("[\\p{InCombiningDiacriticalMarks}\\p{IsLm}\\p{IsSk}]+"); private static final Pattern DIACRITICS_AND_FRIENDS = Pattern.compile("[\\p{InCombiningDiacriticalMarks}\\p{IsLm}\\p{IsSk}]+");
//Configuration. Loaded from database & updated accordingly. //Configuration. Loaded from database & updated accordingly.
public static boolean ENABLED_FRIENDCHAT = true; public static boolean ENABLED_FRIENDCHAT = true;
@ -29,7 +33,7 @@ public class WordFilter {
public WordFilter() { public WordFilter() {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
this.reload(); this.reload();
Emulator.getLogging().logStart("WordFilter -> Loaded! (" + (System.currentTimeMillis() - start) + " MS)"); LOGGER.info("WordFilter -> Loaded! (" + (System.currentTimeMillis() - start) + " MS)");
} }
private static String stripDiacritics(String str) { private static String stripDiacritics(String str) {
@ -54,7 +58,7 @@ public class WordFilter {
try { try {
word = new WordFilterWord(set); word = new WordFilterWord(set);
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
continue; continue;
} }
@ -67,7 +71,7 @@ public class WordFilter {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }

View File

@ -4,6 +4,8 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.sql.Connection; import java.sql.Connection;
@ -18,9 +20,9 @@ import java.util.concurrent.ConcurrentHashMap;
public class NavigatorManager { public class NavigatorManager {
private static final Logger LOGGER = LoggerFactory.getLogger(NavigatorManager.class);
public static int MAXIMUM_RESULTS_PER_PAGE = 10; public static int MAXIMUM_RESULTS_PER_PAGE = 10;
public static boolean CATEGORY_SORT_USING_ORDER_NUM = false; public static boolean CATEGORY_SORT_USING_ORDER_NUM = false;
public final THashMap<Integer, NavigatorPublicCategory> publicCategories = new THashMap<>(); public final THashMap<Integer, NavigatorPublicCategory> publicCategories = new THashMap<>();
@ -36,7 +38,7 @@ public class NavigatorManager {
this.filters.put(NavigatorUserFilter.name, new NavigatorUserFilter()); this.filters.put(NavigatorUserFilter.name, new NavigatorUserFilter());
this.filters.put(NavigatorFavoriteFilter.name, new NavigatorFavoriteFilter()); this.filters.put(NavigatorFavoriteFilter.name, new NavigatorFavoriteFilter());
Emulator.getLogging().logStart("Navigator Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); LOGGER.info("Navigator Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
} }
public void loadNavigator() { public void loadNavigator() {
@ -49,7 +51,7 @@ public class NavigatorManager {
this.publicCategories.put(set.getInt("id"), new NavigatorPublicCategory(set)); this.publicCategories.put(set.getInt("id"), new NavigatorPublicCategory(set));
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
try (Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM navigator_publics WHERE visible = '1'")) { try (Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM navigator_publics WHERE visible = '1'")) {
@ -62,12 +64,12 @@ public class NavigatorManager {
if (room != null) { if (room != null) {
category.addRoom(room); category.addRoom(room);
} else { } else {
Emulator.getLogging().logErrorLine("Public room (ID: " + set.getInt("room_id") + " defined in navigator_publics does not exist!"); LOGGER.error("Public room (ID: {} defined in navigator_publics does not exist!", set.getInt("room_id"));
} }
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -83,7 +85,7 @@ public class NavigatorManager {
field = clazz.getDeclaredMethod(s); field = clazz.getDeclaredMethod(s);
clazz = field.getReturnType(); clazz = field.getReturnType();
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
break; break;
} }
} }
@ -91,7 +93,7 @@ public class NavigatorManager {
try { try {
field = clazz.getDeclaredMethod(set.getString("field")); field = clazz.getDeclaredMethod(set.getString("field"));
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
continue; continue;
} }
} }
@ -101,11 +103,11 @@ public class NavigatorManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
List<Room> staffPromotedRooms = Emulator.getGameEnvironment().getRoomManager().getRoomsStaffPromoted(); List<Room> staffPromotedRooms = Emulator.getGameEnvironment().getRoomManager().getRoomsStaffPromoted();

View File

@ -6,6 +6,8 @@ import com.eu.habbo.plugin.HabboPlugin;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TIntIntHashMap; import gnu.trove.map.hash.TIntIntHashMap;
import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.map.hash.TIntObjectHashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.*; import java.sql.*;
import java.util.ArrayList; import java.util.ArrayList;
@ -13,6 +15,8 @@ import java.util.List;
import java.util.Set; import java.util.Set;
public class PermissionsManager { public class PermissionsManager {
private static final Logger LOGGER = LoggerFactory.getLogger(PermissionsManager.class);
private final TIntObjectHashMap<Rank> ranks; private final TIntObjectHashMap<Rank> ranks;
private final TIntIntHashMap enables; private final TIntIntHashMap enables;
private final THashMap<String, List<Rank>> badges; private final THashMap<String, List<Rank>> badges;
@ -25,7 +29,7 @@ public class PermissionsManager {
this.reload(); this.reload();
Emulator.getLogging().logStart("Permissions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); LOGGER.info("Permissions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
} }
public void reload() { public void reload() {
@ -58,7 +62,7 @@ public class PermissionsManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -71,7 +75,7 @@ public class PermissionsManager {
this.enables.put(set.getInt("effect_id"), set.getInt("min_rank")); this.enables.put(set.getInt("effect_id"), set.getInt("min_rank"));
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -4,6 +4,8 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.achievements.AchievementManager; import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -11,6 +13,8 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class GnomePet extends Pet implements IPetLook { public class GnomePet extends Pet implements IPetLook {
private static final Logger LOGGER = LoggerFactory.getLogger(GnomePet.class);
private final String gnomeData; private final String gnomeData;
public GnomePet(ResultSet set) throws SQLException { public GnomePet(ResultSet set) throws SQLException {
@ -47,7 +51,7 @@ public class GnomePet extends Pet implements IPetLook {
statement.setInt(2, this.id); statement.setInt(2, this.id);
statement.executeUpdate(); statement.executeUpdate();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -1,6 +1,8 @@
package com.eu.habbo.habbohotel.pets; package com.eu.habbo.habbohotel.pets;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -8,6 +10,8 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class HorsePet extends RideablePet { public class HorsePet extends RideablePet {
private static final Logger LOGGER = LoggerFactory.getLogger(HorsePet.class);
private int hairColor; private int hairColor;
private int hairStyle; private int hairStyle;
@ -40,7 +44,7 @@ public class HorsePet extends RideablePet {
statement.setInt(6, super.getId()); statement.setInt(6, super.getId());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
super.run(); super.run();

View File

@ -13,6 +13,8 @@ import com.eu.habbo.messages.outgoing.rooms.pets.PetStatusUpdateComposer;
import com.eu.habbo.messages.outgoing.rooms.pets.RoomPetRespectComposer; import com.eu.habbo.messages.outgoing.rooms.pets.RoomPetRespectComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
import org.apache.commons.math3.util.Pair; import org.apache.commons.math3.util.Pair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -23,6 +25,8 @@ import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
public class MonsterplantPet extends Pet implements IPetLook { public class MonsterplantPet extends Pet implements IPetLook {
private static final Logger LOGGER = LoggerFactory.getLogger(MonsterplantPet.class);
public static final Map<Integer, Pair<String, Integer>> bodyRarity = new LinkedHashMap<Integer, Pair<String, Integer>>() { public static final Map<Integer, Pair<String, Integer>> bodyRarity = new LinkedHashMap<Integer, Pair<String, Integer>>() {
{ {
this.put(1, new Pair<>("Blungon", 0)); this.put(1, new Pair<>("Blungon", 0));
@ -138,7 +142,7 @@ public class MonsterplantPet extends Pet implements IPetLook {
statement.setInt(13, this.id); statement.setInt(13, this.id);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -14,6 +14,8 @@ import com.eu.habbo.messages.outgoing.rooms.users.RoomUserRemoveComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserTalkComposer; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserTalkComposer;
import com.eu.habbo.plugin.events.pets.PetTalkEvent; import com.eu.habbo.plugin.events.pets.PetTalkEvent;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.*; import java.sql.*;
import java.util.Calendar; import java.util.Calendar;
@ -21,6 +23,7 @@ import java.util.Map;
import java.util.TimeZone; import java.util.TimeZone;
public class Pet implements ISerialize, Runnable { public class Pet implements ISerialize, Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(Pet.class);
public int levelThirst; public int levelThirst;
public int levelHunger; public int levelHunger;
@ -62,7 +65,7 @@ public class Pet implements ISerialize, Runnable {
this.name = set.getString("name"); this.name = set.getString("name");
this.petData = Emulator.getGameEnvironment().getPetManager().getPetData(set.getInt("type")); this.petData = Emulator.getGameEnvironment().getPetManager().getPetData(set.getInt("type"));
if (this.petData == null) { if (this.petData == null) {
Emulator.getLogging().logErrorLine("WARNING! Missing pet data for type: " + set.getInt("type") + "! Insert a new entry into the pet_actions table for this type!"); LOGGER.error("WARNING! Missing pet data for type: " + set.getInt("type") + "! Insert a new entry into the pet_actions table for this type!");
this.petData = Emulator.getGameEnvironment().getPetManager().getPetData(0); this.petData = Emulator.getGameEnvironment().getPetManager().getPetData(0);
} }
this.race = set.getInt("race"); this.race = set.getInt("race");
@ -85,7 +88,7 @@ public class Pet implements ISerialize, Runnable {
this.petData = Emulator.getGameEnvironment().getPetManager().getPetData(type); this.petData = Emulator.getGameEnvironment().getPetManager().getPetData(type);
if (this.petData == null) { if (this.petData == null) {
Emulator.getLogging().logErrorLine(new Exception("WARNING! Missing pet data for type: " + type + "! Insert a new entry into the pet_actions table for this type!")); LOGGER.warn("Missing pet data for type: " + type + "! Insert a new entry into the pet_actions table for this type!");
} }
this.race = race; this.race = race;
@ -205,7 +208,7 @@ public class Pet implements ISerialize, Runnable {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
this.needsUpdate = false; this.needsUpdate = false;

View File

@ -19,7 +19,8 @@ import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.procedure.TIntObjectProcedure; import gnu.trove.procedure.TIntObjectProcedure;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.apache.commons.math3.distribution.NormalDistribution; import org.apache.commons.math3.distribution.NormalDistribution;
import org.apache.commons.math3.util.Pair; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.*; import java.sql.*;
import java.util.ArrayList; import java.util.ArrayList;
@ -27,6 +28,7 @@ import java.util.Collection;
import java.util.Map; import java.util.Map;
public class PetManager { public class PetManager {
private static final Logger LOGGER = LoggerFactory.getLogger(PetManager.class);
public static final int[] experiences = new int[]{100, 200, 400, 600, 900, 1300, 1800, 2400, 3200, 4300, 5700, 7600, 10100, 13300, 17500, 23000, 30200, 39600, 51900}; public static final int[] experiences = new int[]{100, 200, 400, 600, 900, 1300, 1800, 2400, 3200, 4300, 5700, 7600, 10100, 13300, 17500, 23000, 30200, 39600, 51900};
static int[] skins = new int[]{0, 1, 6, 7}; static int[] skins = new int[]{0, 1, 6, 7};
public final THashMap<Integer, PetAction> petActions = new THashMap<Integer, PetAction>() { public final THashMap<Integer, PetAction> petActions = new THashMap<Integer, PetAction>() {
@ -80,7 +82,7 @@ public class PetManager {
reloadPetData(); reloadPetData();
Emulator.getLogging().logStart("Pet Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); LOGGER.info("Pet Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
} }
public static int getLevel(int experience) { public static int getLevel(int experience) {
@ -151,8 +153,8 @@ public class PetManager {
this.loadPetCommands(connection); this.loadPetCommands(connection);
this.loadPetBreeding(connection); this.loadPetBreeding(connection);
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
Emulator.getLogging().logErrorLine("Pet Manager -> Failed to load!"); LOGGER.error("Pet Manager -> Failed to load!");
} }
} }
@ -167,7 +169,7 @@ public class PetManager {
this.petRaces.get(set.getInt("race")).add(new PetRace(set)); this.petRaces.get(set.getInt("race")).add(new PetRace(set));
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -177,7 +179,7 @@ public class PetManager {
this.petData.put(set.getInt("pet_type"), new PetData(set)); this.petData.put(set.getInt("pet_type"), new PetData(set));
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
this.loadPetItems(connection); this.loadPetItems(connection);
@ -217,7 +219,7 @@ public class PetManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -231,10 +233,10 @@ public class PetManager {
if (petVocalsType != null) { if (petVocalsType != null) {
this.petData.get(set.getInt("pet_id")).petVocals.get(petVocalsType).add(new PetVocal(set.getString("message"))); this.petData.get(set.getInt("pet_id")).petVocals.get(petVocalsType).add(new PetVocal(set.getString("message")));
} else { } else {
Emulator.getLogging().logErrorLine("Unknown pet vocal type " + set.getString("type")); LOGGER.error("Unknown pet vocal type " + set.getString("type"));
} }
} else { } else {
Emulator.getLogging().logErrorLine("Missing pet_actions table entry for pet id " + set.getInt("pet_id")); LOGGER.error("Missing pet_actions table entry for pet id " + set.getInt("pet_id"));
} }
} else { } else {
if (!PetData.generalPetVocals.containsKey(PetVocalsType.valueOf(set.getString("type").toUpperCase()))) if (!PetData.generalPetVocals.containsKey(PetVocalsType.valueOf(set.getString("type").toUpperCase())))
@ -244,7 +246,7 @@ public class PetManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -255,7 +257,7 @@ public class PetManager {
commandsList.put(set.getInt("command_id"), new PetCommand(set, this.petActions.get(set.getInt("command_id")))); commandsList.put(set.getInt("command_id"), new PetCommand(set, this.petActions.get(set.getInt("command_id"))));
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
try (Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM pet_commands ORDER BY pet_id ASC")) { try (Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM pet_commands ORDER BY pet_id ASC")) {
@ -267,7 +269,7 @@ public class PetManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -277,7 +279,7 @@ public class PetManager {
this.breedingPetType.put(set.getInt("pet_id"), set.getInt("offspring_id")); this.breedingPetType.put(set.getInt("pet_id"), set.getInt("offspring_id"));
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
try (Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM pet_breeding_races")) { try (Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM pet_breeding_races")) {
@ -294,13 +296,13 @@ public class PetManager {
this.breedingReward.get(reward.petType).get(reward.rarityLevel).add(reward); this.breedingReward.get(reward.petType).get(reward.rarityLevel).add(reward);
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
public THashSet<PetRace> getBreeds(String petName) { public THashSet<PetRace> getBreeds(String petName) {
if (!petName.startsWith("a0 pet")) { if (!petName.startsWith("a0 pet")) {
Emulator.getLogging().logErrorLine("Pet " + petName + " not found. Make sure it matches the pattern \"a0 pet<pet_id>\"!"); LOGGER.error("Pet " + petName + " not found. Make sure it matches the pattern \"a0 pet<pet_id>\"!");
return null; return null;
} }
@ -308,7 +310,7 @@ public class PetManager {
int petId = Integer.valueOf(petName.split("t")[1]); int petId = Integer.valueOf(petName.split("t")[1]);
return this.petRaces.get(petId); return this.petRaces.get(petId);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
return null; return null;
@ -346,7 +348,7 @@ public class PetManager {
return this.petData.get(type); return this.petData.get(type);
} else { } else {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) { try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) {
Emulator.getLogging().logErrorLine("Missing petdata for type " + type + ". Adding this to the database..."); LOGGER.error("Missing petdata for type " + type + ". Adding this to the database...");
try (PreparedStatement statement = connection.prepareStatement("INSERT INTO pet_actions (pet_type) VALUES (?)")) { try (PreparedStatement statement = connection.prepareStatement("INSERT INTO pet_actions (pet_type) VALUES (?)")) {
statement.setInt(1, type); statement.setInt(1, type);
statement.execute(); statement.execute();
@ -358,13 +360,13 @@ public class PetManager {
if (set.next()) { if (set.next()) {
PetData petData = new PetData(set); PetData petData = new PetData(set);
this.petData.put(type, petData); this.petData.put(type, petData);
Emulator.getLogging().logErrorLine("Missing petdata for type " + type + " added to the database!"); LOGGER.error("Missing petdata for type " + type + " added to the database!");
return petData; return petData;
} }
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
@ -511,7 +513,7 @@ public class PetManager {
statement.setInt(1, pet.getId()); statement.setInt(1, pet.getId());
return statement.execute(); return statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return false; return false;

View File

@ -3,10 +3,14 @@ package com.eu.habbo.habbohotel.polls;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.*; import java.sql.*;
public class PollManager { public class PollManager {
private static final Logger LOGGER = LoggerFactory.getLogger(PollManager.class);
private final THashMap<Integer, Poll> activePolls = new THashMap<>(); private final THashMap<Integer, Poll> activePolls = new THashMap<>();
public PollManager() { public PollManager() {
@ -23,7 +27,7 @@ public class PollManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return false; return false;
} }
@ -63,7 +67,7 @@ public class PollManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -1,6 +1,8 @@
package com.eu.habbo.habbohotel.rooms; package com.eu.habbo.habbohotel.rooms;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -8,6 +10,8 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class CustomRoomLayout extends RoomLayout implements Runnable { public class CustomRoomLayout extends RoomLayout implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(CustomRoomLayout.class);
private final int roomId; private final int roomId;
private boolean needsUpdate; private boolean needsUpdate;
@ -30,7 +34,7 @@ public class CustomRoomLayout extends RoomLayout implements Runnable {
statement.setInt(5, this.roomId); statement.setInt(5, this.roomId);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -72,6 +72,8 @@ import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import io.netty.util.internal.ConcurrentSet; import io.netty.util.internal.ConcurrentSet;
import org.apache.commons.math3.util.Pair; import org.apache.commons.math3.util.Pair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.awt.*; import java.awt.*;
import java.sql.Connection; import java.sql.Connection;
@ -86,6 +88,9 @@ import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class Room implements Comparable<Room>, ISerialize, Runnable { public class Room implements Comparable<Room>, ISerialize, Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(Room.class);
public static final Comparator SORT_SCORE = (o1, o2) -> { public static final Comparator SORT_SCORE = (o1, o2) -> {
if (!(o1 instanceof Room && o2 instanceof Room)) if (!(o1 instanceof Room && o2 instanceof Room))
@ -264,7 +269,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
this.loadBans(connection); this.loadBans(connection);
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
this.tradeMode = set.getInt("trade_mode"); this.tradeMode = set.getInt("trade_mode");
@ -312,49 +317,49 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try { try {
this.loadLayout(); this.loadLayout();
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
try { try {
this.loadRights(connection); this.loadRights(connection);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
try { try {
this.loadItems(connection); this.loadItems(connection);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
try { try {
this.loadHeightmap(); this.loadHeightmap();
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
try { try {
this.loadBots(connection); this.loadBots(connection);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
try { try {
this.loadPets(connection); this.loadPets(connection);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
try { try {
this.loadWordFilter(connection); this.loadWordFilter(connection);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
try { try {
this.loadWiredData(connection); this.loadWiredData(connection);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
this.idleCycles = 0; this.idleCycles = 0;
@ -362,7 +367,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
this.roomCycleTask = Emulator.getThreading().getService().scheduleAtFixedRate(this, 500, 500, TimeUnit.MILLISECONDS); this.roomCycleTask = Emulator.getThreading().getService().scheduleAtFixedRate(this, 500, 500, TimeUnit.MILLISECONDS);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
this.traxManager = new TraxManager(this); this.traxManager = new TraxManager(this);
@ -400,7 +405,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
} }
} }
} else { } else {
Emulator.getLogging().logErrorLine("Unknown Room Layout for Room (ID: " + this.id + ")"); LOGGER.error("Unknown Room Layout for Room (ID: {})", this.id);
} }
} }
@ -415,11 +420,11 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
if (this.itemCount() > Room.MAXIMUM_FURNI) { if (this.itemCount() > Room.MAXIMUM_FURNI) {
Emulator.getLogging().logErrorLine("Room ID: " + this.getId() + " has exceeded the furniture limit (" + this.itemCount() + " > " + Room.MAXIMUM_FURNI + ")."); LOGGER.error("Room ID: {} has exceeded the furniture limit ({} > {}).", this.getId(), this.itemCount(), Room.MAXIMUM_FURNI);
} }
} }
@ -437,14 +442,14 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
((InteractionWired) item).loadWiredData(set, this); ((InteractionWired) item).loadWiredData(set, this);
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
@ -480,7 +485,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -510,12 +515,12 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
this.getFurniOwnerNames().put(pet.getUserId(), set.getString("pet_owner_name")); this.getFurniOwnerNames().put(pet.getUserId(), set.getString("pet_owner_name"));
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -530,7 +535,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -920,7 +925,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
botIterator.value().needsUpdate(true); botIterator.value().needsUpdate(true);
Emulator.getThreading().run(botIterator.value()); Emulator.getThreading().run(botIterator.value());
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
break; break;
} }
} }
@ -928,7 +933,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
this.currentBots.clear(); this.currentBots.clear();
this.currentPets.clear(); this.currentPets.clear();
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
@ -940,7 +945,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
this.preLoaded = true; this.preLoaded = true;
this.layout = null; this.layout = null;
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
@ -1032,7 +1037,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
Emulator.getThreading().run( Emulator.getThreading().run(
Room.this::cycle); Room.this::cycle);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
} }
@ -1095,7 +1100,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.executeUpdate(); statement.executeUpdate();
this.needsUpdate = false; this.needsUpdate = false;
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
@ -1106,7 +1111,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.setInt(2, this.id); statement.setInt(2, this.id);
statement.executeUpdate(); statement.executeUpdate();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -1249,7 +1254,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
break; break;
} }
} }
@ -1262,7 +1267,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try { try {
petIterator.advance(); petIterator.advance();
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
break; break;
} }
@ -1457,7 +1462,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try { try {
item.onWalkOn(unit, room, null); item.onWalkOn(unit, room, null);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
}, this.getRollerSpeed() == 0 ? 250 : InteractionRoller.DELAY); }, this.getRollerSpeed() == 0 ? 250 : InteractionRoller.DELAY);
@ -2001,7 +2006,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
} }
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
break; break;
} }
} }
@ -2129,7 +2134,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.setInt(10, this.promotion.getCategory()); statement.setInt(10, this.promotion.getCategory());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
this.needsUpdate = true; this.needsUpdate = true;
@ -2221,7 +2226,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
return this.habboQueue.remove(habbo.getHabboInfo().getId()) != null; return this.habboQueue.remove(habbo.getHabboInfo().getId()) != null;
} }
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
return true; return true;
@ -2294,7 +2299,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
if (habbo != null) { if (habbo != null) {
this.furniOwnerNames.put(item.getUserId(), habbo.getUsername()); this.furniOwnerNames.put(item.getUserId(), habbo.getUsername());
} else { } else {
Emulator.getLogging().logDebugLine("Failed to find username for item (ID:" + item.getId() + ", UserID: " + item.getUserId() + ")"); LOGGER.error("Failed to find username for item (ID: {}, UserID: {})", item.getId(), item.getUserId());
} }
} }
} }
@ -2619,7 +2624,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try { try {
item.onWalkOff(habbo.getRoomUnit(), this, new Object[]{}); item.onWalkOff(habbo.getRoomUnit(), this, new Object[]{});
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
} }
@ -2680,7 +2685,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try { try {
iterator.advance(); iterator.advance();
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
break; break;
} }
@ -2700,7 +2705,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try { try {
iterator.advance(); iterator.advance();
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
break; break;
} }
@ -2722,7 +2727,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try { try {
iterator.advance(); iterator.advance();
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
break; break;
} }
@ -2765,7 +2770,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try { try {
petIterator.advance(); petIterator.advance();
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
break; break;
} }
@ -2844,7 +2849,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try { try {
petIterator.advance(); petIterator.advance();
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
break; break;
} }
@ -2999,7 +3004,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try { try {
doorTileTopItem.onWalkOn(habbo.getRoomUnit(), this, new Object[]{}); doorTileTopItem.onWalkOn(habbo.getRoomUnit(), this, new Object[]{});
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
} }
@ -3186,7 +3191,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
bot.onUserSay(roomChatMessage); bot.onUserSay(roomChatMessage);
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
break; break;
} }
} }
@ -3210,7 +3215,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
item.onClick(habbo.getClient(), this, new Object[0]); item.onClick(habbo.getClient(), this, new Object[0]);
break; break;
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
} }
@ -3763,7 +3768,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -3782,7 +3787,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -3826,7 +3831,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.setInt(2, userId); statement.setInt(2, userId);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -3863,7 +3868,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.setInt(2, userId); statement.setInt(2, userId);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -3881,7 +3886,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.setInt(1, this.id); statement.setInt(1, this.id);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
this.refreshRightsInRoom(); this.refreshRightsInRoom();
@ -3948,7 +3953,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -4252,7 +4257,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.setString(2, word); statement.setString(2, word);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
return; return;
} }
@ -4269,7 +4274,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.setString(2, word); statement.setString(2, word);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -1,6 +1,8 @@
package com.eu.habbo.habbohotel.rooms; package com.eu.habbo.habbohotel.rooms;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -9,15 +11,11 @@ import java.sql.SQLException;
public class RoomBan { public class RoomBan {
private static final Logger LOGGER = LoggerFactory.getLogger(RoomBan.class);
public final int roomId; public final int roomId;
public final int userId; public final int userId;
public final String username; public final String username;
public final int endTimestamp; public final int endTimestamp;
public RoomBan(int roomId, int userId, String username, int endTimestamp) { public RoomBan(int roomId, int userId, String username, int endTimestamp) {
@ -42,7 +40,7 @@ public class RoomBan {
statement.setInt(3, this.endTimestamp); statement.setInt(3, this.endTimestamp);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -53,7 +51,7 @@ public class RoomBan {
statement.setInt(2, this.userId); statement.setInt(2, this.userId);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -1,21 +1,26 @@
package com.eu.habbo.habbohotel.rooms; package com.eu.habbo.habbohotel.rooms;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.core.Loggable; import com.eu.habbo.core.DatabaseLoggable;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.ISerialize; import com.eu.habbo.messages.ISerialize;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.Incoming; import com.eu.habbo.messages.incoming.Incoming;
import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.incoming.MessageHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
public class RoomChatMessage implements Runnable, ISerialize, Loggable { public class RoomChatMessage implements Runnable, ISerialize, DatabaseLoggable {
private static final Logger LOGGER = LoggerFactory.getLogger(RoomChatMessage.class);
private static final String QUERY = "INSERT INTO chatlogs_room (user_from_id, user_to_id, message, timestamp, room_id) VALUES (?, ?, ?, ?, ?)";
private static final List<String> chatColors = Arrays.asList("@red@", "@cyan@", "@blue@", "@green@", "@purple@"); private static final List<String> chatColors = Arrays.asList("@red@", "@cyan@", "@blue@", "@green@", "@purple@");
public static String insertQuery = "INSERT INTO chatlogs_room (user_from_id, user_to_id, message, timestamp, room_id) VALUES (?, ?, ?, ?, ?)";
public static int MAXIMUM_LENGTH = 100; public static int MAXIMUM_LENGTH = 100;
//Configuration. Loaded from database & updated accordingly. //Configuration. Loaded from database & updated accordingly.
public static boolean SAVE_ROOM_CHATS = false; public static boolean SAVE_ROOM_CHATS = false;
@ -130,10 +135,11 @@ public class RoomChatMessage implements Runnable, ISerialize, Loggable {
try { try {
this.message = this.message.substring(0, RoomChatMessage.MAXIMUM_LENGTH - 1); this.message = this.message.substring(0, RoomChatMessage.MAXIMUM_LENGTH - 1);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
Emulator.getLogging().addChatLog(this);
Emulator.getDatabaseLogger().store(this);
} }
public String getMessage() { public String getMessage() {
@ -191,7 +197,7 @@ public class RoomChatMessage implements Runnable, ISerialize, Loggable {
message.appendInt(0); message.appendInt(0);
message.appendInt(this.getMessage().length()); message.appendInt(this.getMessage().length());
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }
@ -218,6 +224,11 @@ public class RoomChatMessage implements Runnable, ISerialize, Loggable {
} }
} }
@Override
public String getQuery() {
return QUERY;
}
@Override @Override
public void log(PreparedStatement statement) throws SQLException { public void log(PreparedStatement statement) throws SQLException {
statement.setInt(1, this.habbo.getHabboInfo().getId()); statement.setInt(1, this.habbo.getHabboInfo().getId());

View File

@ -2,6 +2,8 @@ package com.eu.habbo.habbohotel.rooms;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.awt.*; import java.awt.*;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -12,6 +14,7 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
public class RoomLayout { public class RoomLayout {
private static final Logger LOGGER = LoggerFactory.getLogger(RoomLayout.class);
protected static final int BASICMOVEMENTCOST = 10; protected static final int BASICMOVEMENTCOST = 10;
protected static final int DIAGONALMOVEMENTCOST = 14; protected static final int DIAGONALMOVEMENTCOST = 14;
public static double MAXIMUM_STEP_HEIGHT = 1.1; public static double MAXIMUM_STEP_HEIGHT = 1.1;
@ -42,7 +45,7 @@ public class RoomLayout {
this.parse(); this.parse();
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
} }

View File

@ -41,7 +41,6 @@ import com.eu.habbo.messages.outgoing.rooms.pets.RoomPetComposer;
import com.eu.habbo.messages.outgoing.rooms.promotions.RoomPromotionMessageComposer; import com.eu.habbo.messages.outgoing.rooms.promotions.RoomPromotionMessageComposer;
import com.eu.habbo.messages.outgoing.rooms.users.*; import com.eu.habbo.messages.outgoing.rooms.users.*;
import com.eu.habbo.messages.outgoing.users.MutedWhisperComposer; import com.eu.habbo.messages.outgoing.users.MutedWhisperComposer;
import com.eu.habbo.plugin.Event;
import com.eu.habbo.plugin.events.navigator.NavigatorRoomCreatedEvent; import com.eu.habbo.plugin.events.navigator.NavigatorRoomCreatedEvent;
import com.eu.habbo.plugin.events.rooms.RoomUncachedEvent; import com.eu.habbo.plugin.events.rooms.RoomUncachedEvent;
import com.eu.habbo.plugin.events.rooms.UserVoteRoomEvent; import com.eu.habbo.plugin.events.rooms.UserVoteRoomEvent;
@ -53,13 +52,17 @@ import gnu.trove.map.hash.THashMap;
import gnu.trove.procedure.TIntProcedure; import gnu.trove.procedure.TIntProcedure;
import gnu.trove.procedure.TObjectProcedure; import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.*; import java.sql.*;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
public class RoomManager { public class RoomManager {
private static final Logger LOGGER = LoggerFactory.getLogger(RoomManager.class);
private static final int page = 0; private static final int page = 0;
//Configuration. Loaded from database & updated accordingly. //Configuration. Loaded from database & updated accordingly.
public static int MAXIMUM_ROOMS_USER = 25; public static int MAXIMUM_ROOMS_USER = 25;
@ -89,7 +92,7 @@ public class RoomManager {
registerGameType(IceTagGame.class); registerGameType(IceTagGame.class);
registerGameType(RollerskateGame.class); registerGameType(RollerskateGame.class);
Emulator.getLogging().logStart("Room Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); LOGGER.info("Room Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
} }
public void loadRoomModels() { public void loadRoomModels() {
@ -99,7 +102,7 @@ public class RoomManager {
this.mapNames.add(set.getString("name")); this.mapNames.add(set.getString("name"));
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -113,7 +116,7 @@ public class RoomManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return layout; return layout;
@ -127,7 +130,7 @@ public class RoomManager {
this.roomCategories.put(set.getInt("id"), new RoomCategory(set)); this.roomCategories.put(set.getInt("id"), new RoomCategory(set));
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -143,7 +146,7 @@ public class RoomManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -169,7 +172,7 @@ public class RoomManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return rooms; return rooms;
@ -276,7 +279,7 @@ public class RoomManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return rooms; return rooms;
@ -317,7 +320,7 @@ public class RoomManager {
this.activeRooms.put(room.getId(), room); this.activeRooms.put(room.getId(), room);
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return room; return room;
@ -341,7 +344,7 @@ public class RoomManager {
room = this.loadRoom(set.getInt(1)); room = this.loadRoom(set.getInt(1));
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return room; return room;
@ -366,7 +369,7 @@ public class RoomManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -416,7 +419,7 @@ public class RoomManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return layout; return layout;
@ -450,7 +453,7 @@ public class RoomManager {
statement.setInt(2, room.getId()); statement.setInt(2, room.getId());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
@ -910,7 +913,7 @@ public class RoomManager {
statement.setInt(3, (int) (habbo.getHabboStats().roomEnterTimestamp)); statement.setInt(3, (int) (habbo.getHabboStats().roomEnterTimestamp));
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -961,7 +964,7 @@ public class RoomManager {
statement.setInt(3, room.getId()); statement.setInt(3, room.getId());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
@ -1090,7 +1093,7 @@ public class RoomManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return rooms; return rooms;
@ -1150,7 +1153,7 @@ public class RoomManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return rooms; return rooms;
@ -1217,7 +1220,7 @@ public class RoomManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
Collections.sort(rooms); Collections.sort(rooms);
@ -1263,7 +1266,7 @@ public class RoomManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
Collections.sort(rooms); Collections.sort(rooms);
@ -1286,7 +1289,7 @@ public class RoomManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return rooms; return rooms;
@ -1328,7 +1331,7 @@ public class RoomManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return rooms; return rooms;
@ -1350,7 +1353,7 @@ public class RoomManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return rooms; return rooms;
@ -1454,7 +1457,7 @@ public class RoomManager {
this.activeRooms.clear(); this.activeRooms.clear();
Emulator.getLogging().logShutdownLine("Room Manager -> Disposed!"); LOGGER.info("Room Manager -> Disposed!");
} }
public CustomRoomLayout insertCustomLayout(Room room, String map, int doorX, int doorY, int doorDirection) { public CustomRoomLayout insertCustomLayout(Room room, String map, int doorX, int doorY, int doorDirection) {
@ -1471,7 +1474,7 @@ public class RoomManager {
statement.setString(10, map); statement.setString(10, map);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
return this.loadCustomLayout(room); return this.loadCustomLayout(room);

View File

@ -1,6 +1,8 @@
package com.eu.habbo.habbohotel.rooms; package com.eu.habbo.habbohotel.rooms;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -8,6 +10,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class RoomPromotion { public class RoomPromotion {
private static final Logger LOGGER = LoggerFactory.getLogger(RoomPromotion.class);
private final Room room; private final Room room;
public boolean needsUpdate; public boolean needsUpdate;
private String title; private String title;
@ -43,7 +46,7 @@ public class RoomPromotion {
statement.setInt(4, this.room.getId()); statement.setInt(4, this.room.getId());
statement.executeUpdate(); statement.executeUpdate();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
this.needsUpdate = false; this.needsUpdate = false;

View File

@ -10,12 +10,15 @@ import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
import com.eu.habbo.messages.outgoing.trading.*; import com.eu.habbo.messages.outgoing.trading.*;
import com.eu.habbo.threading.runnables.QueryDeleteHabboItem; import com.eu.habbo.threading.runnables.QueryDeleteHabboItem;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.*; import java.sql.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class RoomTrade { public class RoomTrade {
private static final Logger LOGGER = LoggerFactory.getLogger(RoomTrade.class);
//Configuration. Loaded from database & updated accordingly. //Configuration. Loaded from database & updated accordingly.
public static boolean TRADING_ENABLED = true; public static boolean TRADING_ENABLED = true;
public static boolean TRADING_REQUIRES_PERK = true; public static boolean TRADING_REQUIRES_PERK = true;
@ -206,7 +209,7 @@ public class RoomTrade {
statement.executeBatch(); statement.executeBatch();
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
THashSet<HabboItem> itemsUserOne = new THashSet<>(userOne.getItems()); THashSet<HabboItem> itemsUserOne = new THashSet<>(userOne.getItems());

View File

@ -24,6 +24,8 @@ import com.eu.habbo.util.pathfinding.Rotation;
import gnu.trove.map.TMap; import gnu.trove.map.TMap;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@ -31,6 +33,9 @@ import java.util.concurrent.ScheduledFuture;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class RoomUnit { public class RoomUnit {
private static final Logger LOGGER = LoggerFactory.getLogger(RoomUnit.class);
public boolean isWiredTeleporting = false; public boolean isWiredTeleporting = false;
private final ConcurrentHashMap<RoomUnitStatus, String> status; private final ConcurrentHashMap<RoomUnitStatus, String> status;
private final THashMap<String, Object> cacheable; private final THashMap<String, Object> cacheable;
@ -361,7 +366,7 @@ public class RoomUnit {
return false; return false;
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
return false; return false;
} }
} }

View File

@ -15,6 +15,8 @@ import com.eu.habbo.messages.outgoing.inventory.RemoveHabboItemComposer;
import com.eu.habbo.messages.outgoing.rooms.items.jukebox.JukeBoxMySongsComposer; import com.eu.habbo.messages.outgoing.rooms.items.jukebox.JukeBoxMySongsComposer;
import com.eu.habbo.messages.outgoing.rooms.items.jukebox.JukeBoxNowPlayingMessageComposer; import com.eu.habbo.messages.outgoing.rooms.items.jukebox.JukeBoxNowPlayingMessageComposer;
import com.eu.habbo.messages.outgoing.rooms.items.jukebox.JukeBoxPlayListComposer; import com.eu.habbo.messages.outgoing.rooms.items.jukebox.JukeBoxPlayListComposer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -25,6 +27,7 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class TraxManager implements Disposable { public class TraxManager implements Disposable {
private static final Logger LOGGER = LoggerFactory.getLogger(TraxManager.class);
private final Room room; private final Room room;
private final List<InteractionMusicDisc> songs = new ArrayList<>(0); private final List<InteractionMusicDisc> songs = new ArrayList<>(0);
private int totalLength = 0; private int totalLength = 0;
@ -51,7 +54,7 @@ public class TraxManager implements Disposable {
stmt.setInt(2, musicDisc.getId()); stmt.setInt(2, musicDisc.getId());
stmt.execute(); stmt.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
return; return;
} }
} else { } else {
@ -67,7 +70,7 @@ public class TraxManager implements Disposable {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -157,7 +160,7 @@ public class TraxManager implements Disposable {
statement.setInt(2, musicDisc.getId()); statement.setInt(2, musicDisc.getId());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
return; return;
} }
@ -184,7 +187,7 @@ public class TraxManager implements Disposable {
statement.setInt(2, itemId); statement.setInt(2, itemId);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
return; return;
} }
@ -277,7 +280,7 @@ public class TraxManager implements Disposable {
statement.setInt(1, this.room.getId()); statement.setInt(1, this.room.getId());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }

View File

@ -20,6 +20,8 @@ import com.eu.habbo.plugin.events.users.UserPointsEvent;
import gnu.trove.TIntCollection; import gnu.trove.TIntCollection;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.SocketAddress; import java.net.SocketAddress;
@ -28,6 +30,9 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class Habbo implements Runnable { public class Habbo implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(Habbo.class);
private final HabboInfo habboInfo; private final HabboInfo habboInfo;
private final HabboStats habboStats; private final HabboStats habboStats;
private final Messenger messenger; private final Messenger messenger;
@ -122,7 +127,7 @@ public class Habbo implements Runnable {
this.messenger.connectionChanged(this, true, false); this.messenger.connectionChanged(this, true, false);
Emulator.getGameEnvironment().getRoomManager().loadRoomsForHabbo(this); Emulator.getGameEnvironment().getRoomManager().loadRoomsForHabbo(this);
Emulator.getLogging().logUserLine(this.habboInfo.getUsername() + " logged in from IP " + this.habboInfo.getIpLogin()); LOGGER.info("{} logged in from IP {}", this.habboInfo.getUsername(), this.habboInfo.getIpLogin());
} }
@ -148,7 +153,7 @@ public class Habbo implements Runnable {
} }
} }
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
} }
try { try {
@ -164,13 +169,13 @@ public class Habbo implements Runnable {
this.habboStats.dispose(); this.habboStats.dispose();
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); LOGGER.error("Caught exception", e);
return; return;
} finally { } finally {
Emulator.getGameEnvironment().getRoomManager().unloadRoomsForHabbo(this); Emulator.getGameEnvironment().getRoomManager().unloadRoomsForHabbo(this);
Emulator.getGameEnvironment().getHabboManager().removeHabbo(this); Emulator.getGameEnvironment().getHabboManager().removeHabbo(this);
} }
Emulator.getLogging().logUserLine(this.habboInfo.getUsername() + " disconnected."); LOGGER.info("{} disconnected.", this.habboInfo.getUsername());
this.client = null; this.client = null;
} }

View File

@ -1,10 +1,13 @@
package com.eu.habbo.habbohotel.users; package com.eu.habbo.habbohotel.users;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.*; import java.sql.*;
public class HabboBadge implements Runnable { public class HabboBadge implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(HabboBadge.class);
private int id; private int id;
private String code; private String code;
private int slot; private int slot;
@ -77,7 +80,7 @@ public class HabboBadge implements Runnable {
this.needsUpdate = false; this.needsUpdate = false;
} }
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); LOGGER.error("Caught SQL exception", e);
} }
} }

Some files were not shown because too many files have changed in this diff Show More