Dependencies and logging progress

This commit is contained in:
Mike 2020-05-03 01:46:07 +02:00
parent c83f7cd364
commit 4748c033ad
177 changed files with 963 additions and 1180 deletions

72
pom.xml
View File

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

View File

@ -1,5 +1,6 @@
package com.eu.habbo;
import ch.qos.logback.classic.Level;
import com.eu.habbo.core.*;
import com.eu.habbo.core.consolecommands.ConsoleCommand;
import com.eu.habbo.database.Database;
@ -14,7 +15,8 @@ import com.eu.habbo.plugin.events.emulator.EmulatorStartShutdownEvent;
import com.eu.habbo.plugin.events.emulator.EmulatorStoppedEvent;
import com.eu.habbo.threading.ThreadPooling;
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.security.MessageDigest;
@ -23,20 +25,17 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
public final class Emulator {
private static final Logger LOGGER = LoggerFactory.getLogger(Emulator.class);
public final static int MAJOR = 2;
public final static int MINOR = 4;
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 static final String version = "Arcturus Morningstar" + " " + MAJOR + "." + MINOR + "." + BUILD + "-" + PREVIEW;
@ -55,8 +54,6 @@ public final class Emulator {
public static boolean isShuttingDown = false;
public static boolean stopped = 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 Runtime runtime;
private static ConfigurationManager config;
@ -66,11 +63,10 @@ public final class Emulator {
private static RCONServer rconServer;
private static CameraClient cameraClient;
private static Database database;
private static Logging logging;
private static DatabaseLogger databaseLogger;
private static ThreadPooling threading;
private static GameEnvironment gameEnvironment;
private static PluginManager pluginManager;
private static Random random;
private static BadgeImager badgeImager;
static {
@ -85,21 +81,19 @@ public final class Emulator {
public static void main(String[] args) throws Exception {
try {
if (osName.startsWith("Windows") && (!classPath.contains("idea_rt.jar"))) {
AnsiConsole.systemInstall();
}
Locale.setDefault(new Locale("en"));
setBuild();
Emulator.stopped = false;
ConsoleCommand.load();
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(ANSI_BLUE + "[VERSION] " + ANSI_WHITE + version);
System.out.println(ANSI_RED + "[BUILD] " + ANSI_WHITE + build + "\n");
System.out.println(ANSI_YELLOW + "[KREWS] " + ANSI_WHITE + "Remember to sign up your hotel to join our toplist beta at https://bit.ly/2NN0rxq" );
System.out.println(ANSI_YELLOW + "[KREWS] " + ANSI_WHITE + "Join our discord at https://discord.gg/syuqgN" + "\n");
random = new Random();
System.out.println(logo);
LOGGER.info("This project is for educational purposes only. This Emulator is an open-source fork of Arcturus created by TheGeneral.");
LOGGER.info("Version: {}", version);
LOGGER.info("Build: {}", build);
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();
Emulator.runtime = Runtime.getRuntime();
@ -110,6 +104,7 @@ public final class Emulator {
Emulator.getConfig().getValue("enc.n"),
Emulator.getConfig().getValue("enc.d"));
Emulator.database = new Database(Emulator.getConfig());
Emulator.databaseLogger = new DatabaseLogger();
Emulator.config.loaded = true;
Emulator.config.loadFromDatabase();
Emulator.threading = new ThreadPooling(Emulator.getConfig().getInt("runtime.threads"));
@ -129,13 +124,17 @@ public final class Emulator {
Emulator.rconServer.initializePipeline();
Emulator.rconServer.connect();
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!");
Emulator.getLogging().logStart("Memory: " + (runtime.totalMemory() - runtime.freeMemory()) / (1024 * 1024) + "/" + (runtime.freeMemory()) / (1024 * 1024) + "MB");
LOGGER.info("Arcturus Morningstar has succesfully loaded.");
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");
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());
@ -143,7 +142,9 @@ public final class Emulator {
Emulator.timeStarted = getIntUnixTimestamp();
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 +155,6 @@ public final class Emulator {
while (!isShuttingDown && isReady) {
try {
String line = reader.readLine();
if (line != null) {
@ -163,7 +163,7 @@ public final class Emulator {
System.out.println("Waiting for command: ");
} catch (Exception e) {
if (!(e instanceof IOException && e.getMessage().equals("Bad file descriptor"))) {
Emulator.getLogging().logErrorLine(e);
LOGGER.error("Error while reading command", e);
}
}
}
@ -199,11 +199,12 @@ public final class Emulator {
}
private static void dispose() {
Emulator.getThreading().setCanAdd(false);
Emulator.isShuttingDown = true;
Emulator.isReady = false;
Emulator.getLogging().logShutdownLine("Stopping Arcturus Emulator " + version + "...");
LOGGER.info("Stopping Arcturus Morningstar {}", version);
try {
if (Emulator.getPluginManager() != null)
Emulator.getPluginManager().fireEvent(new EmulatorStartShutdownEvent());
@ -222,7 +223,6 @@ public final class Emulator {
} catch (Exception e) {
}
try {
if (Emulator.gameEnvironment != null)
Emulator.gameEnvironment.dispose();
@ -241,8 +241,6 @@ public final class Emulator {
} catch (Exception e) {
}
Emulator.getLogging().saveLogs();
try {
if (Emulator.config != null) {
Emulator.config.saveToDatabase();
@ -255,16 +253,17 @@ public final class Emulator {
Emulator.gameServer.stop();
} catch (Exception e) {
}
Emulator.getLogging().logShutdownLine("Stopped Arcturus Emulator " + version + "...");
LOGGER.info("Stopped Arcturus Morningstar {}", version);
if (Emulator.database != null) {
Emulator.getDatabase().dispose();
}
Emulator.stopped = true;
if (osName.startsWith("Windows") && (!classPath.contains("idea_rt.jar"))) {
AnsiConsole.systemUninstall();
}
// if (osName.startsWith("Windows") && (!classPath.contains("idea_rt.jar"))) {
// AnsiConsole.systemUninstall();
// }
try {
if (Emulator.threading != null)
@ -289,6 +288,10 @@ public final class Emulator {
return database;
}
public static DatabaseLogger getDatabaseLogger() {
return databaseLogger;
}
public static Runtime getRuntime() {
return runtime;
}
@ -301,10 +304,6 @@ public final class Emulator {
return rconServer;
}
public static Logging getLogging() {
return logging;
}
public static ThreadPooling getThreading() {
return threading;
}
@ -318,7 +317,7 @@ public final class Emulator {
}
public static Random getRandom() {
return random;
return ThreadLocalRandom.current();
}
public static BadgeImager getBadgeImager() {
@ -361,7 +360,7 @@ public final class Emulator {
try {
res = format.parse(date);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
LOGGER.error("Error parsing date", e);
}
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.navigator.SearchRoomsEvent;
import com.eu.habbo.threading.runnables.AchievementUpdater;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.PreparedStatement;
@ -15,57 +17,26 @@ import java.util.Map;
public class CleanerThread implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(CleanerThread.class);
public static final int DELAY = 10000;
public static final int RELOAD_HALL_OF_FAME = 1800;
public static final int RELOAD_NEWS_LIST = 3600;
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 DELAY = 10000;
private static final int RELOAD_HALL_OF_FAME = 1800;
private static final int RELOAD_NEWS_LIST = 3600;
private static final int REMOVE_INACTIVE_ROOMS = 120;
private static final int REMOVE_INACTIVE_GUILDS = 60;
private static final int REMOVE_INACTIVE_TOURS = 600;
private static final int SAVE_ERROR_LOGS = 30;
private static final int CLEAR_CACHED_VALUES = 60 * 60;
private static final int CALLBACK_TIME = 60 * 15;
private static int LAST_HOF_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_GUILDS_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_DAILY_REFILL = Emulator.getIntUnixTimestamp();
private static int LAST_CALLBACK = Emulator.getIntUnixTimestamp();
private static int LAST_HABBO_CACHE_CLEARED = Emulator.getIntUnixTimestamp();
public CleanerThread() {
@ -110,7 +81,7 @@ public class CleanerThread implements Runnable {
}
if (time - LAST_ERROR_LOGS_SAVED > SAVE_ERROR_LOGS) {
Emulator.getLogging().saveLogs();
Emulator.getDatabaseLogger().save();
LAST_ERROR_LOGS_SAVED = time;
}
@ -156,9 +127,10 @@ public class CleanerThread implements Runnable {
statement.execute("DELETE FROM users_effects WHERE total <= 0");
}
} 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() {
@ -167,7 +139,7 @@ public class CleanerThread implements Runnable {
statement.setInt(2, Emulator.getConfig().getInt("hotel.daily.respect.pets"));
statement.executeUpdate();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
if (Emulator.isReady) {
@ -188,7 +160,7 @@ public class CleanerThread implements Runnable {
habbo.clearCaches();
}
} 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.SQLException;
public class CommandLog implements Loggable {
public static final String insertQuery = "INSERT INTO commandlogs (`user_id`, `timestamp`, `command`, `params`, `succes`) VALUES (?, ?, ?, ?, ?)";
public class CommandLog implements DatabaseLoggable {
private static final String INSERT_QUERY = "INSERT INTO commandlogs (`user_id`, `timestamp`, `command`, `params`, `succes`) VALUES (?, ?, ?, ?, ?)";
private final int userId;
private final int timestamp = Emulator.getIntUnixTimestamp();
@ -15,7 +16,6 @@ public class CommandLog implements Loggable {
private final String params;
private final boolean succes;
public CommandLog(int userId, Command command, String params, boolean succes) {
this.userId = userId;
this.command = command;
@ -23,6 +23,11 @@ public class CommandLog implements Loggable {
this.succes = succes;
}
@Override
public String getQuery() {
return CommandLog.INSERT_QUERY;
}
@Override
public void log(PreparedStatement statement) throws SQLException {
statement.setInt(1, this.userId);
@ -32,4 +37,5 @@ public class CommandLog implements Loggable {
statement.setString(5, this.succes ? "yes" : "no");
statement.addBatch();
}
}

View File

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

View File

@ -2,11 +2,15 @@ package com.eu.habbo.core;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;
public class CreditsScheduler extends Scheduler {
private static final Logger LOGGER = LoggerFactory.getLogger(CreditsScheduler.class);
public static boolean IGNORE_HOTEL_VIEW;
public static boolean IGNORE_IDLED;
@ -48,7 +52,7 @@ public class CreditsScheduler extends Scheduler {
habbo.giveCredits(habbo.getHabboInfo().getRank().getCreditsTimerAmount());
}
} 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.SQLException;
public interface Loggable {
public interface DatabaseLoggable {
String getQuery();
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;
import com.eu.habbo.Emulator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.PrintWriter;
@ -8,9 +10,11 @@ import java.io.StringWriter;
import java.sql.PreparedStatement;
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 buildHash;
@ -19,7 +23,6 @@ public class ErrorLog implements Loggable {
public final String stackTrace;
public ErrorLog(String type, Throwable e) {
this.version = Emulator.version;
this.buildHash = Emulator.version;
@ -35,7 +38,7 @@ public class ErrorLog implements Loggable {
pw.close();
sw.close();
} catch (IOException e1) {
Emulator.getLogging().logErrorLine(e1);
LOGGER.error("Exception caught", e1);
}
}
@ -48,6 +51,11 @@ public class ErrorLog implements Loggable {
this.stackTrace = message;
}
@Override
public String getQuery() {
return QUERY;
}
@Override
public void log(PreparedStatement statement) throws SQLException {
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.habbohotel.users.Habbo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;
public class GotwPointsScheduler extends Scheduler {
private static final Logger LOGGER = LoggerFactory.getLogger(GotwPointsScheduler.class);
public static boolean IGNORE_HOTEL_VIEW;
public static boolean IGNORE_IDLED;
public static String GOTW_POINTS_NAME;
@ -63,7 +67,7 @@ public class GotwPointsScheduler extends Scheduler {
}
}
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
LOGGER.error("Caught exception", e);
}
}
}

View File

@ -1,338 +0,0 @@
package com.eu.habbo.core;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
import gnu.trove.set.hash.THashSet;
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;
public class Logging {
public static final String ANSI_BRIGHT = "\u001B[1m";
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);
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;
}
*/
}

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@ package com.eu.habbo.crypto;
import com.eu.habbo.crypto.exceptions.HabboCryptoException;
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.nio.charset.StandardCharsets;

View File

@ -1,27 +0,0 @@
package com.eu.habbo.crypto.utils;
public class HexUtils {
private static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray();
public static String toHex(byte[] bytes) {
char[] hexChars = new char[bytes.length * 2];
for (int j = 0; j < bytes.length; j++) {
int v = bytes[j] & 0xFF;
hexChars[j * 2] = HEX_ARRAY[v >>> 4];
hexChars[j * 2 + 1] = HEX_ARRAY[v & 0x0F];
}
return new String(hexChars);
}
public static byte[] toBytes(String hexString) {
int len = hexString.length();
byte[] data = new byte[len / 2];
for (int i = 0; i < len; i += 2) {
data[i / 2] = (byte) ((Character.digit(hexString.charAt(i), 16) << 4)
+ Character.digit(hexString.charAt(i+1), 16));
}
return data;
}
}

View File

@ -3,16 +3,17 @@ package com.eu.habbo.database;
import com.eu.habbo.Emulator;
import com.eu.habbo.core.ConfigurationManager;
import com.zaxxer.hikari.HikariDataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Database {
private static final Logger LOGGER = LoggerFactory.getLogger(Database.class);
private HikariDataSource dataSource;
private DatabasePool databasePool;
public Database(ConfigurationManager config) {
long millis = System.currentTimeMillis();
boolean SQLException = false;
@ -20,25 +21,23 @@ public class Database {
try {
this.databasePool = new DatabasePool();
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;
return;
}
this.dataSource = this.databasePool.getDatabase();
} catch (Exception e) {
SQLException = true;
e.printStackTrace();
Emulator.getLogging().logStart("Failed to connect to your database.");
Emulator.getLogging().logStart(e.getMessage());
LOGGER.error("Failed to connect to your database.", e);
} finally {
if (SQLException)
if (SQLException) {
Emulator.prepareShutdown();
}
}
Emulator.getLogging().logStart("Database -> Connected! (" + (System.currentTimeMillis() - millis) + " MS)");
LOGGER.info("Database -> Connected! ({} MS)", System.currentTimeMillis() - millis);
}
public void dispose() {
if (this.databasePool != null) {
this.databasePool.getDatabase().close();
@ -55,4 +54,3 @@ public class Database {
return this.databasePool;
}
}

View File

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

View File

@ -58,7 +58,7 @@ public class AchievementManager {
statement.setInt(4, amount);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}
@ -140,7 +140,7 @@ public class AchievementManager {
try {
badge = habbo.getInventory().getBadgesComponent().getBadge(("ACH_" + achievement.name + oldLevel.level).toLowerCase());
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
return;
}
}
@ -203,7 +203,7 @@ public class AchievementManager {
statement.setInt(3, 1);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -217,7 +217,7 @@ public class AchievementManager {
}
statement.executeBatch();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -231,7 +231,7 @@ public class AchievementManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return 0;
@ -254,9 +254,9 @@ public class AchievementManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
@ -276,13 +276,13 @@ public class AchievementManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
Emulator.getLogging().logErrorLine("Achievement Manager -> Failed to load!");
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) {

View File

@ -57,7 +57,7 @@ public class TalentTrackLevel {
if (item != null) {
this.items.add(item);
} else {
Emulator.getLogging().logStart("Incorrect reward furni (ID: " + s + ") for talent track level " + this.level);
logger.info("Incorrect reward furni (ID: " + s + ") for talent track level " + this.level);
}
}

View File

@ -155,7 +155,7 @@ public class Bot implements Runnable {
statement.execute();
this.needsUpdate = false;
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}

View File

@ -38,7 +38,7 @@ public class BotManager {
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 {
@ -58,10 +58,10 @@ public class BotManager {
m.setAccessible(true);
m.invoke(null);
} 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;
} 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;
}
}
@ -88,12 +88,12 @@ public class BotManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return bot;
@ -143,7 +143,7 @@ public class BotManager {
try {
topItem.onWalkOn(bot.getRoomUnit(), room, null);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
}
bot.cycle(false);
@ -195,9 +195,9 @@ public class BotManager {
else
Emulator.getLogging().logErrorLine("Unknown Bot Type: " + type);
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
return null;
@ -208,7 +208,7 @@ public class BotManager {
statement.setInt(1, bot.getId());
return statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return false;
@ -221,9 +221,9 @@ public class BotManager {
m.setAccessible(true);
m.invoke(null);
} 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) {
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

@ -43,7 +43,7 @@ public class ButlerBot extends Bot {
serveItems.put(ks, set.getInt("item"));
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}

View File

@ -211,7 +211,7 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
identifier = Integer.parseInt(itemId);
} 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;
}
if (identifier > 0) {
@ -259,7 +259,7 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
}
} catch (Exception e) {
Emulator.getLogging().logDebugLine("Failed to load " + this.itemId);
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
} else {
try {
@ -343,7 +343,7 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
statement.setInt(3, this.getId());
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
this.needsUpdate = false;

View File

@ -47,7 +47,7 @@ public class CatalogLimitedConfiguration implements Runnable {
statement.setInt(5, item.getLimitedSells());
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}
@ -65,7 +65,7 @@ public class CatalogLimitedConfiguration implements Runnable {
statement.executeBatch();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
this.totalSet += amount;
@ -98,7 +98,7 @@ public class CatalogLimitedConfiguration implements Runnable {
statement.setInt(3, this.itemId);
statement.execute();
} 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.gameclients.GameClient;
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.Item;
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.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.InvocationTargetException;
import java.sql.*;
@ -47,6 +50,8 @@ import java.util.stream.Collectors;
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) {
{
for (CatalogPageLayouts layout : CatalogPageLayouts.values()) {
@ -209,7 +214,7 @@ public class CatalogManager {
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) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
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"));
if (pageClazz == null) {
Emulator.getLogging().logStart("Unknown Page Layout: " + set.getString("page_layout"));
LOGGER.info("Unknown Page Layout: " + set.getString("page_layout"));
continue;
}
@ -277,12 +282,12 @@ public class CatalogManager {
CatalogPage page = pageClazz.getConstructor(ResultSet.class).newInstance(set);
pages.put(page.getId(), page);
} 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) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
pages.forEachValue((object) -> {
@ -294,7 +299,7 @@ public class CatalogManager {
}
} else {
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;
@ -302,7 +307,7 @@ public class CatalogManager {
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) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
@ -367,7 +372,7 @@ public class CatalogManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
for (CatalogPage page : this.catalogPages.valueCollection()) {
@ -392,7 +397,7 @@ public class CatalogManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
@ -408,7 +413,7 @@ public class CatalogManager {
}
}
} 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));
}
} 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);
} 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) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
}
@ -472,7 +477,7 @@ public class CatalogManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
}
@ -489,7 +494,7 @@ public class CatalogManager {
}
}
} 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));
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
}
@ -594,7 +599,7 @@ public class CatalogManager {
return statement.executeUpdate() >= 1;
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return false;
@ -699,7 +704,7 @@ public class CatalogManager {
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())];
} else {
Emulator.getLogging().logErrorLine("[Recycler] No rewards specified for rarity level " + level);
LOGGER.error("No rewards specified for rarity level {}", level);
}
return null;
@ -730,13 +735,11 @@ public class CatalogManager {
if (pageClazz != null) {
try {
catalogPage = pageClazz.getConstructor(ResultSet.class).newInstance(page);
} catch (InvocationTargetException e) {
Emulator.getLogging().logErrorLine(e.getCause());
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
LOGGER.error("Caught exception", e);
}
} 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) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
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)) {
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);
Emulator.getLogging().logUserLine(message);
LOGGER.info(message);
habbo.getClient().sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.ILLEGAL));
return;
}
@ -957,7 +960,7 @@ public class CatalogManager {
try {
pet = Emulator.getGameEnvironment().getPetManager().createPet(baseItem, data[0], data[1], data[2], habbo.getClient());
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
LOGGER.error("Caught exception", e);
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
}
@ -1012,7 +1015,7 @@ public class CatalogManager {
try {
guildId = Integer.parseInt(extradata);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
LOGGER.error("Caught exception", e);
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
return;
}
@ -1120,7 +1123,7 @@ public class CatalogManager {
habbo.getClient().sendResponse(new InventoryRefreshComposer());
} catch (Exception e) {
Emulator.getLogging().logPacketError(e);
LOGGER.error("Exception caught", e);
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
}
} finally {
@ -1158,7 +1161,7 @@ public class CatalogManager {
statement.setInt(3, Emulator.getIntUnixTimestamp());
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
}

View File

@ -70,7 +70,7 @@ public abstract class CatalogPage implements Comparable<CatalogPage>, ISerialize
try {
this.included.add(Integer.valueOf(id));
} 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 + ")");
}
}

View File

@ -41,7 +41,7 @@ public class Voucher {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -64,7 +64,7 @@ public class Voucher {
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}

View File

@ -185,7 +185,7 @@ public class RoomBundleLayout extends SingleBundle {
statement.setInt(3, this.room.getId());
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -219,7 +219,7 @@ public class RoomBundleLayout extends SingleBundle {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
Room r = Emulator.getGameEnvironment().getRoomManager().loadRoom(roomId);

View File

@ -43,7 +43,7 @@ public class MarketPlace {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return offers;
@ -101,7 +101,7 @@ public class MarketPlace {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
habbo.getClient().sendResponse(new MarketplaceCancelSaleComposer(offer, false));
}
}
@ -163,7 +163,7 @@ public class MarketPlace {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return offers;
@ -193,7 +193,7 @@ public class MarketPlace {
message.appendInt(1);
message.appendInt(itemId);
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -208,7 +208,7 @@ public class MarketPlace {
number = set.getInt("number");
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return number;
@ -226,7 +226,7 @@ public class MarketPlace {
avg = set.getInt("avg");
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return calculateCommision(avg);
@ -294,7 +294,7 @@ public class MarketPlace {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -321,7 +321,7 @@ public class MarketPlace {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -388,7 +388,7 @@ public class MarketPlace {
statement.setInt(2, offer.getOfferId());
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}

View File

@ -66,7 +66,7 @@ public class MarketPlaceOffer implements Runnable {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -86,7 +86,7 @@ public class MarketPlaceOffer implements Runnable {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -160,7 +160,7 @@ public class MarketPlaceOffer implements Runnable {
statement.setInt(3, this.offerId);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}

View File

@ -49,7 +49,7 @@ public class AddYoutubePlaylistCommand extends Command {
statement.execute();
} 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"));

View File

@ -72,7 +72,7 @@ public class BadgeCommand extends Command {
return true;
}
} 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 gnu.trove.iterator.TIntObjectIterator;
import gnu.trove.map.hash.THashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Comparator;
@ -22,6 +24,9 @@ import java.util.List;
import java.util.NoSuchElementException;
public class CommandHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(CommandHandler.class);
private final static THashMap<String, Command> commands = new THashMap<>(5);
private static final Comparator<Command> ALPHABETICAL_ORDER = new Comparator<Command>() {
public int compare(Command c1, Command c2) {
@ -33,7 +38,7 @@ public class CommandHandler {
public CommandHandler() {
long millis = System.currentTimeMillis();
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) {
@ -48,9 +53,9 @@ public class CommandHandler {
try {
//command.getConstructor().setAccessible(true);
addCommand(command.newInstance());
Emulator.getLogging().logDebugLine("Added command: " + command.getName());
LOGGER.debug("Added command: {}", command.getName());
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
LOGGER.error("Caught exception", e);
}
}
@ -79,11 +84,11 @@ public class CommandHandler {
succes = event.succes;
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
LOGGER.error("Caught exception", e);
}
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() {
commands.clear();
Emulator.getLogging().logShutdownLine("Command Handler -> Disposed!");
LOGGER.info("Command Handler -> Disposed!");
}
}

View File

@ -38,7 +38,7 @@ public class EnableCommand extends Command {
}
}
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
}
}

View File

@ -35,7 +35,7 @@ public class FilterWordCommand extends Command {
statement.setString(2, replacement);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_filterword.error"));
return true;
}

View File

@ -62,7 +62,7 @@ public class RoomBundleCommand extends Command {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
((RoomBundleLayout) page).loadItems(gameClient.getHabbo().getHabboInfo().getCurrentRoom());

View File

@ -60,7 +60,7 @@ public class CraftingManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -114,7 +114,7 @@ public class CraftingManager {
}
statement.executeBatch();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
this.altars.clear();

View File

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

View File

@ -73,7 +73,7 @@ public abstract class Game implements Runnable {
return true;
}
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
return false;

View File

@ -149,7 +149,7 @@ public class BattleBanzaiGame extends Game {
}
}
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
}

View File

@ -261,7 +261,7 @@ public class FreezeGame extends Game {
}
}
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
}

View File

@ -91,7 +91,7 @@ public class Guild implements Runnable {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -116,7 +116,7 @@ public class Guild implements Runnable {
this.needsUpdate = false;
} 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.TIntObjectHashMap;
import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.*;
import java.util.*;
@ -20,6 +22,8 @@ import java.util.stream.Collectors;
public class GuildManager {
private static final Logger LOGGER = LoggerFactory.getLogger(GuildManager.class);
private final THashMap<GuildPartType, THashMap<Integer, GuildPart>> guildParts;
private final TIntObjectMap<Guild> guilds;
@ -34,7 +38,7 @@ public class GuildManager {
this.loadGuildParts();
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));
}
} 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));
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
@ -107,7 +111,7 @@ public class GuildManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
habbo.getHabboStats().addGuild(guild.getId());
@ -155,7 +159,7 @@ public class GuildManager {
room.setGuild(0);
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
@ -276,7 +280,7 @@ public class GuildManager {
}
}
} 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.execute();
} 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.execute();
} 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.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
@ -352,7 +356,7 @@ public class GuildManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return member;
@ -375,7 +379,7 @@ public class GuildManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return guildMembers;
@ -397,7 +401,7 @@ public class GuildManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return guildMembers;
@ -416,7 +420,7 @@ public class GuildManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return 0;
@ -434,7 +438,7 @@ public class GuildManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return guildAdmins;
@ -466,7 +470,7 @@ public class GuildManager {
if (g != null)
g.loadMemberCount();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
@ -494,7 +498,7 @@ public class GuildManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return guilds;
@ -514,7 +518,7 @@ public class GuildManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return guilds;
@ -593,7 +597,7 @@ public class GuildManager {
statement.setInt(2, furni.getId());
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
@ -608,7 +612,7 @@ public class GuildManager {
guildIterator.remove();
}
Emulator.getLogging().logShutdownLine("Guild Manager -> Disposed!");
LOGGER.info("Guild Manager -> Disposed!");
}
public boolean hasViewedForum(int userId, int guildId) {
@ -628,7 +632,7 @@ public class GuildManager {
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}

View File

@ -108,7 +108,7 @@ public class ForumThread implements Runnable, ISerialize {
Emulator.getPluginManager().fireEvent(new GuildForumThreadCreated(createdThread));
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return createdThread;
@ -156,7 +156,7 @@ public class ForumThread implements Runnable, ISerialize {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return threads;
@ -195,7 +195,7 @@ public class ForumThread implements Runnable, ISerialize {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return foundThread;
@ -337,7 +337,7 @@ public class ForumThread implements Runnable, ISerialize {
addComment(comment);
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}
@ -461,7 +461,7 @@ public class ForumThread implements Runnable, ISerialize {
this.needsUpdate = false;
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}

View File

@ -64,7 +64,7 @@ public class ForumThreadComment implements Runnable, ISerialize {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return foundComment;
@ -103,7 +103,7 @@ public class ForumThreadComment implements Runnable, ISerialize {
Emulator.getPluginManager().fireEvent(new GuildForumThreadCommentCreated(createdComment));
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return createdComment;
@ -200,7 +200,7 @@ public class ForumThreadComment implements Runnable, ISerialize {
this.needsUpdate = false;
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}

View File

@ -32,7 +32,7 @@ public class HallOfFame {
this.winners.put(winner.getId(), winner);
}
} 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;
import com.eu.habbo.Emulator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HotelViewManager {
private static final Logger LOGGER = LoggerFactory.getLogger(HotelViewManager.class);
private final HallOfFame hallOfFame;
private final NewsList newsList;
@ -11,7 +15,7 @@ public class HotelViewManager {
this.hallOfFame = new HallOfFame();
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() {
@ -23,6 +27,7 @@ public class HotelViewManager {
}
public void dispose() {
Emulator.getLogging().logShutdownLine("HotelView Manager -> Disposed!");
LOGGER.info("HotelView Manager -> Disposed!");
}
}

View File

@ -25,7 +25,7 @@ public class NewsList {
this.newsWidgets.add(new NewsWidget(set));
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}

View File

@ -52,7 +52,7 @@ public class CrackableReward {
this.prizes.put(itemId, new AbstractMap.SimpleEntry<>(this.totalChance, this.totalChance + chance));
this.totalChance += chance;
} 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.TIntObjectHashMap;
import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor;
import java.sql.*;
import java.util.*;
public class ItemManager {
private static final Logger LOGGER = LoggerFactory.getLogger(ItemManager.class);
//Configuration. Loaded from database & updated accordingly.
public static boolean RECYCLER_ENABLED = true;
@ -100,7 +105,7 @@ public class ItemManager {
this.highscoreManager.load();
this.loadNewUserGifts();
Emulator.getLogging().logStart("Item Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
LOGGER.info("Item Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
protected void loadItemInteractions() {
@ -354,7 +359,7 @@ public class ItemManager {
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);
}
@ -384,12 +389,12 @@ public class ItemManager {
else
this.items.get(id).update(set);
} catch (Exception e) {
Emulator.getLogging().logErrorLine("Failed to load Item (" + set.getInt("id") + ")");
Emulator.getLogging().logErrorLine(e);
LOGGER.error("Failed to load Item ({})", set.getInt("id"));
LOGGER.error("Caught exception", e);
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
@ -402,16 +407,16 @@ public class ItemManager {
try {
reward = new CrackableReward(set);
} catch (Exception e) {
Emulator.getLogging().logErrorLine("Failed to load items_crackable item_id = " + set.getInt("item_id"));
Emulator.getLogging().logErrorLine(e);
LOGGER.error("Failed to load items_crackable item_id = {}", set.getInt("item_id"));
LOGGER.error("Caught exception", e);
continue;
}
this.crackableRewards.put(set.getInt("item_id"), reward);
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL 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));
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
@ -478,16 +483,16 @@ public class ItemManager {
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);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
LOGGER.error("Caught exception", e);
return new InteractionDefault(set.getInt(1), habboId, item, extraData, limitedStack, limitedSells);
}
}
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
LOGGER.error("Caught exception", e);
}
return null;
}
@ -502,7 +507,7 @@ public class ItemManager {
}
}
} 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.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
@ -554,7 +559,7 @@ public class ItemManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return item;
@ -594,9 +599,9 @@ public class ItemManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
LOGGER.error("Caught exception", e);
}
return item;
@ -608,7 +613,7 @@ public class ItemManager {
statement.setInt(2, itemTwoId);
statement.execute();
} 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.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
@ -633,7 +638,7 @@ public class ItemManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return a;
@ -649,9 +654,9 @@ public class ItemManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
LOGGER.error("Caught exception", e);
}
return item;
@ -672,7 +677,7 @@ public class ItemManager {
return (HabboItem) c.newInstance(set, baseItem);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
LOGGER.error("Caught exception", e);
}
}
@ -695,7 +700,7 @@ public class ItemManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
@ -703,7 +708,7 @@ public class ItemManager {
return null;
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);
}
@ -720,7 +725,7 @@ public class ItemManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
if (gift != null) {
@ -774,7 +779,7 @@ public class ItemManager {
this.items.clear();
this.highscoreManager.dispose();
Emulator.getLogging().logShutdownLine("Item Manager -> Disposed!");
LOGGER.info("Item Manager -> Disposed!");
}
public List<String> getInteractionList() {

View File

@ -80,7 +80,7 @@ public class YoutubeManager {
Emulator.getThreading().run(() -> {
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 (ResultSet set = statement.executeQuery()) {
@ -103,7 +103,7 @@ public class YoutubeManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
youtubeDataLoaderPool.shutdown();
@ -113,7 +113,7 @@ public class YoutubeManager {
e.printStackTrace();
}
Emulator.getLogging().logStart("YouTube Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
logger.info("YouTube Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
});
}

View File

@ -41,7 +41,7 @@ public class InteractionColorPlate extends InteractionDefault {
try {
state = Integer.valueOf(this.getExtradata());
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
state += amount;

View File

@ -50,7 +50,7 @@ public class InteractionRentableSpace extends HabboItem {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
} else {
@ -180,7 +180,7 @@ public class InteractionRentableSpace extends HabboItem {
statement.setInt(1, zero);
statement.setInt(2, zero);
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}

View File

@ -71,7 +71,7 @@ public abstract class InteractionWired extends HabboItem {
statement.setInt(2, this.getId());
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
super.run();

View File

@ -33,7 +33,7 @@ public class InteractionWiredHighscore extends HabboItem {
this.scoreType = WiredHighscoreScoreType.valueOf(name);
this.clearType = WiredHighscoreClearType.values()[ctype];
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
this.reloadData();
@ -51,7 +51,7 @@ public class InteractionWiredHighscore extends HabboItem {
this.scoreType = WiredHighscoreScoreType.valueOf(name);
this.clearType = WiredHighscoreClearType.values()[ctype];
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
this.reloadData();
@ -83,7 +83,7 @@ public class InteractionWiredHighscore extends HabboItem {
this.setExtradata(Math.abs(state - 1) + "");
room.updateItem(this);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
}

View File

@ -89,7 +89,7 @@ public class InteractionGameTimer extends HabboItem implements Runnable {
}
}).toArray();
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
}
@ -117,7 +117,7 @@ public class InteractionGameTimer extends HabboItem implements Runnable {
room.addGame(game);
game.initialise();
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
}
}

View File

@ -71,7 +71,7 @@ public class WiredConditionHabboHasHandItem extends InteractionWiredCondition {
try {
this.handItem = Integer.valueOf(set.getString("wired_data"));
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
}

View File

@ -189,7 +189,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect {
}
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
}

View File

@ -136,7 +136,7 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
item.onClick(habbo != null && !(item instanceof InteractionGameTimer) ? habbo.getClient() : null, room, new Object[]{state, this.getType()});
}
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
}

View File

@ -120,7 +120,7 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
item.setExtradata(Emulator.getRandom().nextInt(item.getBaseItem().getStateCount() + 1) + "");
room.updateItem(item);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
}
return true;

View File

@ -157,7 +157,7 @@ public class WiredTriggerBotReachedFurni extends InteractionWiredTrigger {
if (item != null)
this.items.add(item);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
}
}

View File

@ -31,7 +31,7 @@ public class Message implements Runnable {
statement.setInt(4, this.timestamp);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}

View File

@ -41,7 +41,7 @@ public class Messenger {
statement.setInt(4, userOne);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -55,7 +55,7 @@ public class Messenger {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return users;
}
@ -85,7 +85,7 @@ public class Messenger {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return false;
@ -102,7 +102,7 @@ public class Messenger {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return false;
@ -114,7 +114,7 @@ public class Messenger {
statement.setInt(2, userFrom);
statement.executeUpdate();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -133,7 +133,7 @@ public class Messenger {
count = set.getInt("count");
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return count;
@ -157,7 +157,7 @@ public class Messenger {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return map;
}
@ -213,7 +213,7 @@ public class Messenger {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -237,7 +237,7 @@ public class Messenger {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return buddy;
@ -252,7 +252,7 @@ public class Messenger {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -311,7 +311,7 @@ public class Messenger {
statement.setInt(1, userTo);
statement.executeUpdate();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -323,7 +323,7 @@ public class Messenger {
statement.setInt(3, userFrom);
return statement.executeUpdate();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return 0;
@ -345,7 +345,7 @@ public class Messenger {
statement.setInt(3, Emulator.getIntUnixTimestamp());
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
Habbo habboTo = Emulator.getGameServer().getGameClientManager().getHabbo(userTo);

View File

@ -44,7 +44,7 @@ public class MessengerBuddy implements Runnable, ISerialize {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -56,7 +56,7 @@ public class MessengerBuddy implements Runnable, ISerialize {
this.relation = 0;
this.userOne = 0;
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -149,7 +149,7 @@ public class MessengerBuddy implements Runnable, ISerialize {
statement.setInt(3, this.id);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}

View File

@ -63,7 +63,7 @@ public class ModToolBan implements Runnable {
statement.setInt(9, this.cfhTopic);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}

View File

@ -41,7 +41,7 @@ public class ModToolManager {
this.tickets = new THashMap<>();
this.cfhCategories = new TIntObjectHashMap<>();
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) {
@ -58,9 +58,9 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
}
@ -78,7 +78,7 @@ public class ModToolManager {
this.loadTickets(connection);
this.loadCfhCategories(connection);
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -97,7 +97,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -108,7 +108,7 @@ public class ModToolManager {
this.presets.get(set.getString("type")).add(set.getString("preset"));
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}
@ -120,7 +120,7 @@ public class ModToolManager {
this.tickets.put(set.getInt("id"), new ModToolIssue(set));
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}
@ -146,7 +146,7 @@ public class ModToolManager {
this.cfhCategories.get(set.getInt("support_cfh_category_id")).addTopic(new CfhTopic(set, this.getIssuePreset(set.getInt("default_sanction"))));
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -198,7 +198,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return chatlogs;
@ -215,7 +215,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return chatlogs;
@ -235,7 +235,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return chatLogs;
@ -272,7 +272,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return chatlogs;
@ -290,7 +290,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return roomVisits;
@ -348,7 +348,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return roomVisits;
@ -378,7 +378,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return null;
@ -495,7 +495,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return ban;
@ -519,7 +519,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return banned;
@ -543,7 +543,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return false;
@ -557,7 +557,7 @@ public class ModToolManager {
statement.execute();
return statement.getUpdateCount() > 0;
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return false;
@ -662,7 +662,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return total;

View File

@ -22,7 +22,7 @@ public class ModToolSanctions {
this.sanctionHashmap = new THashMap<>();
this.sanctionLevelsHashmap = new THashMap<>();
this.loadModSanctions();
Emulator.getLogging().logStart("Sanctions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
logger.info("Sanctions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
@ -41,7 +41,7 @@ public class ModToolSanctions {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -68,7 +68,7 @@ public class ModToolSanctions {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return this.sanctionHashmap;
@ -87,7 +87,7 @@ public class ModToolSanctions {
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -98,7 +98,7 @@ public class ModToolSanctions {
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -109,7 +109,7 @@ public class ModToolSanctions {
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -120,7 +120,7 @@ public class ModToolSanctions {
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}

View File

@ -29,7 +29,7 @@ public class WordFilter {
public WordFilter() {
long start = System.currentTimeMillis();
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) {
@ -54,7 +54,7 @@ public class WordFilter {
try {
word = new WordFilterWord(set);
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
continue;
}
@ -67,7 +67,7 @@ public class WordFilter {
}
}
} 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.users.Habbo;
import gnu.trove.map.hash.THashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Method;
import java.sql.Connection;
@ -18,9 +20,9 @@ import java.util.concurrent.ConcurrentHashMap;
public class NavigatorManager {
private static final Logger LOGGER = LoggerFactory.getLogger(NavigatorManager.class);
public static int MAXIMUM_RESULTS_PER_PAGE = 10;
public static boolean CATEGORY_SORT_USING_ORDER_NUM = false;
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(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() {
@ -49,7 +51,7 @@ public class NavigatorManager {
this.publicCategories.put(set.getInt("id"), new NavigatorPublicCategory(set));
}
} 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'")) {
@ -62,12 +64,12 @@ public class NavigatorManager {
if (room != null) {
category.addRoom(room);
} 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) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
@ -83,7 +85,7 @@ public class NavigatorManager {
field = clazz.getDeclaredMethod(s);
clazz = field.getReturnType();
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
LOGGER.error("Caught exception", e);
break;
}
}
@ -91,7 +93,7 @@ public class NavigatorManager {
try {
field = clazz.getDeclaredMethod(set.getString("field"));
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
LOGGER.error("Caught exception", e);
continue;
}
}
@ -101,11 +103,11 @@ public class NavigatorManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
List<Room> staffPromotedRooms = Emulator.getGameEnvironment().getRoomManager().getRoomsStaffPromoted();

View File

@ -25,7 +25,7 @@ public class PermissionsManager {
this.reload();
Emulator.getLogging().logStart("Permissions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
logger.info("Permissions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
public void reload() {
@ -58,7 +58,7 @@ public class PermissionsManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -71,7 +71,7 @@ public class PermissionsManager {
this.enables.put(set.getInt("effect_id"), set.getInt("min_rank"));
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}

View File

@ -47,7 +47,7 @@ public class GnomePet extends Pet implements IPetLook {
statement.setInt(2, this.id);
statement.executeUpdate();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}

View File

@ -40,7 +40,7 @@ public class HorsePet extends RideablePet {
statement.setInt(6, super.getId());
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
super.run();

View File

@ -138,7 +138,7 @@ public class MonsterplantPet extends Pet implements IPetLook {
statement.setInt(13, this.id);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}

View File

@ -205,7 +205,7 @@ public class Pet implements ISerialize, Runnable {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
this.needsUpdate = false;

View File

@ -80,7 +80,7 @@ public class PetManager {
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) {
@ -151,7 +151,7 @@ public class PetManager {
this.loadPetCommands(connection);
this.loadPetBreeding(connection);
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
Emulator.getLogging().logErrorLine("Pet Manager -> Failed to load!");
}
}
@ -167,7 +167,7 @@ public class PetManager {
this.petRaces.get(set.getInt("race")).add(new PetRace(set));
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -177,7 +177,7 @@ public class PetManager {
this.petData.put(set.getInt("pet_type"), new PetData(set));
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
this.loadPetItems(connection);
@ -217,7 +217,7 @@ public class PetManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -244,7 +244,7 @@ public class PetManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -255,7 +255,7 @@ public class PetManager {
commandsList.put(set.getInt("command_id"), new PetCommand(set, this.petActions.get(set.getInt("command_id"))));
}
} 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")) {
@ -267,7 +267,7 @@ public class PetManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -277,7 +277,7 @@ public class PetManager {
this.breedingPetType.put(set.getInt("pet_id"), set.getInt("offspring_id"));
}
} 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")) {
@ -294,7 +294,7 @@ public class PetManager {
this.breedingReward.get(reward.petType).get(reward.rarityLevel).add(reward);
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -308,7 +308,7 @@ public class PetManager {
int petId = Integer.valueOf(petName.split("t")[1]);
return this.petRaces.get(petId);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
return null;
@ -364,7 +364,7 @@ public class PetManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}
@ -511,7 +511,7 @@ public class PetManager {
statement.setInt(1, pet.getId());
return statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return false;

View File

@ -23,7 +23,7 @@ public class PollManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return false;
}
@ -63,7 +63,7 @@ public class PollManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}

View File

@ -30,7 +30,7 @@ public class CustomRoomLayout extends RoomLayout implements Runnable {
statement.setInt(5, this.roomId);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}

View File

@ -265,7 +265,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
this.loadBans(connection);
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
this.tradeMode = set.getInt("trade_mode");
@ -313,49 +313,49 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try {
this.loadLayout();
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
try {
this.loadRights(connection);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
try {
this.loadItems(connection);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
try {
this.loadHeightmap();
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
try {
this.loadBots(connection);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
try {
this.loadPets(connection);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
try {
this.loadWordFilter(connection);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
try {
this.loadWiredData(connection);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
this.idleCycles = 0;
@ -363,7 +363,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
this.roomCycleTask = Emulator.getThreading().getService().scheduleAtFixedRate(this, 500, 500, TimeUnit.MILLISECONDS);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
this.traxManager = new TraxManager(this);
@ -416,7 +416,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
if (this.itemCount() > Room.MAXIMUM_FURNI) {
@ -438,14 +438,14 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
((InteractionWired) item).loadWiredData(set, this);
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
}
@ -481,7 +481,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -511,12 +511,12 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
this.getFurniOwnerNames().put(pet.getUserId(), set.getString("pet_owner_name"));
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -531,7 +531,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -921,7 +921,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
botIterator.value().needsUpdate(true);
Emulator.getThreading().run(botIterator.value());
} catch (NoSuchElementException e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
break;
}
}
@ -929,7 +929,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
this.currentBots.clear();
this.currentPets.clear();
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
}
@ -941,7 +941,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
this.preLoaded = true;
this.layout = null;
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
}
@ -1033,7 +1033,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
Emulator.getThreading().run(
Room.this::cycle);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
}
}
@ -1096,7 +1096,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.executeUpdate();
this.needsUpdate = false;
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}
@ -1107,7 +1107,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.setInt(2, this.id);
statement.executeUpdate();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -1250,7 +1250,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
} catch (NoSuchElementException e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
break;
}
}
@ -1263,7 +1263,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try {
petIterator.advance();
} catch (NoSuchElementException e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
break;
}
@ -1458,7 +1458,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try {
item.onWalkOn(unit, room, null);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
}
}, this.getRollerSpeed() == 0 ? 250 : InteractionRoller.DELAY);
@ -2010,7 +2010,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
pet.needsUpdate = true;
pet.run();
} catch (NoSuchElementException e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
break;
}
}
@ -2123,7 +2123,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.setInt(10, this.promotion.getCategory());
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
this.needsUpdate = true;
@ -2215,7 +2215,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
return this.habboQueue.remove(habbo.getHabboInfo().getId()) != null;
}
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
return true;
@ -2613,7 +2613,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try {
item.onWalkOff(habbo.getRoomUnit(), this, new Object[]{});
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
}
}
@ -2674,7 +2674,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try {
iterator.advance();
} catch (NoSuchElementException e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
break;
}
@ -2694,7 +2694,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try {
iterator.advance();
} catch (NoSuchElementException e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
break;
}
@ -2716,7 +2716,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try {
iterator.advance();
} catch (NoSuchElementException e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
break;
}
@ -2759,7 +2759,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try {
petIterator.advance();
} catch (NoSuchElementException e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
break;
}
@ -2838,7 +2838,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try {
petIterator.advance();
} catch (NoSuchElementException e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
break;
}
@ -2993,7 +2993,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try {
doorTileTopItem.onWalkOn(habbo.getRoomUnit(), this, new Object[]{});
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
}
}
@ -3180,7 +3180,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
bot.onUserSay(roomChatMessage);
} catch (NoSuchElementException e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
break;
}
}
@ -3204,7 +3204,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
item.onClick(habbo.getClient(), this, new Object[0]);
break;
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
}
}
@ -3757,7 +3757,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -3776,7 +3776,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -3820,7 +3820,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.setInt(2, userId);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -3857,7 +3857,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.setInt(2, userId);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -3875,7 +3875,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.setInt(1, this.id);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
this.refreshRightsInRoom();
@ -3942,7 +3942,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -4246,7 +4246,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.setString(2, word);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
return;
}
@ -4263,7 +4263,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.setString(2, word);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}

View File

@ -42,7 +42,7 @@ public class RoomBan {
statement.setInt(3, this.endTimestamp);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -53,7 +53,7 @@ public class RoomBan {
statement.setInt(2, this.userId);
statement.execute();
} 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;
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.messages.ISerialize;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.Incoming;
import com.eu.habbo.messages.incoming.MessageHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Arrays;
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@");
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;
//Configuration. Loaded from database & updated accordingly.
public static boolean SAVE_ROOM_CHATS = false;
@ -130,10 +135,11 @@ public class RoomChatMessage implements Runnable, ISerialize, Loggable {
try {
this.message = this.message.substring(0, RoomChatMessage.MAXIMUM_LENGTH - 1);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
LOGGER.error("Caught exception", e);
}
}
Emulator.getLogging().addChatLog(this);
Emulator.getDatabaseLogger().store(this);
}
public String getMessage() {
@ -191,7 +197,7 @@ public class RoomChatMessage implements Runnable, ISerialize, Loggable {
message.appendInt(0);
message.appendInt(this.getMessage().length());
} 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
public void log(PreparedStatement statement) throws SQLException {
statement.setInt(1, this.habbo.getHabboInfo().getId());

View File

@ -42,7 +42,7 @@ public class RoomLayout {
this.parse();
} 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.users.*;
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.rooms.RoomUncachedEvent;
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.TObjectProcedure;
import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.*;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
public class RoomManager {
private static final Logger LOGGER = LoggerFactory.getLogger(RoomManager.class);
private static final int page = 0;
//Configuration. Loaded from database & updated accordingly.
public static int MAXIMUM_ROOMS_USER = 25;
@ -89,7 +92,7 @@ public class RoomManager {
registerGameType(IceTagGame.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() {
@ -99,7 +102,7 @@ public class RoomManager {
this.mapNames.add(set.getString("name"));
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
@ -113,7 +116,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return layout;
@ -127,7 +130,7 @@ public class RoomManager {
this.roomCategories.put(set.getInt("id"), new RoomCategory(set));
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
@ -143,7 +146,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
@ -169,7 +172,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return rooms;
@ -276,7 +279,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return rooms;
@ -317,7 +320,7 @@ public class RoomManager {
this.activeRooms.put(room.getId(), room);
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return room;
@ -341,7 +344,7 @@ public class RoomManager {
room = this.loadRoom(set.getInt(1));
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return room;
@ -366,7 +369,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
@ -416,7 +419,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return layout;
@ -450,7 +453,7 @@ public class RoomManager {
statement.setInt(2, room.getId());
statement.execute();
} 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.execute();
} 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.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
}
@ -1090,7 +1093,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return rooms;
@ -1150,7 +1153,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return rooms;
@ -1217,7 +1220,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
Collections.sort(rooms);
@ -1263,7 +1266,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
Collections.sort(rooms);
@ -1286,7 +1289,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return rooms;
@ -1328,7 +1331,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return rooms;
@ -1350,7 +1353,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return rooms;
@ -1454,7 +1457,7 @@ public class RoomManager {
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) {
@ -1471,7 +1474,7 @@ public class RoomManager {
statement.setString(10, map);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return this.loadCustomLayout(room);

View File

@ -43,7 +43,7 @@ public class RoomPromotion {
statement.setInt(4, this.room.getId());
statement.executeUpdate();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
this.needsUpdate = false;

View File

@ -206,7 +206,7 @@ public class RoomTrade {
statement.executeBatch();
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
THashSet<HabboItem> itemsUserOne = new THashSet<>(userOne.getItems());

View File

@ -361,7 +361,7 @@ public class RoomUnit {
return false;
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
return false;
}
}

View File

@ -51,7 +51,7 @@ public class TraxManager implements Disposable {
stmt.setInt(2, musicDisc.getId());
stmt.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
return;
}
} else {
@ -67,7 +67,7 @@ public class TraxManager implements Disposable {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -157,7 +157,7 @@ public class TraxManager implements Disposable {
statement.setInt(2, musicDisc.getId());
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
return;
}
@ -184,7 +184,7 @@ public class TraxManager implements Disposable {
statement.setInt(2, itemId);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
return;
}
@ -277,7 +277,7 @@ public class TraxManager implements Disposable {
statement.setInt(1, this.room.getId());
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}

View File

@ -148,7 +148,7 @@ public class Habbo implements Runnable {
}
}
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
try {
@ -164,7 +164,7 @@ public class Habbo implements Runnable {
this.habboStats.dispose();
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
return;
} finally {
Emulator.getGameEnvironment().getRoomManager().unloadRoomsForHabbo(this);

View File

@ -77,7 +77,7 @@ public class HabboBadge implements Runnable {
this.needsUpdate = false;
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}

View File

@ -79,7 +79,7 @@ public class HabboInfo implements Runnable {
this.online = false;
this.currentRoom = null;
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
this.loadCurrencies();
@ -97,7 +97,7 @@ public class HabboInfo implements Runnable {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -113,14 +113,14 @@ public class HabboInfo implements Runnable {
statement.setInt(4, b);
statement.addBatch();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return true;
}
});
statement.executeBatch();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -135,7 +135,7 @@ public class HabboInfo implements Runnable {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -160,7 +160,7 @@ public class HabboInfo implements Runnable {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -171,7 +171,7 @@ public class HabboInfo implements Runnable {
statement.setInt(1, search.getId());
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -494,7 +494,7 @@ public class HabboInfo implements Runnable {
statement.setInt(13, this.id);
statement.executeUpdate();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}

View File

@ -24,37 +24,37 @@ public class HabboInventory {
try {
this.badgesComponent = new BadgesComponent(this.habbo);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
try {
this.botsComponent = new BotsComponent(this.habbo);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
try {
this.effectsComponent = new EffectsComponent(this.habbo);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
try {
this.itemsComponent = new ItemsComponent(this, this.habbo);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
try {
this.petsComponent = new PetsComponent(this.habbo);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
try {
this.wardrobeComponent = new WardrobeComponent(this.habbo);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
this.items = MarketPlace.getOwnOffers(this.habbo);

View File

@ -107,7 +107,7 @@ public abstract class HabboItem implements Runnable, IEventTriggers {
//serverMessage.appendString( ? "1.0" : ((this.getBaseItem().allowWalk() || this.getBaseItem().allowSit() && this.roomId != 0) ? Item.getCurrentHeight(this) : ""));
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
logger.error("Caught exception", e);
}
}
@ -264,7 +264,7 @@ public abstract class HabboItem implements Runnable, IEventTriggers {
statement.setInt(10, this.id);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
Emulator.getLogging().logErrorLine("SQLException trying to save HabboItem: " + this.toString());
}
@ -272,7 +272,7 @@ public abstract class HabboItem implements Runnable, IEventTriggers {
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}

View File

@ -4,7 +4,6 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.modtool.ModToolBan;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.permissions.Rank;
import com.eu.habbo.habbohotel.users.inventory.EffectsComponent;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.catalog.*;
import com.eu.habbo.messages.outgoing.catalog.marketplace.MarketplaceConfigComposer;
@ -14,6 +13,8 @@ import com.eu.habbo.messages.outgoing.users.UserPerksComposer;
import com.eu.habbo.messages.outgoing.users.UserPermissionsComposer;
import com.eu.habbo.plugin.events.users.UserRankChangedEvent;
import com.eu.habbo.plugin.events.users.UserRegisteredEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.PreparedStatement;
@ -26,6 +27,9 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class HabboManager {
private static final Logger LOGGER = LoggerFactory.getLogger(HabboManager.class);
//Configuration. Loaded from database & updated accordingly.
public static String WELCOME_MESSAGE = "";
public static boolean NAMECHANGE_ENABLED = false;
@ -37,7 +41,7 @@ public class HabboManager {
this.onlineHabbos = new ConcurrentHashMap<>();
Emulator.getLogging().logStart("Habbo Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
LOGGER.info("Habbo Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
public static HabboInfo getOfflineHabboInfo(int id) {
@ -50,7 +54,7 @@ public class HabboManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return info;
@ -68,7 +72,7 @@ public class HabboManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return info;
@ -111,7 +115,7 @@ public class HabboManager {
}
statement.close();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
habbo = this.cloneCheck(userId);
@ -144,15 +148,15 @@ public class HabboManager {
stmt.setInt(2, habbo.getHabboInfo().getId());
stmt.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
} catch (Exception ex) {
Emulator.getLogging().logErrorLine(ex);
LOGGER.error("Caught exception", ex);
}
return habbo;
@ -193,7 +197,7 @@ public class HabboManager {
//
Emulator.getLogging().logShutdownLine("Habbo Manager -> Disposed!");
LOGGER.info("Habbo Manager -> Disposed!");
}
public ArrayList<HabboInfo> getCloneAccounts(Habbo habbo, int limit) {
@ -211,7 +215,7 @@ public class HabboManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return habboInfo;
@ -229,7 +233,7 @@ public class HabboManager {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
return nameChanges;
@ -283,7 +287,7 @@ public class HabboManager {
statement.setInt(2, userId);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
@ -300,7 +304,7 @@ public class HabboManager {
statement.setInt(2, userId);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
LOGGER.error("Caught SQL exception", e);
}
}
}

View File

@ -53,7 +53,7 @@ public class HabboNavigatorWindowSettings {
statement.setString(4, displayMode.name().toLowerCase());
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
this.displayModes.put(category, new HabboNavigatorPersonalDisplayMode(listMode, displayMode));
@ -114,7 +114,7 @@ public class HabboNavigatorWindowSettings {
statement.execute();
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}

View File

@ -228,7 +228,7 @@ public class HabboStats implements Runnable {
statement.setInt(1, habboInfo.getId());
statement.executeUpdate();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return load(habboInfo);
@ -287,7 +287,7 @@ public class HabboStats implements Runnable {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return stats;
@ -365,7 +365,7 @@ public class HabboStats implements Runnable {
this.navigatorWindowSettings.save(connection);
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -479,7 +479,7 @@ public class HabboStats implements Runnable {
statement.setInt(2, roomId);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
this.favoriteRooms.add(roomId);
@ -493,7 +493,7 @@ public class HabboStats implements Runnable {
statement.setInt(2, roomId);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}
@ -519,7 +519,7 @@ public class HabboStats implements Runnable {
statement.setInt(2, id);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
this.secretRecipes.add(id);
@ -605,7 +605,7 @@ public class HabboStats implements Runnable {
statement.setInt(2, userId);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}
@ -620,7 +620,7 @@ public class HabboStats implements Runnable {
statement.setInt(2, userId);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}

View File

@ -38,7 +38,7 @@ public class HabboOfferPurchase {
statement.setInt(2, offerId);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
return null;
}

View File

@ -51,7 +51,7 @@ public class BadgesComponent {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return badgesList;
@ -78,7 +78,7 @@ public class BadgesComponent {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
return badgesList;
}
@ -102,7 +102,7 @@ public class BadgesComponent {
statement.setString(2, badge);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -112,7 +112,7 @@ public class BadgesComponent {
statement.setString(2, badge);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}

View File

@ -32,7 +32,7 @@ public class BotsComponent {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
}

View File

@ -28,7 +28,7 @@ public class EffectsComponent {
}
}
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
if(habbo.getHabboInfo().getRank().getRoomEffect() > 0)
this.createRankEffect(habbo.getHabboInfo().getRank().getRoomEffect());
@ -89,7 +89,7 @@ public class EffectsComponent {
statement.setInt(5, effect.effect);
statement.addBatch();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
return true;
@ -97,7 +97,7 @@ public class EffectsComponent {
statement.executeBatch();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
this.effects.clear();
@ -205,7 +205,7 @@ public class EffectsComponent {
statement.setInt(4, this.duration);
statement.execute();
} catch (SQLException e) {
Emulator.getLogging().logSQLException(e);
logger.error("Caught SQL exception", e);
}
}
@ -215,7 +215,7 @@ public class EffectsComponent {
statement.setInt(2, this.effect);
statement.execute();
} 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