More logging progress

This commit is contained in:
Mike 2020-05-04 22:24:09 +02:00
parent 4748c033ad
commit 89ff26f21b
153 changed files with 987 additions and 448 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -72,6 +72,8 @@ import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import io.netty.util.internal.ConcurrentSet; import io.netty.util.internal.ConcurrentSet;
import org.apache.commons.math3.util.Pair; import org.apache.commons.math3.util.Pair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.awt.*; import java.awt.*;
import java.sql.Connection; import java.sql.Connection;
@ -86,6 +88,9 @@ import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class Room implements Comparable<Room>, ISerialize, Runnable { public class Room implements Comparable<Room>, ISerialize, Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(Room.class);
public static final Comparator SORT_SCORE = (o1, o2) -> { public static final Comparator SORT_SCORE = (o1, o2) -> {
if (!(o1 instanceof Room && o2 instanceof Room)) if (!(o1 instanceof Room && o2 instanceof Room))
@ -265,7 +270,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
this.loadBans(connection); this.loadBans(connection);
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
this.tradeMode = set.getInt("trade_mode"); this.tradeMode = set.getInt("trade_mode");
@ -313,49 +318,49 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try { try {
this.loadLayout(); this.loadLayout();
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
try { try {
this.loadRights(connection); this.loadRights(connection);
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
try { try {
this.loadItems(connection); this.loadItems(connection);
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
try { try {
this.loadHeightmap(); this.loadHeightmap();
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
try { try {
this.loadBots(connection); this.loadBots(connection);
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
try { try {
this.loadPets(connection); this.loadPets(connection);
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
try { try {
this.loadWordFilter(connection); this.loadWordFilter(connection);
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
try { try {
this.loadWiredData(connection); this.loadWiredData(connection);
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
this.idleCycles = 0; this.idleCycles = 0;
@ -363,7 +368,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
this.roomCycleTask = Emulator.getThreading().getService().scheduleAtFixedRate(this, 500, 500, TimeUnit.MILLISECONDS); this.roomCycleTask = Emulator.getThreading().getService().scheduleAtFixedRate(this, 500, 500, TimeUnit.MILLISECONDS);
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
this.traxManager = new TraxManager(this); this.traxManager = new TraxManager(this);
@ -401,7 +406,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
} }
} }
} else { } else {
Emulator.getLogging().logErrorLine("Unknown Room Layout for Room (ID: " + this.id + ")"); LOGGER.error("Unknown Room Layout for Room (ID: {})", this.id);
} }
} }
@ -416,11 +421,11 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
if (this.itemCount() > Room.MAXIMUM_FURNI) { if (this.itemCount() > Room.MAXIMUM_FURNI) {
Emulator.getLogging().logErrorLine("Room ID: " + this.getId() + " has exceeded the furniture limit (" + this.itemCount() + " > " + Room.MAXIMUM_FURNI + ")."); LOGGER.error("Room ID: {} has exceeded the furniture limit ({} > {}).", this.getId(), this.itemCount(), Room.MAXIMUM_FURNI);
} }
} }
@ -438,14 +443,14 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
((InteractionWired) item).loadWiredData(set, this); ((InteractionWired) item).loadWiredData(set, this);
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
} }
@ -481,7 +486,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -511,12 +516,12 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
this.getFurniOwnerNames().put(pet.getUserId(), set.getString("pet_owner_name")); this.getFurniOwnerNames().put(pet.getUserId(), set.getString("pet_owner_name"));
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -531,7 +536,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -921,7 +926,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
botIterator.value().needsUpdate(true); botIterator.value().needsUpdate(true);
Emulator.getThreading().run(botIterator.value()); Emulator.getThreading().run(botIterator.value());
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
break; break;
} }
} }
@ -929,7 +934,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
this.currentBots.clear(); this.currentBots.clear();
this.currentPets.clear(); this.currentPets.clear();
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
} }
@ -941,7 +946,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
this.preLoaded = true; this.preLoaded = true;
this.layout = null; this.layout = null;
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
} }
@ -1033,7 +1038,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
Emulator.getThreading().run( Emulator.getThreading().run(
Room.this::cycle); Room.this::cycle);
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
} }
} }
@ -1096,7 +1101,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.executeUpdate(); statement.executeUpdate();
this.needsUpdate = false; this.needsUpdate = false;
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
@ -1107,7 +1112,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.setInt(2, this.id); statement.setInt(2, this.id);
statement.executeUpdate(); statement.executeUpdate();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -1250,7 +1255,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
break; break;
} }
} }
@ -1263,7 +1268,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try { try {
petIterator.advance(); petIterator.advance();
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
break; break;
} }
@ -1458,7 +1463,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try { try {
item.onWalkOn(unit, room, null); item.onWalkOn(unit, room, null);
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
} }
}, this.getRollerSpeed() == 0 ? 250 : InteractionRoller.DELAY); }, this.getRollerSpeed() == 0 ? 250 : InteractionRoller.DELAY);
@ -2010,7 +2015,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
pet.needsUpdate = true; pet.needsUpdate = true;
pet.run(); pet.run();
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
break; break;
} }
} }
@ -2123,7 +2128,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.setInt(10, this.promotion.getCategory()); statement.setInt(10, this.promotion.getCategory());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
this.needsUpdate = true; this.needsUpdate = true;
@ -2215,7 +2220,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
return this.habboQueue.remove(habbo.getHabboInfo().getId()) != null; return this.habboQueue.remove(habbo.getHabboInfo().getId()) != null;
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
return true; return true;
@ -2288,7 +2293,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
if (habbo != null) { if (habbo != null) {
this.furniOwnerNames.put(item.getUserId(), habbo.getUsername()); this.furniOwnerNames.put(item.getUserId(), habbo.getUsername());
} else { } else {
Emulator.getLogging().logDebugLine("Failed to find username for item (ID:" + item.getId() + ", UserID: " + item.getUserId() + ")"); LOGGER.error("Failed to find username for item (ID: {}, UserID: {})", item.getId(), item.getUserId());
} }
} }
} }
@ -2613,7 +2618,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try { try {
item.onWalkOff(habbo.getRoomUnit(), this, new Object[]{}); item.onWalkOff(habbo.getRoomUnit(), this, new Object[]{});
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
} }
} }
@ -2674,7 +2679,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try { try {
iterator.advance(); iterator.advance();
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
break; break;
} }
@ -2694,7 +2699,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try { try {
iterator.advance(); iterator.advance();
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
break; break;
} }
@ -2716,7 +2721,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try { try {
iterator.advance(); iterator.advance();
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
break; break;
} }
@ -2759,7 +2764,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try { try {
petIterator.advance(); petIterator.advance();
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
break; break;
} }
@ -2838,7 +2843,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try { try {
petIterator.advance(); petIterator.advance();
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
break; break;
} }
@ -2993,7 +2998,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
try { try {
doorTileTopItem.onWalkOn(habbo.getRoomUnit(), this, new Object[]{}); doorTileTopItem.onWalkOn(habbo.getRoomUnit(), this, new Object[]{});
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
} }
} }
@ -3180,7 +3185,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
bot.onUserSay(roomChatMessage); bot.onUserSay(roomChatMessage);
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
break; break;
} }
} }
@ -3204,7 +3209,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
item.onClick(habbo.getClient(), this, new Object[0]); item.onClick(habbo.getClient(), this, new Object[0]);
break; break;
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
} }
} }
@ -3757,7 +3762,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -3776,7 +3781,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -3820,7 +3825,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.setInt(2, userId); statement.setInt(2, userId);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -3857,7 +3862,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.setInt(2, userId); statement.setInt(2, userId);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -3875,7 +3880,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.setInt(1, this.id); statement.setInt(1, this.id);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
this.refreshRightsInRoom(); this.refreshRightsInRoom();
@ -3942,7 +3947,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -4246,7 +4251,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.setString(2, word); statement.setString(2, word);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
return; return;
} }
@ -4263,7 +4268,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
statement.setString(2, word); statement.setString(2, word);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -14,13 +14,17 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
import gnu.trove.map.hash.TIntIntHashMap; import gnu.trove.map.hash.TIntIntHashMap;
import gnu.trove.procedure.TIntIntProcedure; import gnu.trove.procedure.TIntIntProcedure;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.*; import java.sql.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import java.util.List; import java.util.List;
public class HabboInfo implements Runnable { public class HabboInfo implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(HabboInfo.class);
public boolean firstVisit = false; public boolean firstVisit = false;
private String username; private String username;
private String motto; private String motto;
@ -66,8 +70,8 @@ public class HabboInfo implements Runnable {
this.rank = Emulator.getGameEnvironment().getPermissionsManager().getRank(set.getInt("rank")); this.rank = Emulator.getGameEnvironment().getPermissionsManager().getRank(set.getInt("rank"));
if (this.rank == null) { if (this.rank == null) {
Emulator.getLogging().logErrorLine("No existing rank found with id " + set.getInt("rank") + ". Make sure an entry in the permissions table exists."); LOGGER.error("No existing rank found with id " + set.getInt("rank") + ". Make sure an entry in the permissions table exists.");
Emulator.getLogging().logUserLine(this.username + " has an invalid rank with id " + set.getInt("rank") + ". Make sure an entry in the permissions table exists."); LOGGER.warn(this.username + " has an invalid rank with id " + set.getInt("rank") + ". Make sure an entry in the permissions table exists.");
this.rank = Emulator.getGameEnvironment().getPermissionsManager().getRank(1); this.rank = Emulator.getGameEnvironment().getPermissionsManager().getRank(1);
} }
@ -79,7 +83,7 @@ public class HabboInfo implements Runnable {
this.online = false; this.online = false;
this.currentRoom = null; this.currentRoom = null;
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
this.loadCurrencies(); this.loadCurrencies();
@ -97,7 +101,7 @@ public class HabboInfo implements Runnable {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -113,14 +117,14 @@ public class HabboInfo implements Runnable {
statement.setInt(4, b); statement.setInt(4, b);
statement.addBatch(); statement.addBatch();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
return true; return true;
} }
}); });
statement.executeBatch(); statement.executeBatch();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -135,7 +139,7 @@ public class HabboInfo implements Runnable {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -160,7 +164,7 @@ public class HabboInfo implements Runnable {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -171,7 +175,7 @@ public class HabboInfo implements Runnable {
statement.setInt(1, search.getId()); statement.setInt(1, search.getId());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -494,7 +498,7 @@ public class HabboInfo implements Runnable {
statement.setInt(13, this.id); statement.setInt(13, this.id);
statement.executeUpdate(); statement.executeUpdate();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }

View File

@ -1,13 +1,17 @@
package com.eu.habbo.habbohotel.users; package com.eu.habbo.habbohotel.users;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.catalog.marketplace.MarketPlace; import com.eu.habbo.habbohotel.catalog.marketplace.MarketPlace;
import com.eu.habbo.habbohotel.catalog.marketplace.MarketPlaceOffer; import com.eu.habbo.habbohotel.catalog.marketplace.MarketPlaceOffer;
import com.eu.habbo.habbohotel.catalog.marketplace.MarketPlaceState; import com.eu.habbo.habbohotel.catalog.marketplace.MarketPlaceState;
import com.eu.habbo.habbohotel.users.inventory.*; import com.eu.habbo.habbohotel.users.inventory.*;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HabboInventory { public class HabboInventory {
private static final Logger LOGGER = LoggerFactory.getLogger(HabboInventory.class);
//Configuration. Loaded from database & updated accordingly. //Configuration. Loaded from database & updated accordingly.
public static int MAXIMUM_ITEMS = 10000; public static int MAXIMUM_ITEMS = 10000;
private final THashSet<MarketPlaceOffer> items; private final THashSet<MarketPlaceOffer> items;
@ -24,37 +28,37 @@ public class HabboInventory {
try { try {
this.badgesComponent = new BadgesComponent(this.habbo); this.badgesComponent = new BadgesComponent(this.habbo);
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
try { try {
this.botsComponent = new BotsComponent(this.habbo); this.botsComponent = new BotsComponent(this.habbo);
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
try { try {
this.effectsComponent = new EffectsComponent(this.habbo); this.effectsComponent = new EffectsComponent(this.habbo);
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
try { try {
this.itemsComponent = new ItemsComponent(this, this.habbo); this.itemsComponent = new ItemsComponent(this, this.habbo);
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
try { try {
this.petsComponent = new PetsComponent(this.habbo); this.petsComponent = new PetsComponent(this.habbo);
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
try { try {
this.wardrobeComponent = new WardrobeComponent(this.habbo); this.wardrobeComponent = new WardrobeComponent(this.habbo);
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
this.items = MarketPlace.getOwnOffers(this.habbo); this.items = MarketPlace.getOwnOffers(this.habbo);

View File

@ -21,6 +21,8 @@ import com.eu.habbo.messages.outgoing.users.UpdateUserLookComposer;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.math3.util.Pair; import org.apache.commons.math3.util.Pair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.awt.*; import java.awt.*;
import java.sql.Connection; import java.sql.Connection;
@ -29,10 +31,12 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Deque;
import java.util.List; import java.util.List;
public abstract class HabboItem implements Runnable, IEventTriggers { public abstract class HabboItem implements Runnable, IEventTriggers {
private static final Logger LOGGER = LoggerFactory.getLogger(HabboItem.class);
private static Class[] TOGGLING_INTERACTIONS = new Class[]{ private static Class[] TOGGLING_INTERACTIONS = new Class[]{
InteractionGameTimer.class, InteractionGameTimer.class,
InteractionWired.class, InteractionWired.class,
@ -107,7 +111,7 @@ public abstract class HabboItem implements Runnable, IEventTriggers {
//serverMessage.appendString( ? "1.0" : ((this.getBaseItem().allowWalk() || this.getBaseItem().allowSit() && this.roomId != 0) ? Item.getCurrentHeight(this) : "")); //serverMessage.appendString( ? "1.0" : ((this.getBaseItem().allowWalk() || this.getBaseItem().allowSit() && this.roomId != 0) ? Item.getCurrentHeight(this) : ""));
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
} }
@ -264,15 +268,15 @@ public abstract class HabboItem implements Runnable, IEventTriggers {
statement.setInt(10, this.id); statement.setInt(10, this.id);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
Emulator.getLogging().logErrorLine("SQLException trying to save HabboItem: " + this.toString()); LOGGER.error("SQLException trying to save HabboItem: " + this.toString());
} }
this.needsUpdate = false; this.needsUpdate = false;
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }

View File

@ -4,6 +4,8 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.navigation.DisplayMode; import com.eu.habbo.habbohotel.navigation.DisplayMode;
import com.eu.habbo.habbohotel.navigation.ListMode; import com.eu.habbo.habbohotel.navigation.ListMode;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -12,6 +14,7 @@ import java.sql.SQLException;
import java.util.Map; import java.util.Map;
public class HabboNavigatorWindowSettings { public class HabboNavigatorWindowSettings {
private static final Logger LOGGER = LoggerFactory.getLogger(HabboNavigatorWindowSettings.class);
public final THashMap<String, HabboNavigatorPersonalDisplayMode> displayModes = new THashMap<>(2); public final THashMap<String, HabboNavigatorPersonalDisplayMode> displayModes = new THashMap<>(2);
private final int userId; private final int userId;
public int x = 100; public int x = 100;
@ -53,7 +56,7 @@ public class HabboNavigatorWindowSettings {
statement.setString(4, displayMode.name().toLowerCase()); statement.setString(4, displayMode.name().toLowerCase());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
this.displayModes.put(category, new HabboNavigatorPersonalDisplayMode(listMode, displayMode)); this.displayModes.put(category, new HabboNavigatorPersonalDisplayMode(listMode, displayMode));
@ -114,7 +117,7 @@ public class HabboNavigatorWindowSettings {
statement.execute(); statement.execute();
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -13,6 +13,8 @@ import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.stack.array.TIntArrayStack; import gnu.trove.stack.array.TIntArrayStack;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -24,6 +26,9 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class HabboStats implements Runnable { public class HabboStats implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(HabboStats.class);
public final TIntArrayList secretRecipes; public final TIntArrayList secretRecipes;
public final HabboNavigatorWindowSettings navigatorWindowSettings; public final HabboNavigatorWindowSettings navigatorWindowSettings;
public final THashMap<String, Object> cache; public final THashMap<String, Object> cache;
@ -228,7 +233,7 @@ public class HabboStats implements Runnable {
statement.setInt(1, habboInfo.getId()); statement.setInt(1, habboInfo.getId());
statement.executeUpdate(); statement.executeUpdate();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
return load(habboInfo); return load(habboInfo);
@ -287,7 +292,7 @@ public class HabboStats implements Runnable {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
return stats; return stats;
@ -365,7 +370,7 @@ public class HabboStats implements Runnable {
this.navigatorWindowSettings.save(connection); this.navigatorWindowSettings.save(connection);
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -479,7 +484,7 @@ public class HabboStats implements Runnable {
statement.setInt(2, roomId); statement.setInt(2, roomId);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
this.favoriteRooms.add(roomId); this.favoriteRooms.add(roomId);
@ -493,7 +498,7 @@ public class HabboStats implements Runnable {
statement.setInt(2, roomId); statement.setInt(2, roomId);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
@ -519,7 +524,7 @@ public class HabboStats implements Runnable {
statement.setInt(2, id); statement.setInt(2, id);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
this.secretRecipes.add(id); this.secretRecipes.add(id);
@ -605,7 +610,7 @@ public class HabboStats implements Runnable {
statement.setInt(2, userId); statement.setInt(2, userId);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
@ -620,7 +625,7 @@ public class HabboStats implements Runnable {
statement.setInt(2, userId); statement.setInt(2, userId);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -2,6 +2,8 @@ package com.eu.habbo.habbohotel.users.cache;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -9,6 +11,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class HabboOfferPurchase { public class HabboOfferPurchase {
private static final Logger LOGGER = LoggerFactory.getLogger(HabboOfferPurchase.class);
private final int userId; private final int userId;
private final int offerId; private final int offerId;
private int state; private int state;
@ -38,7 +41,7 @@ public class HabboOfferPurchase {
statement.setInt(2, offerId); statement.setInt(2, offerId);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
return null; return null;
} }

View File

@ -5,6 +5,8 @@ import com.eu.habbo.habbohotel.permissions.Rank;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboBadge; import com.eu.habbo.habbohotel.users.HabboBadge;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -15,6 +17,8 @@ import java.util.Comparator;
import java.util.Set; import java.util.Set;
public class BadgesComponent { public class BadgesComponent {
private static final Logger LOGGER = LoggerFactory.getLogger(BadgesComponent.class);
private final THashSet<HabboBadge> badges = new THashSet<>(); private final THashSet<HabboBadge> badges = new THashSet<>();
public BadgesComponent(Habbo habbo) { public BadgesComponent(Habbo habbo) {
@ -51,7 +55,7 @@ public class BadgesComponent {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
return badgesList; return badgesList;
@ -78,7 +82,7 @@ public class BadgesComponent {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
return badgesList; return badgesList;
} }
@ -102,7 +106,7 @@ public class BadgesComponent {
statement.setString(2, badge); statement.setString(2, badge);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -112,7 +116,7 @@ public class BadgesComponent {
statement.setString(2, badge); statement.setString(2, badge);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }

View File

@ -4,6 +4,8 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -12,6 +14,7 @@ import java.sql.SQLException;
import java.util.Map; import java.util.Map;
public class BotsComponent { public class BotsComponent {
private static final Logger LOGGER = LoggerFactory.getLogger(BotsComponent.class);
private final THashMap<Integer, Bot> bots = new THashMap<>(); private final THashMap<Integer, Bot> bots = new THashMap<>();
@ -32,7 +35,7 @@ public class BotsComponent {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -6,7 +6,8 @@ import com.eu.habbo.messages.outgoing.inventory.EffectsListAddComposer;
import com.eu.habbo.messages.outgoing.inventory.EffectsListEffectEnableComposer; import com.eu.habbo.messages.outgoing.inventory.EffectsListEffectEnableComposer;
import com.eu.habbo.messages.outgoing.inventory.EffectsListRemoveComposer; import com.eu.habbo.messages.outgoing.inventory.EffectsListRemoveComposer;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import gnu.trove.procedure.TObjectProcedure; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -14,6 +15,8 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class EffectsComponent { public class EffectsComponent {
private static final Logger LOGGER = LoggerFactory.getLogger(EffectsComponent.class);
public final THashMap<Integer, HabboEffect> effects = new THashMap<>(); public final THashMap<Integer, HabboEffect> effects = new THashMap<>();
public final Habbo habbo; public final Habbo habbo;
public int activatedEffect = 0; public int activatedEffect = 0;
@ -28,7 +31,7 @@ public class EffectsComponent {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
if(habbo.getHabboInfo().getRank().getRoomEffect() > 0) if(habbo.getHabboInfo().getRank().getRoomEffect() > 0)
this.createRankEffect(habbo.getHabboInfo().getRank().getRoomEffect()); this.createRankEffect(habbo.getHabboInfo().getRank().getRoomEffect());
@ -89,7 +92,7 @@ public class EffectsComponent {
statement.setInt(5, effect.effect); statement.setInt(5, effect.effect);
statement.addBatch(); statement.addBatch();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
return true; return true;
@ -97,7 +100,7 @@ public class EffectsComponent {
statement.executeBatch(); statement.executeBatch();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
this.effects.clear(); this.effects.clear();
@ -205,7 +208,7 @@ public class EffectsComponent {
statement.setInt(4, this.duration); statement.setInt(4, this.duration);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -215,7 +218,7 @@ public class EffectsComponent {
statement.setInt(2, this.effect); statement.setInt(2, this.effect);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -15,6 +15,8 @@ import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.procedure.TObjectProcedure; import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -23,6 +25,8 @@ import java.sql.SQLException;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
public class ItemsComponent { public class ItemsComponent {
private static final Logger LOGGER = LoggerFactory.getLogger(ItemsComponent.class);
private final TIntObjectMap<HabboItem> items = TCollections.synchronizedMap(new TIntObjectHashMap<>()); private final TIntObjectMap<HabboItem> items = TCollections.synchronizedMap(new TIntObjectHashMap<>());
private final HabboInventory inventory; private final HabboInventory inventory;
@ -46,15 +50,15 @@ public class ItemsComponent {
if (item != null) { if (item != null) {
itemsList.put(set.getInt("id"), item); itemsList.put(set.getInt("id"), item);
} else { } else {
Emulator.getLogging().logErrorLine("Failed to load HabboItem: " + set.getInt("id")); LOGGER.error("Failed to load HabboItem: " + set.getInt("id"));
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
return itemsList; return itemsList;
@ -150,7 +154,7 @@ public class ItemsComponent {
TIntObjectIterator<HabboItem> items = this.items.iterator(); TIntObjectIterator<HabboItem> items = this.items.iterator();
if (items == null) { if (items == null) {
Emulator.getLogging().logErrorLine(new RuntimeException("Items is NULL!")); LOGGER.error("Items is NULL!");
return; return;
} }

View File

@ -8,6 +8,8 @@ import gnu.trove.TCollections;
import gnu.trove.iterator.TIntObjectIterator; import gnu.trove.iterator.TIntObjectIterator;
import gnu.trove.map.TIntObjectMap; import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.map.hash.TIntObjectHashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -17,6 +19,7 @@ import java.util.NoSuchElementException;
import java.util.Set; import java.util.Set;
public class PetsComponent { public class PetsComponent {
private static final Logger LOGGER = LoggerFactory.getLogger(PetsComponent.class);
private final TIntObjectMap<Pet> pets = TCollections.synchronizedMap(new TIntObjectHashMap<>()); private final TIntObjectMap<Pet> pets = TCollections.synchronizedMap(new TIntObjectHashMap<>());
public PetsComponent(Habbo habbo) { public PetsComponent(Habbo habbo) {
@ -34,7 +37,7 @@ public class PetsComponent {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -7,6 +7,8 @@ import gnu.trove.TIntCollection;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import gnu.trove.set.TIntSet; import gnu.trove.set.TIntSet;
import gnu.trove.set.hash.TIntHashSet; import gnu.trove.set.hash.TIntHashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -14,6 +16,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class WardrobeComponent { public class WardrobeComponent {
private static final Logger LOGGER = LoggerFactory.getLogger(WardrobeComponent.class);
private final THashMap<Integer, WardrobeItem> looks; private final THashMap<Integer, WardrobeItem> looks;
private final TIntSet clothing; private final TIntSet clothing;
@ -42,7 +45,7 @@ public class WardrobeComponent {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -149,7 +152,7 @@ public class WardrobeComponent {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -28,6 +28,8 @@ import com.eu.habbo.plugin.events.furniture.wired.WiredStackExecutedEvent;
import com.eu.habbo.plugin.events.furniture.wired.WiredStackTriggeredEvent; import com.eu.habbo.plugin.events.furniture.wired.WiredStackTriggeredEvent;
import com.eu.habbo.plugin.events.users.UserWiredRewardReceived; import com.eu.habbo.plugin.events.users.UserWiredRewardReceived;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -38,6 +40,8 @@ import java.util.Collections;
import java.util.List; import java.util.List;
public class WiredHandler { public class WiredHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(WiredHandler.class);
//Configuration. Loaded from database & updated accordingly. //Configuration. Loaded from database & updated accordingly.
public static int MAXIMUM_FURNI_SELECTION = 5; public static int MAXIMUM_FURNI_SELECTION = 5;
public static int TELEPORT_DELAY = 500; public static int TELEPORT_DELAY = 500;
@ -199,7 +203,7 @@ public class WiredHandler {
if (!effect.execute(roomUnit, room, stuff)) return; if (!effect.execute(roomUnit, room, stuff)) return;
effect.setCooldown(millis); effect.setCooldown(millis);
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
effect.activateBox(room); effect.activateBox(room);
@ -235,7 +239,7 @@ public class WiredHandler {
statement.setInt(1, wiredId); statement.setInt(1, wiredId);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -250,7 +254,7 @@ public class WiredHandler {
statement.setInt(4, Emulator.getIntUnixTimestamp()); statement.setInt(4, Emulator.getIntUnixTimestamp());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
if (reward.badge) { if (reward.badge) {
@ -404,7 +408,7 @@ public class WiredHandler {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
return false; return false;

View File

@ -3,6 +3,8 @@ package com.eu.habbo.habbohotel.wired.highscores;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.plugin.EventHandler; import com.eu.habbo.plugin.EventHandler;
import com.eu.habbo.plugin.events.emulator.EmulatorLoadedEvent; import com.eu.habbo.plugin.events.emulator.EmulatorLoadedEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -17,6 +19,8 @@ import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
public class WiredHighscoreManager { public class WiredHighscoreManager {
private static final Logger LOGGER = LoggerFactory.getLogger(WiredHighscoreManager.class);
private final HashMap<Integer, List<WiredHighscoreDataEntry>> data = new HashMap<>(); private final HashMap<Integer, List<WiredHighscoreDataEntry>> data = new HashMap<>();
private final static DayOfWeek firstDayOfWeek = WeekFields.of(new Locale(System.getProperty("user.language"), System.getProperty("user.country"))).getFirstDayOfWeek(); private final static DayOfWeek firstDayOfWeek = WeekFields.of(new Locale(System.getProperty("user.language"), System.getProperty("user.country"))).getFirstDayOfWeek();
@ -31,7 +35,7 @@ public class WiredHighscoreManager {
this.data.clear(); this.data.clear();
this.loadHighscoreData(); this.loadHighscoreData();
logger.info("Highscore Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS, " + this.data.size() + " items)"); LOGGER.info("Highscore Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS, " + this.data.size() + " items)");
} }
@EventHandler @EventHandler
@ -65,7 +69,7 @@ public class WiredHighscoreManager {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
@ -85,7 +89,7 @@ public class WiredHighscoreManager {
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }

View File

@ -6,12 +6,16 @@ import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.camera.CameraPublishWaitMessageComposer; import com.eu.habbo.messages.outgoing.camera.CameraPublishWaitMessageComposer;
import com.eu.habbo.messages.outgoing.catalog.NotEnoughPointsTypeComposer; import com.eu.habbo.messages.outgoing.catalog.NotEnoughPointsTypeComposer;
import com.eu.habbo.plugin.events.users.UserPublishPictureEvent; import com.eu.habbo.plugin.events.users.UserPublishPictureEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
public class CameraPublishToWebEvent extends MessageHandler { public class CameraPublishToWebEvent extends MessageHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(CameraPublishToWebEvent.class);
public static int CAMERA_PUBLISH_POINTS = 5; public static int CAMERA_PUBLISH_POINTS = 5;
public static int CAMERA_PUBLISH_POINTS_TYPE = 0; public static int CAMERA_PUBLISH_POINTS_TYPE = 0;
@ -50,7 +54,7 @@ public class CameraPublishToWebEvent extends MessageHandler {
isOk = true; isOk = true;
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -25,6 +25,8 @@ import com.eu.habbo.messages.outgoing.users.UserPointsComposer;
import com.eu.habbo.threading.runnables.ShutdownEmulator; import com.eu.habbo.threading.runnables.ShutdownEmulator;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -33,6 +35,8 @@ import java.sql.SQLException;
import java.util.Calendar; import java.util.Calendar;
public class CatalogBuyItemAsGiftEvent extends MessageHandler { public class CatalogBuyItemAsGiftEvent extends MessageHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(CatalogBuyItemAsGiftEvent.class);
@Override @Override
public void handle() throws Exception { public void handle() throws Exception {
if (Emulator.getIntUnixTimestamp() - this.client.getHabbo().getHabboStats().lastGiftTimestamp >= CatalogManager.PURCHASE_COOLDOWN) { if (Emulator.getIntUnixTimestamp() - this.client.getHabbo().getHabboStats().lastGiftTimestamp >= CatalogManager.PURCHASE_COOLDOWN) {
@ -104,7 +108,7 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} else { } else {
userId = habbo.getHabboInfo().getId(); userId = habbo.getHabboInfo().getId();
@ -287,7 +291,7 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler {
try { try {
guildId = Integer.parseInt(extraData); guildId = Integer.parseInt(extraData);
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
return; return;
} }
@ -359,7 +363,7 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler {
this.client.sendResponse(new PurchaseOKComposer(item)); this.client.sendResponse(new PurchaseOKComposer(item));
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logPacketError(e); LOGGER.error("Exception caught", e);
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
} }
} finally { } finally {

View File

@ -7,8 +7,12 @@ import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.catalog.AlertPurchaseFailedComposer; import com.eu.habbo.messages.outgoing.catalog.AlertPurchaseFailedComposer;
import com.eu.habbo.messages.outgoing.catalog.marketplace.MarketplaceItemPostedComposer; import com.eu.habbo.messages.outgoing.catalog.marketplace.MarketplaceItemPostedComposer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SellItemEvent extends MessageHandler { public class SellItemEvent extends MessageHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(SellItemEvent.class);
@Override @Override
public void handle() throws Exception { public void handle() throws Exception {
if (!MarketPlace.MARKETPLACE_ENABLED) { if (!MarketPlace.MARKETPLACE_ENABLED) {
@ -26,7 +30,7 @@ public class SellItemEvent extends MessageHandler {
if (!item.getBaseItem().allowMarketplace()) { if (!item.getBaseItem().allowMarketplace()) {
String message = Emulator.getTexts().getValue("scripter.warning.marketplace.forbidden").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%itemname%", item.getBaseItem().getName()).replace("%credits%", credits + ""); String message = Emulator.getTexts().getValue("scripter.warning.marketplace.forbidden").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%itemname%", item.getBaseItem().getName()).replace("%credits%", credits + "");
ScripterManager.scripterDetected(this.client, message); ScripterManager.scripterDetected(this.client, message);
Emulator.getLogging().logUserLine(message); LOGGER.info(message);
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
return; return;
} }
@ -34,7 +38,7 @@ public class SellItemEvent extends MessageHandler {
if (credits < 0) { if (credits < 0) {
String message = Emulator.getTexts().getValue("scripter.warning.marketplace.negative").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%itemname%", item.getBaseItem().getName()).replace("%credits%", credits + ""); String message = Emulator.getTexts().getValue("scripter.warning.marketplace.negative").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%itemname%", item.getBaseItem().getName()).replace("%credits%", credits + "");
ScripterManager.scripterDetected(this.client, message); ScripterManager.scripterDetected(this.client, message);
Emulator.getLogging().logUserLine(message); LOGGER.info(message);
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
return; return;
} }

View File

@ -8,6 +8,8 @@ import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.friends.FriendRequestComposer; import com.eu.habbo.messages.outgoing.friends.FriendRequestComposer;
import com.eu.habbo.messages.outgoing.friends.FriendRequestErrorComposer; import com.eu.habbo.messages.outgoing.friends.FriendRequestErrorComposer;
import com.eu.habbo.plugin.events.users.friends.UserRequestFriendshipEvent; import com.eu.habbo.plugin.events.users.friends.UserRequestFriendshipEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -16,6 +18,8 @@ import java.sql.SQLException;
public class FriendRequestEvent extends MessageHandler { public class FriendRequestEvent extends MessageHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(FriendRequestEvent.class);
@Override @Override
public void handle() throws Exception { public void handle() throws Exception {
String username = this.packet.readString(); String username = this.packet.readString();
@ -50,7 +54,7 @@ public class FriendRequestEvent extends MessageHandler {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
return; return;
} }
} else { } else {

View File

@ -4,8 +4,12 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.guides.GuardianTicket; import com.eu.habbo.habbohotel.guides.GuardianTicket;
import com.eu.habbo.habbohotel.guides.GuardianVoteType; import com.eu.habbo.habbohotel.guides.GuardianVoteType;
import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.incoming.MessageHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class GuardianVoteEvent extends MessageHandler { public class GuardianVoteEvent extends MessageHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(GuardianVoteEvent.class);
@Override @Override
public void handle() throws Exception { public void handle() throws Exception {
int voteType = this.packet.readInt(); int voteType = this.packet.readInt();
@ -22,7 +26,7 @@ public class GuardianVoteEvent extends MessageHandler {
} else if (voteType == 2) { } else if (voteType == 2) {
type = GuardianVoteType.AWFULLY; type = GuardianVoteType.AWFULLY;
} else { } else {
Emulator.getLogging().logErrorLine("Uknown vote type: " + voteType); LOGGER.error("Uknown vote type: " + voteType);
} }
ticket.vote(this.client.getHabbo(), type); ticket.vote(this.client.getHabbo(), type);

View File

@ -12,8 +12,12 @@ import com.eu.habbo.messages.outgoing.guilds.GuildBoughtComposer;
import com.eu.habbo.messages.outgoing.guilds.GuildEditFailComposer; import com.eu.habbo.messages.outgoing.guilds.GuildEditFailComposer;
import com.eu.habbo.messages.outgoing.guilds.GuildInfoComposer; import com.eu.habbo.messages.outgoing.guilds.GuildInfoComposer;
import com.eu.habbo.plugin.events.guilds.GuildPurchasedEvent; import com.eu.habbo.plugin.events.guilds.GuildPurchasedEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RequestGuildBuyEvent extends MessageHandler { public class RequestGuildBuyEvent extends MessageHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(RequestGuildBuyEvent.class);
@Override @Override
public void handle() throws Exception { public void handle() throws Exception {
if (!this.client.getHabbo().hasPermission("acc_infinite_credits")) { if (!this.client.getHabbo().hasPermission("acc_infinite_credits")) {
@ -95,7 +99,7 @@ public class RequestGuildBuyEvent extends MessageHandler {
} else { } else {
String message = Emulator.getTexts().getValue("scripter.warning.guild.buy.owner").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%roomname%", r.getName().replace("%owner%", r.getOwnerName())); String message = Emulator.getTexts().getValue("scripter.warning.guild.buy.owner").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%roomname%", r.getName().replace("%owner%", r.getOwnerName()));
ScripterManager.scripterDetected(this.client, message); ScripterManager.scripterDetected(this.client, message);
Emulator.getLogging().logUserLine(message); LOGGER.info(message);
} }
} }
} }

View File

@ -6,6 +6,8 @@ import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.guilds.forums.GuildForumListComposer; import com.eu.habbo.messages.outgoing.guilds.forums.GuildForumListComposer;
import com.eu.habbo.messages.outgoing.handshake.ConnectionErrorComposer; import com.eu.habbo.messages.outgoing.handshake.ConnectionErrorComposer;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -14,6 +16,8 @@ import java.sql.SQLException;
import java.util.Set; import java.util.Set;
public class GuildForumListEvent extends MessageHandler { public class GuildForumListEvent extends MessageHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(GuildForumListEvent.class);
@Override @Override
public void handle() throws Exception { public void handle() throws Exception {
int mode = this.packet.readInt(); int mode = this.packet.readInt();
@ -60,7 +64,7 @@ public class GuildForumListEvent extends MessageHandler {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
this.client.sendResponse(new ConnectionErrorComposer(500)); this.client.sendResponse(new ConnectionErrorComposer(500));
} }
@ -84,7 +88,7 @@ public class GuildForumListEvent extends MessageHandler {
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
this.client.sendResponse(new ConnectionErrorComposer(500)); this.client.sendResponse(new ConnectionErrorComposer(500));
} }

View File

@ -33,12 +33,16 @@ import com.eu.habbo.messages.outgoing.users.*;
import com.eu.habbo.plugin.events.emulator.SSOAuthenticationEvent; import com.eu.habbo.plugin.events.emulator.SSOAuthenticationEvent;
import com.eu.habbo.plugin.events.users.UserLoginEvent; import com.eu.habbo.plugin.events.users.UserLoginEvent;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
@NoAuthMessage @NoAuthMessage
public class SecureLoginEvent extends MessageHandler { public class SecureLoginEvent extends MessageHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(SecureLoginEvent.class);
@Override @Override
@ -97,7 +101,7 @@ public class SecureLoginEvent extends MessageHandler {
Emulator.getThreading().run(habbo); Emulator.getThreading().run(habbo);
Emulator.getGameEnvironment().getHabboManager().addHabbo(habbo); Emulator.getGameEnvironment().getHabboManager().addHabbo(habbo);
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
Emulator.getGameServer().getGameClientManager().disposeClient(this.client); Emulator.getGameServer().getGameClientManager().disposeClient(this.client);
return; return;
} }

View File

@ -1,10 +1,13 @@
package com.eu.habbo.messages.incoming.hotelview; package com.eu.habbo.messages.incoming.hotelview;
import com.eu.habbo.Emulator;
import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.hotelview.HotelViewDataComposer; import com.eu.habbo.messages.outgoing.hotelview.HotelViewDataComposer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HotelViewDataEvent extends MessageHandler { public class HotelViewDataEvent extends MessageHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(HotelViewDataEvent.class);
@Override @Override
public void handle() { public void handle() {
@ -30,7 +33,7 @@ public class HotelViewDataEvent extends MessageHandler {
this.client.sendResponse(new HotelViewDataComposer(data, data.split(",")[data.split(",").length - 1])); this.client.sendResponse(new HotelViewDataComposer(data, data.split(",")[data.split(",").length - 1]));
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
} }
} }

View File

@ -1,16 +1,19 @@
package com.eu.habbo.messages.incoming.inventory; package com.eu.habbo.messages.incoming.inventory;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.inventory.InventoryItemsComposer; import com.eu.habbo.messages.outgoing.inventory.InventoryItemsComposer;
import gnu.trove.iterator.TIntObjectIterator; import gnu.trove.iterator.TIntObjectIterator;
import gnu.trove.map.TIntObjectMap; import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.map.hash.TIntObjectHashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
public class RequestInventoryItemsEvent extends MessageHandler { public class RequestInventoryItemsEvent extends MessageHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(RequestInventoryItemsEvent.class);
@Override @Override
public void handle() throws Exception { public void handle() throws Exception {
int totalItems = this.client.getHabbo().getInventory().getItemsComponent().getItems().size(); int totalItems = this.client.getHabbo().getInventory().getItemsComponent().getItems().size();
@ -35,7 +38,7 @@ public class RequestInventoryItemsEvent extends MessageHandler {
items.put(iterator.key(), iterator.value()); items.put(iterator.key(), iterator.value());
count++; count++;
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
break; break;
} }

View File

@ -7,8 +7,12 @@ import com.eu.habbo.habbohotel.rooms.RoomManager;
import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.navigator.CanCreateRoomComposer; import com.eu.habbo.messages.outgoing.navigator.CanCreateRoomComposer;
import com.eu.habbo.messages.outgoing.navigator.RoomCreatedComposer; import com.eu.habbo.messages.outgoing.navigator.RoomCreatedComposer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RequestCreateRoomEvent extends MessageHandler { public class RequestCreateRoomEvent extends MessageHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(RequestCreateRoomEvent.class);
@Override @Override
public void handle() throws Exception { public void handle() throws Exception {
@ -20,14 +24,14 @@ public class RequestCreateRoomEvent extends MessageHandler {
int tradeType = this.packet.readInt(); int tradeType = this.packet.readInt();
if (!Emulator.getGameEnvironment().getRoomManager().layoutExists(modelName)) { if (!Emulator.getGameEnvironment().getRoomManager().layoutExists(modelName)) {
Emulator.getLogging().logErrorLine("[SCRIPTER] Incorrect layout name \"" + modelName + "\". " + this.client.getHabbo().getHabboInfo().getUsername()); LOGGER.error("[SCRIPTER] Incorrect layout name \"" + modelName + "\". " + this.client.getHabbo().getHabboInfo().getUsername());
return; return;
} }
RoomCategory category = Emulator.getGameEnvironment().getRoomManager().getCategory(categoryId); RoomCategory category = Emulator.getGameEnvironment().getRoomManager().getCategory(categoryId);
if (category == null || category.getMinRank() > this.client.getHabbo().getHabboInfo().getRank().getId()) { if (category == null || category.getMinRank() > this.client.getHabbo().getHabboInfo().getRank().getId()) {
Emulator.getLogging().logErrorLine("[SCRIPTER] Incorrect rank or non existing category ID: \"" + categoryId + "\"." + this.client.getHabbo().getHabboInfo().getUsername()); LOGGER.error("[SCRIPTER] Incorrect rank or non existing category ID: \"" + categoryId + "\"." + this.client.getHabbo().getHabboInfo().getUsername());
return; return;
} }

View File

@ -6,12 +6,16 @@ import com.eu.habbo.habbohotel.modtool.ScripterManager;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.plugin.events.navigator.NavigatorRoomDeletedEvent; import com.eu.habbo.plugin.events.navigator.NavigatorRoomDeletedEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
public class RequestDeleteRoomEvent extends MessageHandler { public class RequestDeleteRoomEvent extends MessageHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(RequestDeleteRoomEvent.class);
@Override @Override
public void handle() throws Exception { public void handle() throws Exception {
int roomId = this.packet.readInt(); int roomId = this.packet.readInt();
@ -69,12 +73,12 @@ public class RequestDeleteRoomEvent extends MessageHandler {
filter.execute(); filter.execute();
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} else { } else {
String message = Emulator.getTexts().getValue("scripter.warning.room.delete").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%roomname%", room.getName()).replace("%roomowner%", room.getOwnerName()); String message = Emulator.getTexts().getValue("scripter.warning.room.delete").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%roomname%", room.getName()).replace("%roomowner%", room.getOwnerName());
ScripterManager.scripterDetected(this.client, message); ScripterManager.scripterDetected(this.client, message);
Emulator.getLogging().logUserLine(message); LOGGER.info(message);
} }
} }
} }

View File

@ -8,10 +8,14 @@ import com.eu.habbo.habbohotel.rooms.RoomCategory;
import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.navigator.NewNavigatorSearchResultsComposer; import com.eu.habbo.messages.outgoing.navigator.NewNavigatorSearchResultsComposer;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*; import java.util.*;
public class RequestNewNavigatorRoomsEvent extends MessageHandler { public class RequestNewNavigatorRoomsEvent extends MessageHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(RequestNewNavigatorRoomsEvent.class);
@Override @Override
public void handle() throws Exception { public void handle() throws Exception {
String view = this.packet.readString(); String view = this.packet.readString();
@ -89,7 +93,7 @@ public class RequestNewNavigatorRoomsEvent extends MessageHandler {
resultLists = toQueryResults(resultLists); resultLists = toQueryResults(resultLists);
this.client.sendResponse(new NewNavigatorSearchResultsComposer(view, query, resultLists)); this.client.sendResponse(new NewNavigatorSearchResultsComposer(view, query, resultLists));
} catch (Exception e) { } catch (Exception e) {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
/* /*
@ -104,7 +108,7 @@ public class RequestNewNavigatorRoomsEvent extends MessageHandler {
} }
catch (Exception e) catch (Exception e)
{ {
logger.error("Caught exception", e); LOGGER.error("Caught exception", e);
} }
*/ */
} }

View File

@ -6,12 +6,16 @@ import com.eu.habbo.habbohotel.users.HabboBadge;
import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.users.AddUserBadgeComposer; import com.eu.habbo.messages.outgoing.users.AddUserBadgeComposer;
import com.eu.habbo.messages.outgoing.wired.WiredRewardAlertComposer; import com.eu.habbo.messages.outgoing.wired.WiredRewardAlertComposer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
public class AnswerPollEvent extends MessageHandler { public class AnswerPollEvent extends MessageHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(AnswerPollEvent.class);
@Override @Override
public void handle() throws Exception { public void handle() throws Exception {
int pollId = this.packet.readInt(); int pollId = this.packet.readInt();
@ -40,7 +44,7 @@ public class AnswerPollEvent extends MessageHandler {
statement.setString(4, answer.toString()); statement.setString(4, answer.toString());
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
if (poll.lastQuestionId == questionId) { if (poll.lastQuestionId == questionId) {

View File

@ -3,12 +3,16 @@ package com.eu.habbo.messages.incoming.polls;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.polls.Poll; import com.eu.habbo.habbohotel.polls.Poll;
import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.incoming.MessageHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
public class CancelPollEvent extends MessageHandler { public class CancelPollEvent extends MessageHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(CancelPollEvent.class);
@Override @Override
public void handle() throws Exception { public void handle() throws Exception {
int pollId = this.packet.readInt(); int pollId = this.packet.readInt();
@ -24,7 +28,7 @@ public class CancelPollEvent extends MessageHandler {
statement.setString(4, ""); statement.setString(4, "");
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
} }
} }

View File

@ -7,8 +7,12 @@ import com.eu.habbo.habbohotel.rooms.RoomCategory;
import com.eu.habbo.habbohotel.rooms.RoomState; import com.eu.habbo.habbohotel.rooms.RoomState;
import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.rooms.*; import com.eu.habbo.messages.outgoing.rooms.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RoomSettingsSaveEvent extends MessageHandler { public class RoomSettingsSaveEvent extends MessageHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(RoomSettingsSaveEvent.class);
@Override @Override
public void handle() throws Exception { public void handle() throws Exception {
int roomId = this.packet.readInt(); int roomId = this.packet.readInt();
@ -93,7 +97,7 @@ public class RoomSettingsSaveEvent extends MessageHandler {
} }
ScripterManager.scripterDetected(this.client, message); ScripterManager.scripterDetected(this.client, message);
Emulator.getLogging().logUserLine(message); LOGGER.info(message);
} }

View File

@ -12,12 +12,16 @@ import com.eu.habbo.messages.outgoing.rooms.UpdateStackHeightComposer;
import com.eu.habbo.messages.outgoing.rooms.items.RemoveFloorItemComposer; import com.eu.habbo.messages.outgoing.rooms.items.RemoveFloorItemComposer;
import com.eu.habbo.messages.outgoing.users.UserClothesComposer; import com.eu.habbo.messages.outgoing.users.UserClothesComposer;
import com.eu.habbo.threading.runnables.QueryDeleteHabboItem; import com.eu.habbo.threading.runnables.QueryDeleteHabboItem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
public class RedeemClothingEvent extends MessageHandler { public class RedeemClothingEvent extends MessageHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(RedeemClothingEvent.class);
@Override @Override
public void handle() throws Exception { public void handle() throws Exception {
int itemId = this.packet.readInt(); int itemId = this.packet.readInt();
@ -45,7 +49,7 @@ public class RedeemClothingEvent extends MessageHandler {
statement.setInt(2, clothing.id); statement.setInt(2, clothing.id);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {
logger.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
} }
this.client.getHabbo().getInventory().getWardrobeComponent().getClothing().add(clothing.id); this.client.getHabbo().getInventory().getWardrobeComponent().getClothing().add(clothing.id);
@ -56,7 +60,7 @@ public class RedeemClothingEvent extends MessageHandler {
this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FIGURESET_OWNED_ALREADY.key)); this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FIGURESET_OWNED_ALREADY.key));
} }
} else { } else {
Emulator.getLogging().logErrorLine("[Catalog] No definition in catalog_clothing found for clothing name " + item.getBaseItem().getName() + ". Could not redeem clothing!"); LOGGER.error("[Catalog] No definition in catalog_clothing found for clothing name " + item.getBaseItem().getName() + ". Could not redeem clothing!");
} }
} }
} }

View File

@ -11,8 +11,12 @@ import com.eu.habbo.messages.outgoing.users.UserCreditsComposer;
import com.eu.habbo.messages.outgoing.users.UserCurrencyComposer; import com.eu.habbo.messages.outgoing.users.UserCurrencyComposer;
import com.eu.habbo.plugin.events.furniture.FurnitureRedeemedEvent; import com.eu.habbo.plugin.events.furniture.FurnitureRedeemedEvent;
import com.eu.habbo.threading.runnables.QueryDeleteHabboItem; import com.eu.habbo.threading.runnables.QueryDeleteHabboItem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RedeemItemEvent extends MessageHandler { public class RedeemItemEvent extends MessageHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(RedeemItemEvent.class);
@Override @Override
public void handle() throws Exception { public void handle() throws Exception {
int itemId = this.packet.readInt(); int itemId = this.packet.readInt();
@ -32,7 +36,7 @@ public class RedeemItemEvent extends MessageHandler {
try { try {
credits = Integer.valueOf(item.getBaseItem().getName().split("_")[1]); credits = Integer.valueOf(item.getBaseItem().getName().split("_")[1]);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine("Failed to parse redeemable furniture: " + item.getBaseItem().getName() + ". Must be in format of CF_<amount>"); LOGGER.error("Failed to parse redeemable furniture: " + item.getBaseItem().getName() + ". Must be in format of CF_<amount>");
return; return;
} }
@ -43,7 +47,7 @@ public class RedeemItemEvent extends MessageHandler {
try { try {
pixels = Integer.valueOf(item.getBaseItem().getName().split("_")[1]); pixels = Integer.valueOf(item.getBaseItem().getName().split("_")[1]);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine("Failed to parse redeemable pixel furniture: " + item.getBaseItem().getName() + ". Must be in format of PF_<amount>"); LOGGER.error("Failed to parse redeemable pixel furniture: " + item.getBaseItem().getName() + ". Must be in format of PF_<amount>");
return; return;
} }
@ -55,14 +59,14 @@ public class RedeemItemEvent extends MessageHandler {
try { try {
pointsType = Integer.valueOf(item.getBaseItem().getName().split("_")[1]); pointsType = Integer.valueOf(item.getBaseItem().getName().split("_")[1]);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine("Failed to parse redeemable points furniture: " + item.getBaseItem().getName() + ". Must be in format of DF_<pointstype>_<amount> where <pointstype> equals integer representation of seasonal currency."); LOGGER.error("Failed to parse redeemable points furniture: " + item.getBaseItem().getName() + ". Must be in format of DF_<pointstype>_<amount> where <pointstype> equals integer representation of seasonal currency.");
return; return;
} }
try { try {
points = Integer.valueOf(item.getBaseItem().getName().split("_")[2]); points = Integer.valueOf(item.getBaseItem().getName().split("_")[2]);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine("Failed to parse redeemable points furniture: " + item.getBaseItem().getName() + ". Must be in format of DF_<pointstype>_<amount> where <pointstype> equals integer representation of seasonal currency."); LOGGER.error("Failed to parse redeemable points furniture: " + item.getBaseItem().getName() + ". Must be in format of DF_<pointstype>_<amount> where <pointstype> equals integer representation of seasonal currency.");
return; return;
} }
@ -73,7 +77,7 @@ public class RedeemItemEvent extends MessageHandler {
try { try {
points = Integer.valueOf(item.getBaseItem().getName().split("_")[2]); points = Integer.valueOf(item.getBaseItem().getName().split("_")[2]);
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine("Failed to parse redeemable diamonds furniture: " + item.getBaseItem().getName() + ". Must be in format of CF_diamond_<amount>"); LOGGER.error("Failed to parse redeemable diamonds furniture: " + item.getBaseItem().getName() + ". Must be in format of CF_diamond_<amount>");
return; return;
} }

View File

@ -7,10 +7,14 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionPostIt;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.incoming.MessageHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.time.LocalDate; import java.time.LocalDate;
public class SavePostItStickyPoleEvent extends MessageHandler { public class SavePostItStickyPoleEvent extends MessageHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(SavePostItStickyPoleEvent.class);
@Override @Override
public void handle() throws Exception { public void handle() throws Exception {
int itemId = this.packet.readInt(); int itemId = this.packet.readInt();
@ -26,7 +30,7 @@ public class SavePostItStickyPoleEvent extends MessageHandler {
CommandHandler.handleCommand(this.client, command); CommandHandler.handleCommand(this.client, command);
} }
} else { } else {
Emulator.getLogging().logUserLine("Scripter Alert! " + this.client.getHabbo().getHabboInfo().getUsername() + " | " + this.packet.readString()); LOGGER.info("Scripter Alert! " + this.client.getHabbo().getHabboInfo().getUsername() + " | " + this.packet.readString());
} }
} else { } else {
String text = this.packet.readString(); String text = this.packet.readString();

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