From 4be2f0a8baa87d79f496802a2788e0c92d2f8c8c Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Fri, 3 Apr 2020 16:38:23 +0100 Subject: [PATCH 001/215] Fix Room Blocking. Thanks #TheJava for helping. --- src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java index 03a4a382..55fee2f7 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java @@ -300,7 +300,6 @@ public class RoomLayout { double height = currentAdj.getStackHeight() - current.getStackHeight(); if (!ALLOW_FALLING && height < -MAXIMUM_STEP_HEIGHT) continue; if (currentAdj.state == RoomTileState.OPEN && height > MAXIMUM_STEP_HEIGHT) continue; - if (currentAdj.hasUnits() && ((!isWalktroughRetry && !this.room.isAllowWalkthrough()) || currentAdj.equals(goalLocation))) { closedList.add(currentAdj); openList.remove(currentAdj); @@ -320,7 +319,7 @@ public class RoomLayout { } if (!this.room.isAllowWalkthrough() && !isWalktroughRetry) { - return this.findPath(oldTile, newTile, goalLocation, roomUnit, true); + return this.findPath(oldTile, newTile, goalLocation, roomUnit, false); } return null; From 357f735d5a3b91bca82d9d22ba4252cfd28f177b Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Fri, 3 Apr 2020 16:40:48 +0100 Subject: [PATCH 002/215] Start 2.4.0 rc-1 --- src/main/java/com/eu/habbo/Emulator.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/eu/habbo/Emulator.java b/src/main/java/com/eu/habbo/Emulator.java index d2323757..c6b60f6d 100644 --- a/src/main/java/com/eu/habbo/Emulator.java +++ b/src/main/java/com/eu/habbo/Emulator.java @@ -31,18 +31,18 @@ public final class Emulator { public final static int MAJOR = 2; - public final static int MINOR = 3; - public final static int BUILD = 1; + public final static int MINOR = 4; + public final static int BUILD = 0; public static final String ANSI_RED = "\u001B[31m"; public static final String ANSI_BLUE = "\u001B[34m"; public static final String ANSI_PURPLE = "\u001B[35m"; public static final String ANSI_WHITE = "\u001B[37m"; public static final String ANSI_YELLOW = "\u001B[33m"; +// This Build of 2.4.0 will not be released anytime soon. :) + public final static String PREVIEW = "RC-1"; - public final static String PREVIEW = "RC-3"; - - public static final String version = "Arcturus Morningstar" + " " + MAJOR + "." + MINOR + "." + BUILD; + public static final String version = "Arcturus Morningstar" + " " + MAJOR + "." + MINOR + "." + BUILD + "-" + PREVIEW; private static final String logo = "\n" + "███╗ ███╗ ██████╗ ██████╗ ███╗ ██╗██╗███╗ ██╗ ██████╗ ███████╗████████╗ █████╗ ██████╗ \n" + From 1ea86cb5285ee9440f1bcad7ab8fbabde640f99c Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Fri, 3 Apr 2020 16:58:02 +0100 Subject: [PATCH 003/215] Changes to RoomLayout, makes more sense. --- src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java index 55fee2f7..2ffe4bbd 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java @@ -318,8 +318,8 @@ public class RoomLayout { } } - if (!this.room.isAllowWalkthrough() && !isWalktroughRetry) { - return this.findPath(oldTile, newTile, goalLocation, roomUnit, false); + if (this.room.isAllowWalkthrough() && isWalktroughRetry) { + return this.findPath(oldTile, newTile, goalLocation, roomUnit, true); } return null; From 629a2d2abe5cd5b62f4fee158601ed9932aaca4d Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Tue, 7 Apr 2020 13:43:59 +0100 Subject: [PATCH 004/215] Removed Custom Wired. See Custom Wired Plugin to re-add these. --- .../habbo/habbohotel/items/ItemManager.java | 32 ---- .../WiredConditionBattleBanzaiGameActive.java | 74 -------- .../WiredConditionFreezeGameActive.java | 74 -------- .../WiredConditionHabboHasCredits.java | 30 ---- .../WiredConditionHabboHasDiamonds.java | 30 ---- .../WiredConditionHabboHasDuckets.java | 30 ---- .../WiredConditionHabboHasRank.java | 40 ----- .../WiredConditionHabboIsDancing.java | 30 ---- .../WiredConditionHabboNotRank.java | 40 ----- .../WiredConditionHabboOwnsBadge.java | 30 ---- .../WiredConditionMottoContains.java | 84 --------- ...redConditionNotBattleBanzaiGameActive.java | 74 -------- .../WiredConditionNotFreezeGameActive.java | 74 -------- .../WiredConditionNotHabboHasCredits.java | 30 ---- .../WiredConditionNotHabboHasDiamonds.java | 30 ---- .../WiredConditionNotHabboHasDuckets.java | 29 ---- .../WiredConditionNotHabboIsDancing.java | 30 ---- .../WiredConditionNotHabboOwnsBadge.java | 30 ---- .../effects/WiredEffectForwardToRoom.java | 41 ----- .../effects/WiredEffectGiveAchievement.java | 164 ------------------ .../wired/effects/WiredEffectGiveBadge.java | 132 -------------- .../wired/effects/WiredEffectGiveCredits.java | 131 -------------- .../effects/WiredEffectGiveDiamonds.java | 147 ---------------- .../wired/effects/WiredEffectGiveDuckets.java | 133 -------------- .../effects/WiredEffectMatchFurniStaff.java | 18 -- .../effects/WiredEffectOpenHabboPages.java | 31 ---- .../wired/effects/WiredEffectRollerSpeed.java | 118 ------------- .../wired/triggers/WiredTriggerHabboIdle.java | 76 -------- .../WiredTriggerHabboSaysCommand.java | 116 ------------- .../WiredTriggerHabboStartsDancing.java | 29 ---- .../WiredTriggerHabboStopsDancing.java | 29 ---- .../triggers/WiredTriggerHabboUnidle.java | 76 -------- 32 files changed, 2032 deletions(-) delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionBattleBanzaiGameActive.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFreezeGameActive.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasCredits.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasDiamonds.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasDuckets.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasRank.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboIsDancing.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboNotRank.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboOwnsBadge.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMottoContains.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotBattleBanzaiGameActive.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFreezeGameActive.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasCredits.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasDiamonds.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasDuckets.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboIsDancing.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboOwnsBadge.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectForwardToRoom.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveAchievement.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveBadge.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveCredits.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveDiamonds.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveDuckets.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurniStaff.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectOpenHabboPages.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectRollerSpeed.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboIdle.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboSaysCommand.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboStartsDancing.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboStopsDancing.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboUnidle.java diff --git a/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java b/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java index dbfea5f1..85c15810 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java @@ -197,12 +197,7 @@ public class ItemManager { this.interactionsList.add(new ItemInteraction("wf_trg_game_ends", WiredTriggerGameEnds.class)); this.interactionsList.add(new ItemInteraction("wf_trg_bot_reached_stf", WiredTriggerBotReachedFurni.class)); this.interactionsList.add(new ItemInteraction("wf_trg_bot_reached_avtr", WiredTriggerBotReachedHabbo.class)); - this.interactionsList.add(new ItemInteraction("wf_trg_says_command", WiredTriggerHabboSaysCommand.class)); this.interactionsList.add(new ItemInteraction("wf_trg_score_achieved", WiredTriggerScoreAchieved.class)); - this.interactionsList.add(new ItemInteraction("wf_trg_idles", WiredTriggerHabboIdle.class)); - this.interactionsList.add(new ItemInteraction("wf_trg_unidles", WiredTriggerHabboUnidle.class)); - this.interactionsList.add(new ItemInteraction("wf_trg_starts_dancing", WiredTriggerHabboStartsDancing.class)); - this.interactionsList.add(new ItemInteraction("wf_trg_stops_dancing", WiredTriggerHabboStopsDancing.class)); this.interactionsList.add(new ItemInteraction("wf_trg_game_team_win", WiredTriggerTeamWins.class)); this.interactionsList.add(new ItemInteraction("wf_trg_game_team_lose", WiredTriggerTeamLoses.class)); @@ -233,22 +228,12 @@ public class ItemManager { this.interactionsList.add(new ItemInteraction("wf_act_bot_follow_avatar", WiredEffectBotFollowHabbo.class)); this.interactionsList.add(new ItemInteraction("wf_act_bot_clothes", WiredEffectBotClothes.class)); this.interactionsList.add(new ItemInteraction("wf_act_bot_talk_to_avatar", WiredEffectBotTalkToHabbo.class)); - this.interactionsList.add(new ItemInteraction("wf_act_give_diamonds", WiredEffectGiveDiamonds.class)); - this.interactionsList.add(new ItemInteraction("wf_act_give_credits", WiredEffectGiveCredits.class)); - this.interactionsList.add(new ItemInteraction("wf_act_give_duckets", WiredEffectGiveDuckets.class)); - this.interactionsList.add(new ItemInteraction("wf_act_give_badge", WiredEffectGiveBadge.class)); - this.interactionsList.add(new ItemInteraction("wf_act_forward_user", WiredEffectForwardToRoom.class)); - this.interactionsList.add(new ItemInteraction("wf_act_roller_speed", WiredEffectRollerSpeed.class)); this.interactionsList.add(new ItemInteraction("wf_act_raise_furni", WiredEffectRaiseFurni.class)); this.interactionsList.add(new ItemInteraction("wf_act_lower_furni", WiredEffectLowerFurni.class)); this.interactionsList.add(new ItemInteraction("wf_act_give_respect", WiredEffectGiveRespect.class)); this.interactionsList.add(new ItemInteraction("wf_act_alert", WiredEffectAlert.class)); this.interactionsList.add(new ItemInteraction("wf_act_give_handitem", WiredEffectGiveHandItem.class)); - this.interactionsList.add(new ItemInteraction("wf_act_match_to_sshot2", WiredEffectMatchFurniStaff.class)); this.interactionsList.add(new ItemInteraction("wf_act_give_effect", WiredEffectGiveEffect.class)); - this.interactionsList.add(new ItemInteraction("wf_act_open_habbo_pages", WiredEffectOpenHabboPages.class)); - this.interactionsList.add(new ItemInteraction("wf_act_give_achievement", WiredEffectGiveAchievement.class)); - this.interactionsList.add(new ItemInteraction("wf_cnd_has_furni_on", WiredConditionFurniHaveFurni.class)); this.interactionsList.add(new ItemInteraction("wf_cnd_furnis_hv_avtrs", WiredConditionFurniHaveHabbo.class)); @@ -274,23 +259,6 @@ public class ItemManager { this.interactionsList.add(new ItemInteraction("wf_cnd_trggrer_on_frn", WiredConditionTriggerOnFurni.class)); this.interactionsList.add(new ItemInteraction("wf_cnd_has_handitem", WiredConditionHabboHasHandItem.class)); this.interactionsList.add(new ItemInteraction("wf_cnd_date_rng_active", WiredConditionDateRangeActive.class)); - this.interactionsList.add(new ItemInteraction("wf_cnd_motto_contains", WiredConditionMottoContains.class)); - this.interactionsList.add(new ItemInteraction("wf_cnd_battlebanzai", WiredConditionBattleBanzaiGameActive.class)); - this.interactionsList.add(new ItemInteraction("wf_cnd_not_battlebanzai", WiredConditionNotBattleBanzaiGameActive.class)); - this.interactionsList.add(new ItemInteraction("wf_cnd_freeze", WiredConditionFreezeGameActive.class)); - this.interactionsList.add(new ItemInteraction("wf_cnd_not_freeze", WiredConditionNotFreezeGameActive.class)); - this.interactionsList.add(new ItemInteraction("wf_cnd_habbo_has_rank", WiredConditionHabboHasRank.class)); - this.interactionsList.add(new ItemInteraction("wf_cnd_habbo_not_rank", WiredConditionHabboNotRank.class)); - this.interactionsList.add(new ItemInteraction("wf_cnd_habbo_has_diamonds", WiredConditionHabboHasDiamonds.class)); - this.interactionsList.add(new ItemInteraction("wf_cnd_habbo_has_credits", WiredConditionHabboHasCredits.class)); - this.interactionsList.add(new ItemInteraction("wf_cnd_habbo_has_duckets", WiredConditionHabboHasDuckets.class)); - this.interactionsList.add(new ItemInteraction("wf_cnd_not_habbo_has_diamonds", WiredConditionNotHabboHasDiamonds.class)); - this.interactionsList.add(new ItemInteraction("wf_cnd_not_habbo_has_credits", WiredConditionNotHabboHasCredits.class)); - this.interactionsList.add(new ItemInteraction("wf_cnd_not_habbo_has_duckets", WiredConditionNotHabboHasDuckets.class)); - this.interactionsList.add(new ItemInteraction("wf_cnd_habbo_owns_badge", WiredConditionHabboOwnsBadge.class)); - this.interactionsList.add(new ItemInteraction("wf_cnd_not_habbo_owns_badge", WiredConditionNotHabboOwnsBadge.class)); - this.interactionsList.add(new ItemInteraction("wf_cnd_habbo_is_dancing", WiredConditionHabboIsDancing.class)); - this.interactionsList.add(new ItemInteraction("wf_cnd_not_habbo_is_dancing", WiredConditionNotHabboIsDancing.class)); this.interactionsList.add(new ItemInteraction("wf_xtra_random", WiredExtraRandom.class)); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionBattleBanzaiGameActive.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionBattleBanzaiGameActive.java deleted file mode 100644 index f65b7dfc..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionBattleBanzaiGameActive.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.conditions; - -import com.eu.habbo.habbohotel.games.Game; -import com.eu.habbo.habbohotel.games.GameState; -import com.eu.habbo.habbohotel.games.battlebanzai.BattleBanzaiGame; -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.wired.WiredConditionType; -import com.eu.habbo.messages.ClientMessage; -import com.eu.habbo.messages.ServerMessage; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredConditionBattleBanzaiGameActive extends InteractionWiredCondition { - public static final WiredConditionType type = WiredConditionType.ACTOR_IN_GROUP; - - public WiredConditionBattleBanzaiGameActive(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredConditionBattleBanzaiGameActive(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public WiredConditionType getType() { - return type; - } - - @Override - public void serializeWiredData(ServerMessage message, Room room) { - message.appendBoolean(false); - message.appendInt(5); - message.appendInt(0); - message.appendInt(this.getBaseItem().getSpriteId()); - message.appendInt(this.getId()); - message.appendString(""); - message.appendInt(0); - message.appendInt(0); - message.appendInt(this.getType().code); - message.appendInt(0); - message.appendInt(0); - } - - @Override - public boolean saveData(ClientMessage packet) { - return true; - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Game game = room.getGame(BattleBanzaiGame.class); - - return game != null && game.state.equals(GameState.RUNNING); - } - - @Override - public String getWiredData() { - return ""; - } - - @Override - public void loadWiredData(ResultSet set, Room room) throws SQLException { - - } - - @Override - public void onPickUp() { - - } -} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFreezeGameActive.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFreezeGameActive.java deleted file mode 100644 index 62009610..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFreezeGameActive.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.conditions; - -import com.eu.habbo.habbohotel.games.Game; -import com.eu.habbo.habbohotel.games.GameState; -import com.eu.habbo.habbohotel.games.freeze.FreezeGame; -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.wired.WiredConditionType; -import com.eu.habbo.messages.ClientMessage; -import com.eu.habbo.messages.ServerMessage; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredConditionFreezeGameActive extends InteractionWiredCondition { - public static final WiredConditionType type = WiredConditionType.ACTOR_IN_GROUP; - - public WiredConditionFreezeGameActive(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredConditionFreezeGameActive(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public WiredConditionType getType() { - return type; - } - - @Override - public void serializeWiredData(ServerMessage message, Room room) { - message.appendBoolean(false); - message.appendInt(5); - message.appendInt(0); - message.appendInt(this.getBaseItem().getSpriteId()); - message.appendInt(this.getId()); - message.appendString(""); - message.appendInt(0); - message.appendInt(0); - message.appendInt(this.getType().code); - message.appendInt(0); - message.appendInt(0); - } - - @Override - public boolean saveData(ClientMessage packet) { - return true; - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Game game = room.getGame(FreezeGame.class); - - return game != null && game.state.equals(GameState.RUNNING); - } - - @Override - public String getWiredData() { - return ""; - } - - @Override - public void loadWiredData(ResultSet set, Room room) throws SQLException { - - } - - @Override - public void onPickUp() { - - } -} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasCredits.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasCredits.java deleted file mode 100644 index 78e52e31..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasCredits.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.conditions; - -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredConditionHabboHasCredits extends WiredConditionHabboHasEffect { - public WiredConditionHabboHasCredits(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredConditionHabboHasCredits(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Habbo habbo = room.getHabbo(roomUnit); - - if (habbo != null) { - return habbo.getHabboInfo().getCredits() >= this.effectId; - } - - return false; - } -} diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasDiamonds.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasDiamonds.java deleted file mode 100644 index 41103b76..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasDiamonds.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.conditions; - -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredConditionHabboHasDiamonds extends WiredConditionHabboHasEffect { - public WiredConditionHabboHasDiamonds(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredConditionHabboHasDiamonds(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Habbo habbo = room.getHabbo(roomUnit); - - if (habbo != null) { - return habbo.getHabboInfo().getCurrencyAmount(5) >= this.effectId; - } - - return false; - } -} diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasDuckets.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasDuckets.java deleted file mode 100644 index f6f7b66f..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasDuckets.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.conditions; - -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredConditionHabboHasDuckets extends WiredConditionHabboHasEffect { - public WiredConditionHabboHasDuckets(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredConditionHabboHasDuckets(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Habbo habbo = room.getHabbo(roomUnit); - - if (habbo != null) { - return habbo.getHabboInfo().getPixels() >= this.effectId; - } - - return false; - } -} diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasRank.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasRank.java deleted file mode 100644 index ecf2bc01..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasRank.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.conditions; - -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.habbohotel.wired.WiredConditionOperator; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredConditionHabboHasRank extends WiredConditionHabboWearsBadge { - public WiredConditionHabboHasRank(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredConditionHabboHasRank(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Habbo habbo = room.getHabbo(roomUnit); - - if (habbo != null) { - try { - return habbo.getHabboInfo().getRank().getId() == Integer.valueOf(this.badge); - } catch (Exception e) { - return false; - } - } - - return false; - } - - @Override - public WiredConditionOperator operator() { - return WiredConditionOperator.OR; - } -} diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboIsDancing.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboIsDancing.java deleted file mode 100644 index 0c706e6e..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboIsDancing.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.conditions; - -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.DanceType; -import com.eu.habbo.habbohotel.wired.WiredConditionOperator; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredConditionHabboIsDancing extends WiredConditionGroupMember { - public WiredConditionHabboIsDancing(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredConditionHabboIsDancing(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - return roomUnit != null && roomUnit.getDanceType() != DanceType.NONE; - } - - @Override - public WiredConditionOperator operator() { - return WiredConditionOperator.OR; - } -} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboNotRank.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboNotRank.java deleted file mode 100644 index 8364e356..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboNotRank.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.conditions; - -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.habbohotel.wired.WiredConditionOperator; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredConditionHabboNotRank extends WiredConditionHabboWearsBadge { - public WiredConditionHabboNotRank(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredConditionHabboNotRank(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Habbo habbo = room.getHabbo(roomUnit); - - if (habbo != null) { - try { - return habbo.getHabboInfo().getRank().getId() != Integer.valueOf(this.badge); - } catch (Exception e) { - return false; - } - } - - return false; - } - - @Override - public WiredConditionOperator operator() { - return WiredConditionOperator.OR; - } -} diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboOwnsBadge.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboOwnsBadge.java deleted file mode 100644 index bd7e192a..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboOwnsBadge.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.conditions; - -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredConditionHabboOwnsBadge extends WiredConditionHabboWearsBadge { - public WiredConditionHabboOwnsBadge(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredConditionHabboOwnsBadge(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Habbo habbo = room.getHabbo(roomUnit); - - if (habbo != null) { - return habbo.getInventory().getBadgesComponent().hasBadge(this.badge); - } - - return false; - } -} diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMottoContains.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMottoContains.java deleted file mode 100644 index 26bd7e9e..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMottoContains.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.conditions; - -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.habbohotel.wired.WiredConditionOperator; -import com.eu.habbo.habbohotel.wired.WiredConditionType; -import com.eu.habbo.messages.ClientMessage; -import com.eu.habbo.messages.ServerMessage; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredConditionMottoContains extends InteractionWiredCondition { - public static final WiredConditionType type = WiredConditionType.ACTOR_WEARS_BADGE; - - private String motto = ""; - - public WiredConditionMottoContains(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredConditionMottoContains(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Habbo habbo = room.getHabbo(roomUnit); - - return habbo != null && habbo.getHabboInfo().getMotto().contains(this.motto); - } - - @Override - public String getWiredData() { - return this.motto; - } - - @Override - public void loadWiredData(ResultSet set, Room room) throws SQLException { - this.motto = set.getString("wired_data"); - } - - @Override - public void onPickUp() { - this.motto = ""; - } - - @Override - public WiredConditionType getType() { - return type; - } - - @Override - public void serializeWiredData(ServerMessage message, Room room) { - message.appendBoolean(false); - message.appendInt(5); - message.appendInt(0); - message.appendInt(this.getBaseItem().getSpriteId()); - message.appendInt(this.getId()); - message.appendString(this.motto); - message.appendInt(0); - message.appendInt(0); - message.appendInt(this.getType().code); - message.appendInt(0); - message.appendInt(0); - } - - @Override - public boolean saveData(ClientMessage packet) { - packet.readInt(); - - this.motto = packet.readString(); - - return true; - } - - @Override - public WiredConditionOperator operator() { - return WiredConditionOperator.OR; - } -} diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotBattleBanzaiGameActive.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotBattleBanzaiGameActive.java deleted file mode 100644 index 06e1c102..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotBattleBanzaiGameActive.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.conditions; - -import com.eu.habbo.habbohotel.games.Game; -import com.eu.habbo.habbohotel.games.GameState; -import com.eu.habbo.habbohotel.games.battlebanzai.BattleBanzaiGame; -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.wired.WiredConditionType; -import com.eu.habbo.messages.ClientMessage; -import com.eu.habbo.messages.ServerMessage; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredConditionNotBattleBanzaiGameActive extends InteractionWiredCondition { - public static final WiredConditionType type = WiredConditionType.NOT_ACTOR_IN_GROUP; - - public WiredConditionNotBattleBanzaiGameActive(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredConditionNotBattleBanzaiGameActive(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public WiredConditionType getType() { - return type; - } - - @Override - public void serializeWiredData(ServerMessage message, Room room) { - message.appendBoolean(false); - message.appendInt(5); - message.appendInt(0); - message.appendInt(this.getBaseItem().getSpriteId()); - message.appendInt(this.getId()); - message.appendString(""); - message.appendInt(0); - message.appendInt(0); - message.appendInt(this.getType().code); - message.appendInt(0); - message.appendInt(0); - } - - @Override - public boolean saveData(ClientMessage packet) { - return true; - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Game game = room.getGame(BattleBanzaiGame.class); - - return game == null || !game.state.equals(GameState.RUNNING); - } - - @Override - public String getWiredData() { - return ""; - } - - @Override - public void loadWiredData(ResultSet set, Room room) throws SQLException { - - } - - @Override - public void onPickUp() { - - } -} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFreezeGameActive.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFreezeGameActive.java deleted file mode 100644 index 043a5dbd..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFreezeGameActive.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.conditions; - -import com.eu.habbo.habbohotel.games.Game; -import com.eu.habbo.habbohotel.games.GameState; -import com.eu.habbo.habbohotel.games.freeze.FreezeGame; -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.wired.WiredConditionType; -import com.eu.habbo.messages.ClientMessage; -import com.eu.habbo.messages.ServerMessage; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredConditionNotFreezeGameActive extends InteractionWiredCondition { - public static final WiredConditionType type = WiredConditionType.NOT_ACTOR_IN_GROUP; - - public WiredConditionNotFreezeGameActive(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredConditionNotFreezeGameActive(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public WiredConditionType getType() { - return type; - } - - @Override - public void serializeWiredData(ServerMessage message, Room room) { - message.appendBoolean(false); - message.appendInt(5); - message.appendInt(0); - message.appendInt(this.getBaseItem().getSpriteId()); - message.appendInt(this.getId()); - message.appendString(""); - message.appendInt(0); - message.appendInt(0); - message.appendInt(this.getType().code); - message.appendInt(0); - message.appendInt(0); - } - - @Override - public boolean saveData(ClientMessage packet) { - return true; - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Game game = room.getGame(FreezeGame.class); - - return game == null || !game.state.equals(GameState.RUNNING); - } - - @Override - public String getWiredData() { - return ""; - } - - @Override - public void loadWiredData(ResultSet set, Room room) throws SQLException { - - } - - @Override - public void onPickUp() { - - } -} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasCredits.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasCredits.java deleted file mode 100644 index 6c322788..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasCredits.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.conditions; - -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredConditionNotHabboHasCredits extends WiredConditionNotHabboHasEffect { - public WiredConditionNotHabboHasCredits(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredConditionNotHabboHasCredits(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Habbo habbo = room.getHabbo(roomUnit); - - if (habbo != null) { - return habbo.getHabboInfo().getCredits() < this.effectId; - } - - return false; - } -} diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasDiamonds.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasDiamonds.java deleted file mode 100644 index ea96650f..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasDiamonds.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.conditions; - -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredConditionNotHabboHasDiamonds extends WiredConditionNotHabboHasEffect { - public WiredConditionNotHabboHasDiamonds(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredConditionNotHabboHasDiamonds(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Habbo habbo = room.getHabbo(roomUnit); - - if (habbo != null) { - return habbo.getHabboInfo().getCurrencyAmount(5) < this.effectId; - } - - return false; - } -} diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasDuckets.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasDuckets.java deleted file mode 100644 index 98e55738..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasDuckets.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.conditions; - -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredConditionNotHabboHasDuckets extends WiredConditionNotHabboHasEffect { - public WiredConditionNotHabboHasDuckets(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredConditionNotHabboHasDuckets(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Habbo habbo = room.getHabbo(roomUnit); - - if (habbo != null) { - return habbo.getHabboInfo().getPixels() < this.effectId; - } - return false; - } -} diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboIsDancing.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboIsDancing.java deleted file mode 100644 index 81f1d7f2..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboIsDancing.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.conditions; - -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.DanceType; -import com.eu.habbo.habbohotel.wired.WiredConditionOperator; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredConditionNotHabboIsDancing extends WiredConditionGroupMember { - public WiredConditionNotHabboIsDancing(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredConditionNotHabboIsDancing(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - return roomUnit != null && roomUnit.getDanceType() == DanceType.NONE; - } - - @Override - public WiredConditionOperator operator() { - return WiredConditionOperator.OR; - } -} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboOwnsBadge.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboOwnsBadge.java deleted file mode 100644 index 91cb8d81..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboOwnsBadge.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.conditions; - -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredConditionNotHabboOwnsBadge extends WiredConditionNotHabboWearsBadge { - public WiredConditionNotHabboOwnsBadge(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredConditionNotHabboOwnsBadge(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Habbo habbo = room.getHabbo(roomUnit); - - if (habbo != null) { - return !habbo.getInventory().getBadgesComponent().hasBadge(this.badge); - } - - return false; - } -} diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectForwardToRoom.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectForwardToRoom.java deleted file mode 100644 index a1c216e3..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectForwardToRoom.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.effects; - -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.messages.outgoing.rooms.ForwardToRoomComposer; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredEffectForwardToRoom extends WiredEffectWhisper { - public WiredEffectForwardToRoom(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredEffectForwardToRoom(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Habbo habbo = room.getHabbo(roomUnit); - - if (habbo == null) - return false; - - int roomId; - - try { - roomId = Integer.valueOf(this.message); - } catch (Exception e) { - return false; - } - - if (roomId > 0) - habbo.getClient().sendResponse(new ForwardToRoomComposer(roomId)); - - return true; - } -} diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveAchievement.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveAchievement.java deleted file mode 100644 index 1a45f426..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveAchievement.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.effects; - -import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.achievements.Achievement; -import com.eu.habbo.habbohotel.achievements.AchievementManager; -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.habbohotel.wired.WiredEffectType; -import com.eu.habbo.messages.ClientMessage; -import com.eu.habbo.messages.ServerMessage; -import gnu.trove.procedure.TObjectProcedure; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -public class WiredEffectGiveAchievement extends WiredEffectGiveBadge { - public static final WiredEffectType type = WiredEffectType.SHOW_MESSAGE; - - public static final String DEFAULT_CONTENT = "ach_achievement:points <- Points are optional"; - private String achievement = DEFAULT_CONTENT; - - public WiredEffectGiveAchievement(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredEffectGiveAchievement(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public void serializeWiredData(ServerMessage message, Room room) { - message.appendBoolean(true); - message.appendInt(0); - message.appendInt(0); - message.appendInt(this.getBaseItem().getSpriteId()); - message.appendInt(this.getId()); - message.appendString(this.achievement + ""); - message.appendInt(0); - message.appendInt(0); - message.appendInt(type.code); - message.appendInt(this.getDelay()); - - if (this.requiresTriggeringUser()) { - List invalidTriggers = new ArrayList<>(); - room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure() { - @Override - public boolean execute(InteractionWiredTrigger object) { - if (!object.isTriggeredByRoomUnit()) { - invalidTriggers.add(object.getBaseItem().getSpriteId()); - } - return true; - } - }); - message.appendInt(invalidTriggers.size()); - for (Integer i : invalidTriggers) { - message.appendInt(i); - } - } else { - message.appendInt(0); - } - } - - @Override - public boolean saveData(ClientMessage packet, GameClient gameClient) { - packet.readInt(); - - try { - this.achievement = packet.readString(); - - int points = 1; - String a = achievement; - if (a.contains(":")) { - a = achievement.split(":")[0]; - try { - points = Integer.valueOf(achievement.split(":")[1]); - } catch (Exception e) { - gameClient.getHabbo().whisper(Emulator.getTexts().getValue("hotel.wired.giveachievement.invalid.points"), RoomChatMessageBubbles.WIRED); - } - } - - Achievement ach = Emulator.getGameEnvironment().getAchievementManager().getAchievement(a); - - if (ach == null) { - gameClient.getHabbo().whisper(Emulator.getTexts().getValue("hotel.wired.giveachievement.invalid.achievement").replace("%achievement%", a), RoomChatMessageBubbles.WIRED); - } - } catch (Exception e) { - e.printStackTrace(); - return false; - } - - packet.readInt(); - this.setDelay(packet.readInt()); - - return true; - } - - @Override - public WiredEffectType getType() { - return type; - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - if (!this.achievement.equals(DEFAULT_CONTENT)) { - Habbo habbo = room.getHabbo(roomUnit); - - if (habbo != null) { - int points = 1; - String a = achievement; - if (a.contains(":")) { - a = achievement.split(":")[0]; - try { - points = Integer.valueOf(achievement.split(":")[1]); - } catch (Exception e) { - return false; - } - } - - Achievement ach = Emulator.getGameEnvironment().getAchievementManager().getAchievement(a); - - if (ach != null) { - AchievementManager.progressAchievement(habbo, ach, points); - } - } - } - return true; - } - - @Override - public String getWiredData() { - return this.getDelay() + "\t" + this.achievement; - } - - @Override - public void loadWiredData(ResultSet set, Room room) throws SQLException { - String wireData = set.getString("wired_data"); - String[] data = wireData.split("\t"); - this.achievement = DEFAULT_CONTENT; - - if (data.length >= 2) { - super.setDelay(Integer.valueOf(data[0])); - - this.achievement = data[1]; - } - } - - @Override - public void onPickUp() { - this.achievement = DEFAULT_CONTENT; - this.setDelay(0); - } - - @Override - public boolean requiresTriggeringUser() { - return true; - } -} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveBadge.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveBadge.java deleted file mode 100644 index 1f071383..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveBadge.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.effects; - -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; -import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.habbohotel.users.inventory.BadgesComponent; -import com.eu.habbo.habbohotel.wired.WiredEffectType; -import com.eu.habbo.messages.ClientMessage; -import com.eu.habbo.messages.ServerMessage; -import com.eu.habbo.messages.outgoing.wired.WiredRewardAlertComposer; -import gnu.trove.procedure.TObjectProcedure; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -public class WiredEffectGiveBadge extends InteractionWiredEffect { - public static final WiredEffectType type = WiredEffectType.SHOW_MESSAGE; - - private String badge = ""; - - public WiredEffectGiveBadge(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredEffectGiveBadge(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public void serializeWiredData(ServerMessage message, Room room) { - message.appendBoolean(false); - message.appendInt(0); - message.appendInt(0); - message.appendInt(this.getBaseItem().getSpriteId()); - message.appendInt(this.getId()); - message.appendString(this.badge); - message.appendInt(0); - message.appendInt(0); - message.appendInt(type.code); - message.appendInt(this.getDelay()); - - if (this.requiresTriggeringUser()) { - List invalidTriggers = new ArrayList<>(); - room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure() { - @Override - public boolean execute(InteractionWiredTrigger object) { - if (!object.isTriggeredByRoomUnit()) { - invalidTriggers.add(object.getBaseItem().getSpriteId()); - } - return true; - } - }); - message.appendInt(invalidTriggers.size()); - for (Integer i : invalidTriggers) { - message.appendInt(i); - } - } else { - message.appendInt(0); - } - } - - @Override - public boolean saveData(ClientMessage packet, GameClient gameClient) { - packet.readInt(); - - this.badge = packet.readString(); - - packet.readInt(); - this.setDelay(packet.readInt()); - - return true; - } - - @Override - public WiredEffectType getType() { - return type; - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Habbo habbo = room.getHabbo(roomUnit); - - if (habbo == null) - return false; - - if (this.badge.isEmpty()) - return false; - - if (habbo.getInventory().getBadgesComponent().hasBadge(this.badge)) { - habbo.getClient().sendResponse(new WiredRewardAlertComposer(WiredRewardAlertComposer.REWARD_ALREADY_RECEIVED)); - } else { - BadgesComponent.createBadge(this.badge, habbo); - habbo.getClient().sendResponse(new WiredRewardAlertComposer(WiredRewardAlertComposer.REWARD_RECEIVED_BADGE)); - } - - return true; - } - - @Override - public String getWiredData() { - return this.getDelay() + "\t" + this.badge; - } - - @Override - public void loadWiredData(ResultSet set, Room room) throws SQLException { - String wireData = set.getString("wired_data"); - String[] data = wireData.split("\t"); - - if (data.length >= 2) { - super.setDelay(Integer.valueOf(data[0])); - this.badge = data[1]; - } - } - - @Override - public void onPickUp() { - this.badge = ""; - this.setDelay(0); - } - - @Override - public boolean requiresTriggeringUser() { - return true; - } -} - diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveCredits.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveCredits.java deleted file mode 100644 index d072d671..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveCredits.java +++ /dev/null @@ -1,131 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.effects; - -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; -import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.habbohotel.wired.WiredEffectType; -import com.eu.habbo.messages.ClientMessage; -import com.eu.habbo.messages.ServerMessage; -import gnu.trove.procedure.TObjectProcedure; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -public class WiredEffectGiveCredits extends InteractionWiredEffect { - public static final WiredEffectType type = WiredEffectType.SHOW_MESSAGE; - - private int credits = 0; - - public WiredEffectGiveCredits(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredEffectGiveCredits(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public void serializeWiredData(ServerMessage message, Room room) { - message.appendBoolean(true); - message.appendInt(0); - message.appendInt(0); - message.appendInt(this.getBaseItem().getSpriteId()); - message.appendInt(this.getId()); - message.appendString(this.credits + ""); - message.appendInt(0); - message.appendInt(0); - message.appendInt(type.code); - message.appendInt(this.getDelay()); - - if (this.requiresTriggeringUser()) { - List invalidTriggers = new ArrayList<>(); - room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure() { - @Override - public boolean execute(InteractionWiredTrigger object) { - if (!object.isTriggeredByRoomUnit()) { - invalidTriggers.add(object.getBaseItem().getSpriteId()); - } - return true; - } - }); - message.appendInt(invalidTriggers.size()); - for (Integer i : invalidTriggers) { - message.appendInt(i); - } - } else { - message.appendInt(0); - } - } - - @Override - public boolean saveData(ClientMessage packet, GameClient gameClient) { - packet.readInt(); - - try { - this.credits = Integer.valueOf(packet.readString()); - } catch (Exception e) { - return false; - } - - packet.readInt(); - this.setDelay(packet.readInt()); - - return false; - } - - @Override - public WiredEffectType getType() { - return type; - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Habbo habbo = room.getHabbo(roomUnit); - - if (habbo == null) - return false; - - habbo.giveCredits(this.credits); - - return true; - } - - @Override - public String getWiredData() { - return this.getDelay() + "\t" + this.credits; - } - - @Override - public void loadWiredData(ResultSet set, Room room) throws SQLException { - String wireData = set.getString("wired_data"); - String[] data = wireData.split("\t"); - this.credits = 0; - - if (data.length >= 2) { - super.setDelay(Integer.valueOf(data[0])); - - try { - this.credits = Integer.valueOf(data[1]); - } catch (Exception e) { - } - } - } - - @Override - public void onPickUp() { - this.credits = 0; - this.setDelay(0); - } - - @Override - public boolean requiresTriggeringUser() { - return true; - } -} - diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveDiamonds.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveDiamonds.java deleted file mode 100644 index dc15d8ac..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveDiamonds.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.effects; - -import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; -import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.habbohotel.wired.WiredEffectType; -import com.eu.habbo.messages.ClientMessage; -import com.eu.habbo.messages.ServerMessage; -import com.eu.habbo.messages.outgoing.users.UserPointsComposer; -import gnu.trove.procedure.TObjectProcedure; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -public class WiredEffectGiveDiamonds extends InteractionWiredEffect { - public static final WiredEffectType type = WiredEffectType.SHOW_MESSAGE; - - private int points = 0; - private int pointsType = -1; - - public WiredEffectGiveDiamonds(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredEffectGiveDiamonds(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public void serializeWiredData(ServerMessage message, Room room) { - message.appendBoolean(false); - message.appendInt(0); - message.appendInt(0); - message.appendInt(this.getBaseItem().getSpriteId()); - message.appendInt(this.getId()); - message.appendString(this.points + (this.pointsType == -1 ? "" : ":" + this.pointsType)); - message.appendInt(0); - message.appendInt(0); - message.appendInt(type.code); - message.appendInt(this.getDelay()); - - if (this.requiresTriggeringUser()) { - List invalidTriggers = new ArrayList<>(); - room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure() { - @Override - public boolean execute(InteractionWiredTrigger object) { - if (!object.isTriggeredByRoomUnit()) { - invalidTriggers.add(object.getBaseItem().getSpriteId()); - } - return true; - } - }); - message.appendInt(invalidTriggers.size()); - for (Integer i : invalidTriggers) { - message.appendInt(i); - } - } else { - message.appendInt(0); - } - } - - @Override - public boolean saveData(ClientMessage packet, GameClient gameClient) { - packet.readInt(); - - try { - this.loadFromString(packet.readString()); - } catch (Exception e) { - return false; - } - - packet.readInt(); - this.setDelay(packet.readInt()); - - return true; - } - - @Override - public WiredEffectType getType() { - return type; - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Habbo habbo = room.getHabbo(roomUnit); - - if (habbo == null) - return false; - - habbo.getHabboInfo().addCurrencyAmount(this.pointsType == -1 ? Emulator.getConfig().getInt("seasonal.primary.type") : this.pointsType, this.points); - habbo.getClient().sendResponse(new UserPointsComposer(habbo.getHabboInfo().getCurrencyAmount(this.pointsType == -1 ? Emulator.getConfig().getInt("seasonal.primary.type") : this.pointsType), this.points, Emulator.getConfig().getInt("seasonal.primary.type"))); - - return true; - } - - @Override - public String getWiredData() { - return this.getDelay() + "\t" + this.points + (this.pointsType == -1 ? "" : ":" + this.pointsType); - } - - @Override - public void loadWiredData(ResultSet set, Room room) throws SQLException { - String wireData = set.getString("wired_data"); - String[] data = wireData.split("\t"); - this.points = 0; - - if (data.length >= 2) { - super.setDelay(Integer.valueOf(data[0])); - - try { - this.loadFromString(data[1]); - } catch (Exception e) { - } - } - } - - @Override - public void onPickUp() { - this.points = 0; - this.setDelay(0); - } - - private void loadFromString(String data) { - String[] pointsData = data.split(":"); - - this.pointsType = -1; - if (pointsData.length >= 1) { - this.points = Integer.valueOf(pointsData[0]); - } - - if (pointsData.length == 2) { - this.pointsType = Integer.valueOf(pointsData[1]); - } - } - - @Override - public boolean requiresTriggeringUser() { - return true; - } -} diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveDuckets.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveDuckets.java deleted file mode 100644 index 21d82d19..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveDuckets.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.effects; - -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; -import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.habbohotel.wired.WiredEffectType; -import com.eu.habbo.messages.ClientMessage; -import com.eu.habbo.messages.ServerMessage; -import com.eu.habbo.messages.outgoing.users.UserPointsComposer; -import gnu.trove.procedure.TObjectProcedure; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -public class WiredEffectGiveDuckets extends InteractionWiredEffect { - public static final WiredEffectType type = WiredEffectType.SHOW_MESSAGE; - - private int pixels = 0; - - public WiredEffectGiveDuckets(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredEffectGiveDuckets(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public void serializeWiredData(ServerMessage message, Room room) { - message.appendBoolean(false); - message.appendInt(0); - message.appendInt(0); - message.appendInt(this.getBaseItem().getSpriteId()); - message.appendInt(this.getId()); - message.appendString(this.pixels + ""); - message.appendInt(0); - message.appendInt(0); - message.appendInt(type.code); - message.appendInt(this.getDelay()); - - if (this.requiresTriggeringUser()) { - List invalidTriggers = new ArrayList<>(); - room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure() { - @Override - public boolean execute(InteractionWiredTrigger object) { - if (!object.isTriggeredByRoomUnit()) { - invalidTriggers.add(object.getBaseItem().getSpriteId()); - } - return true; - } - }); - message.appendInt(invalidTriggers.size()); - for (Integer i : invalidTriggers) { - message.appendInt(i); - } - } else { - message.appendInt(0); - } - } - - @Override - public boolean saveData(ClientMessage packet, GameClient gameClient) { - packet.readInt(); - - try { - this.pixels = Integer.valueOf(packet.readString()); - } catch (Exception e) { - return false; - } - - packet.readInt(); - this.setDelay(packet.readInt()); - - return true; - } - - @Override - public WiredEffectType getType() { - return type; - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Habbo habbo = room.getHabbo(roomUnit); - - if (habbo == null) - return false; - - habbo.getHabboInfo().addCurrencyAmount(0, this.pixels); - habbo.getClient().sendResponse(new UserPointsComposer(habbo.getHabboInfo().getCurrencyAmount(0), this.pixels, 0)); - - return true; - } - - @Override - public String getWiredData() { - return this.getDelay() + "\t" + this.pixels; - } - - @Override - public void loadWiredData(ResultSet set, Room room) throws SQLException { - String wireData = set.getString("wired_data"); - String[] data = wireData.split("\t"); - this.pixels = 0; - - if (data.length >= 2) { - super.setDelay(Integer.valueOf(data[0])); - - try { - this.pixels = Integer.valueOf(data[1]); - } catch (Exception e) { - } - } - } - - @Override - public void onPickUp() { - this.pixels = 0; - this.setDelay(0); - } - - @Override - public boolean requiresTriggeringUser() { - return true; - } -} - diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurniStaff.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurniStaff.java deleted file mode 100644 index 495c15fe..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurniStaff.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.effects; - -import com.eu.habbo.habbohotel.items.Item; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredEffectMatchFurniStaff extends WiredEffectMatchFurni { - public WiredEffectMatchFurniStaff(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - this.checkForWiredResetPermission = false; - } - - public WiredEffectMatchFurniStaff(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - this.checkForWiredResetPermission = false; - } -} diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectOpenHabboPages.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectOpenHabboPages.java deleted file mode 100644 index fe399daa..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectOpenHabboPages.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.effects; - -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.messages.outgoing.habboway.nux.NuxAlertComposer; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredEffectOpenHabboPages extends WiredEffectWhisper { - public WiredEffectOpenHabboPages(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredEffectOpenHabboPages(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Habbo habbo = room.getHabbo(roomUnit); - - if (habbo != null) { - habbo.getClient().sendResponse(new NuxAlertComposer(this.message)); - } - - return true; - } -} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectRollerSpeed.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectRollerSpeed.java deleted file mode 100644 index fd089c22..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectRollerSpeed.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.effects; - -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; -import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.wired.WiredEffectType; -import com.eu.habbo.messages.ClientMessage; -import com.eu.habbo.messages.ServerMessage; -import gnu.trove.procedure.TObjectProcedure; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -public class WiredEffectRollerSpeed extends InteractionWiredEffect { - public static final WiredEffectType type = WiredEffectType.SHOW_MESSAGE; - - private int speed = 4; - - public WiredEffectRollerSpeed(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredEffectRollerSpeed(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public void serializeWiredData(ServerMessage message, Room room) { - message.appendBoolean(false); - message.appendInt(0); - message.appendInt(0); - message.appendInt(this.getBaseItem().getSpriteId()); - message.appendInt(this.getId()); - message.appendString(this.speed + ""); - message.appendInt(0); - message.appendInt(0); - message.appendInt(type.code); - message.appendInt(this.getDelay()); - - if (this.requiresTriggeringUser()) { - List invalidTriggers = new ArrayList<>(); - room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure() { - @Override - public boolean execute(InteractionWiredTrigger object) { - if (!object.isTriggeredByRoomUnit()) { - invalidTriggers.add(object.getBaseItem().getSpriteId()); - } - return true; - } - }); - message.appendInt(invalidTriggers.size()); - for (Integer i : invalidTriggers) { - message.appendInt(i); - } - } else { - message.appendInt(0); - } - } - - @Override - public boolean saveData(ClientMessage packet, GameClient gameClient) { - packet.readInt(); - - try { - this.speed = Integer.valueOf(packet.readString()); - } catch (Exception e) { - return false; - } - packet.readInt(); - this.setDelay(packet.readInt()); - - return true; - } - - @Override - public WiredEffectType getType() { - return type; - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - room.setRollerSpeed(this.speed); - - return true; - } - - @Override - public String getWiredData() { - return this.getDelay() + "\t" + this.speed; - } - - @Override - public void loadWiredData(ResultSet set, Room room) throws SQLException { - String wireData = set.getString("wired_data"); - String[] data = wireData.split("\t"); - this.speed = 0; - - if (data.length >= 2) { - super.setDelay(Integer.valueOf(data[0])); - - try { - this.speed = Integer.valueOf(data[1]); - } catch (Exception e) { - } - } - } - - @Override - public void onPickUp() { - this.speed = 4; - this.setDelay(0); - } -} diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboIdle.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboIdle.java deleted file mode 100644 index e1e96145..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboIdle.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.triggers; - -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.habbohotel.wired.WiredHandler; -import com.eu.habbo.habbohotel.wired.WiredTriggerType; -import com.eu.habbo.messages.ClientMessage; -import com.eu.habbo.messages.ServerMessage; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredTriggerHabboIdle extends InteractionWiredTrigger { - private static final WiredTriggerType type = WiredTriggerType.IDLES; - - public WiredTriggerHabboIdle(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredTriggerHabboIdle(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - return stuff.length > 0 && stuff[0] instanceof Habbo; - } - - @Override - public String getWiredData() { - return ""; - } - - @Override - public void loadWiredData(ResultSet set, Room room) throws SQLException { - - } - - @Override - public void onPickUp() { - - } - - @Override - public WiredTriggerType getType() { - return type; - } - - @Override - public void serializeWiredData(ServerMessage message, Room room) { - message.appendBoolean(false); - message.appendInt(WiredHandler.MAXIMUM_FURNI_SELECTION); - message.appendInt(0); - message.appendInt(this.getBaseItem().getSpriteId()); - message.appendInt(this.getId()); - message.appendString(""); - message.appendInt(0); - message.appendInt(0); - message.appendInt(type.code); - message.appendInt(0); - message.appendInt(0); - } - - @Override - public boolean saveData(ClientMessage packet) { - return true; - } - - @Override - public boolean isTriggeredByRoomUnit() { - return true; - } -} diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboSaysCommand.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboSaysCommand.java deleted file mode 100644 index c0cc60d8..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboSaysCommand.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.triggers; - -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomChatMessage; -import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.habbohotel.wired.WiredTriggerType; -import com.eu.habbo.messages.ClientMessage; -import com.eu.habbo.messages.ServerMessage; -import com.eu.habbo.messages.outgoing.rooms.users.RoomUserWhisperComposer; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredTriggerHabboSaysCommand extends InteractionWiredTrigger { - private static final WiredTriggerType type = WiredTriggerType.SAY_COMMAND; - - private boolean ownerOnly = false; - private String key = ""; - - public WiredTriggerHabboSaysCommand(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredTriggerHabboSaysCommand(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Habbo habbo = room.getHabbo(roomUnit); - - if (habbo != null) { - if (this.key.length() > 0) { - if (stuff[0] instanceof String) { - if (((String) stuff[0]).replace(":", "").startsWith(this.key + " ")) { - if (this.ownerOnly && room.getOwnerId() != habbo.getHabboInfo().getId()) - return false; - - habbo.getClient().sendResponse(new RoomUserWhisperComposer(new RoomChatMessage(this.key, habbo, habbo, RoomChatMessageBubbles.ALERT))); - - return true; - } - } - } - } - return false; - } - - @Override - public String getWiredData() { - return (this.ownerOnly ? "1" : "0") + "\t" + this.key; - } - - @Override - public void loadWiredData(ResultSet set, Room room) throws SQLException { - String[] data = set.getString("wired_data").split("\t"); - - if (data.length == 2) { - this.ownerOnly = data[0].equalsIgnoreCase("1"); - this.setKey(data[1]); - } - } - - @Override - public void onPickUp() { - this.ownerOnly = false; - this.key = ""; - } - - @Override - public WiredTriggerType getType() { - return type; - } - - @Override - public void serializeWiredData(ServerMessage message, Room room) { - message.appendBoolean(false); - message.appendInt(5); - message.appendInt(0); - message.appendInt(this.getBaseItem().getSpriteId()); - message.appendInt(this.getId()); - message.appendString(this.key); - message.appendInt(0); - message.appendInt(1); - message.appendInt(this.getType().code); - message.appendInt(0); - message.appendInt(0); - } - - @Override - public boolean saveData(ClientMessage packet) { - packet.readInt(); - this.ownerOnly = packet.readInt() == 1; - setKey(packet.readString()); - - - return true; - } - - private void setKey(String key) { - if (key.contains(":")) { - key = key.replaceAll(":", ""); - } - - this.key = key; - } - - @Override - public boolean isTriggeredByRoomUnit() { - return true; - } -} diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboStartsDancing.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboStartsDancing.java deleted file mode 100644 index f3622f82..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboStartsDancing.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.triggers; - -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.wired.WiredTriggerType; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredTriggerHabboStartsDancing extends WiredTriggerCollision { - public WiredTriggerHabboStartsDancing(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredTriggerHabboStartsDancing(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public WiredTriggerType getType() { - return WiredTriggerType.STARTS_DANCING; - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - return true; - } -} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboStopsDancing.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboStopsDancing.java deleted file mode 100644 index cea8333c..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboStopsDancing.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.triggers; - -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.wired.WiredTriggerType; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredTriggerHabboStopsDancing extends WiredTriggerCollision { - public WiredTriggerHabboStopsDancing(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredTriggerHabboStopsDancing(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public WiredTriggerType getType() { - return WiredTriggerType.STOPS_DANCING; - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - return true; - } -} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboUnidle.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboUnidle.java deleted file mode 100644 index e058b1e3..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboUnidle.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.triggers; - -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.habbohotel.wired.WiredHandler; -import com.eu.habbo.habbohotel.wired.WiredTriggerType; -import com.eu.habbo.messages.ClientMessage; -import com.eu.habbo.messages.ServerMessage; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredTriggerHabboUnidle extends InteractionWiredTrigger { - private static final WiredTriggerType type = WiredTriggerType.UNIDLES; - - public WiredTriggerHabboUnidle(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredTriggerHabboUnidle(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - return stuff.length > 0 && stuff[0] instanceof Habbo; - } - - @Override - public String getWiredData() { - return ""; - } - - @Override - public void loadWiredData(ResultSet set, Room room) throws SQLException { - - } - - @Override - public void onPickUp() { - - } - - @Override - public WiredTriggerType getType() { - return type; - } - - @Override - public void serializeWiredData(ServerMessage message, Room room) { - message.appendBoolean(false); - message.appendInt(WiredHandler.MAXIMUM_FURNI_SELECTION); - message.appendInt(0); - message.appendInt(this.getBaseItem().getSpriteId()); - message.appendInt(this.getId()); - message.appendString(""); - message.appendInt(0); - message.appendInt(0); - message.appendInt(type.code); - message.appendInt(0); - message.appendInt(0); - } - - @Override - public boolean saveData(ClientMessage packet) { - return true; - } - - @Override - public boolean isTriggeredByRoomUnit() { - return true; - } -} \ No newline at end of file From a18bdf9bbb0bbd0903be4f783251d300a7ba725f Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Sat, 18 Apr 2020 22:21:00 +0100 Subject: [PATCH 005/215] Made plugins command no longer use a perm, always turned on. --- .gitmodules | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..efe4ac3e --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "morningstar-default-database"] + path = morningstar-default-database + url = https://git.krews.org/morningstar/morningstar-default-database From f228749e227c4d48b4751a1fd56244be0a717120 Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Sat, 18 Apr 2020 22:22:47 +0100 Subject: [PATCH 006/215] Revert "Made plugins command no longer use a perm, always turned on." This reverts commit a18bdf9b --- .gitmodules | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index efe4ac3e..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "morningstar-default-database"] - path = morningstar-default-database - url = https://git.krews.org/morningstar/morningstar-default-database From ea92573dc81a17f459665ca23c1e463af8b6a5d0 Mon Sep 17 00:00:00 2001 From: Thijmen Stavenuiter Date: Sun, 19 Apr 2020 14:46:17 +0200 Subject: [PATCH 007/215] Allow settings via ENV-variables --- .../eu/habbo/core/ConfigurationManager.java | 73 +++++++++++++++---- 1 file changed, 59 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/eu/habbo/core/ConfigurationManager.java b/src/main/java/com/eu/habbo/core/ConfigurationManager.java index 446c028f..719fc4e4 100644 --- a/src/main/java/com/eu/habbo/core/ConfigurationManager.java +++ b/src/main/java/com/eu/habbo/core/ConfigurationManager.java @@ -2,6 +2,7 @@ package com.eu.habbo.core; import com.eu.habbo.Emulator; import com.eu.habbo.plugin.events.emulator.EmulatorConfigUpdatedEvent; +import gnu.trove.map.hash.THashMap; import java.io.File; import java.io.FileInputStream; @@ -31,28 +32,72 @@ public class ConfigurationManager { InputStream input = null; - try { - File f = new File(this.configurationPath); - input = new FileInputStream(f); - this.properties.load(input); + String envDbHostname = System.getenv("DB_HOSTNAME"); - } catch (IOException ex) { - Emulator.getLogging().logErrorLine("[CRITICAL] FAILED TO LOAD CONFIG FILE! (" + this.configurationPath + ")"); - ex.printStackTrace(); - } finally { - if (input != null) { - try { - input.close(); - } catch (IOException e) { - e.printStackTrace(); + boolean useEnvVarsForDbConnection = envDbHostname != null && envDbHostname.length() > 1; + + if (!useEnvVarsForDbConnection) { + try { + File f = new File(this.configurationPath); + input = new FileInputStream(f); + this.properties.load(input); + + } catch (IOException ex) { + Emulator.getLogging().logErrorLine("[CRITICAL] FAILED TO LOAD CONFIG FILE! (" + this.configurationPath + ")"); + ex.printStackTrace(); + } finally { + if (input != null) { + try { + input.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + } else { + + Map envMapping = new THashMap<>(); + + // Database section + envMapping.put("db.hostname", "DB_HOSTNAME"); + envMapping.put("db.port", "DB_PORT"); + envMapping.put("db.database", "DB_DATABASE"); + envMapping.put("db.username", "DB_USERNAME"); + envMapping.put("db.password", "DB_PASSWORD"); + envMapping.put("db.params", "DB_PARAMS"); + + // Game Configuration + envMapping.put("game.host", "EMU_HOST"); + envMapping.put("game.port", "EMU_PORT"); + + // RCON + envMapping.put("rcon.host", "RCON_HOST"); + envMapping.put("rcon.port", "RCON_PORT"); + envMapping.put("rcon.allowed", "RCON_ALLOWED"); + + // Runtime + envMapping.put("runtime.threads", "RT_THREADS"); + envMapping.put("logging.errors.runtime", "RT_LOG_ERRORS"); + + + for (Map.Entry entry : envMapping.entrySet()) { + String envValue = System.getenv(entry.getValue()); + + if (envValue == null || envValue.length() == 0) { + Emulator.getLogging().logStart("Cannot find environment-value for variable `" + entry.getValue() + "`"); + } else { + this.properties.setProperty(entry.getKey(), envValue); } } } + if (this.loaded) { this.loadFromDatabase(); } + this.isLoading = false; Emulator.getLogging().logStart("Configuration Manager -> Loaded!"); @@ -183,4 +228,4 @@ public class ConfigurationManager { this.update(key, value); } -} \ No newline at end of file +} From 5d5427fb8868188e8ead7c1f21847b83317f1f3b Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Mon, 20 Apr 2020 14:59:34 +0100 Subject: [PATCH 008/215] Fixed version number. --- README.md | 4 ++-- pom.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0938f94f..b6468486 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ TheGeneral's own words were "dont like it then dont use it". We did not like wha Arcturus Morningstar is released under the [GNU General Public License v3](https://www.gnu.org/licenses/gpl-3.0.txt). ## Versions ## -![image](https://img.shields.io/badge/VERSION-2.3.0-success.svg?style=for-the-badge&logo=appveyor) -![image](https://img.shields.io/badge/STATUS-STABLE-green.svg?style=for-the-badge&logo=appveyor) +![image](https://img.shields.io/badge/VERSION-2.4.0-success.svg?style=for-the-badge&logo=appveyor) +![image](https://img.shields.io/badge/STATUS-UNSTABLE-red.svg?style=for-the-badge&logo=appveyor) Compiled Download: https://git.krews.org/morningstar/Arcturus-Community/releases diff --git a/pom.xml b/pom.xml index eae5e034..1389b284 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.eu.habbo Habbo - 2.3.1 + 2.4.0 UTF-8 From 3c2054c3d7bb7e817035a241abf2229e0b9ade17 Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Tue, 21 Apr 2020 00:08:39 +0100 Subject: [PATCH 009/215] Fixes Room Idling for custom wired. --- src/main/java/com/eu/habbo/habbohotel/rooms/Room.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 6e36318b..56c2ec02 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -1191,6 +1191,7 @@ public class Room implements Comparable, ISerialize, Runnable { if (habbo.getRoomUnit().isIdle()) { this.sendComposer(new RoomUnitIdleComposer(habbo.getRoomUnit()).compose()); + WiredHandler.handle(WiredTriggerType.IDLES, habbo.getRoomUnit(), this, new Object[]{habbo}); } } else { habbo.getRoomUnit().increaseIdleTimer(); From 3fabefee760f77714e309883f99a7c7b181825b5 Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Tue, 21 Apr 2020 15:21:26 +0100 Subject: [PATCH 010/215] Remove more custom wired. --- .../habbo/habbohotel/items/ItemManager.java | 2 - .../wired/effects/WiredEffectLowerFurni.java | 153 ------------------ .../wired/effects/WiredEffectRaiseFurni.java | 145 ----------------- 3 files changed, 300 deletions(-) delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLowerFurni.java delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectRaiseFurni.java diff --git a/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java b/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java index 85c15810..7eff22c4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java @@ -228,8 +228,6 @@ public class ItemManager { this.interactionsList.add(new ItemInteraction("wf_act_bot_follow_avatar", WiredEffectBotFollowHabbo.class)); this.interactionsList.add(new ItemInteraction("wf_act_bot_clothes", WiredEffectBotClothes.class)); this.interactionsList.add(new ItemInteraction("wf_act_bot_talk_to_avatar", WiredEffectBotTalkToHabbo.class)); - this.interactionsList.add(new ItemInteraction("wf_act_raise_furni", WiredEffectRaiseFurni.class)); - this.interactionsList.add(new ItemInteraction("wf_act_lower_furni", WiredEffectLowerFurni.class)); this.interactionsList.add(new ItemInteraction("wf_act_give_respect", WiredEffectGiveRespect.class)); this.interactionsList.add(new ItemInteraction("wf_act_alert", WiredEffectAlert.class)); this.interactionsList.add(new ItemInteraction("wf_act_give_handitem", WiredEffectGiveHandItem.class)); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLowerFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLowerFurni.java deleted file mode 100644 index d2b53911..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLowerFurni.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.effects; - -import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.HabboItem; -import com.eu.habbo.habbohotel.wired.WiredEffectType; -import com.eu.habbo.habbohotel.wired.WiredHandler; -import com.eu.habbo.messages.ClientMessage; -import com.eu.habbo.messages.ServerMessage; -import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer; -import gnu.trove.set.hash.THashSet; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredEffectLowerFurni extends InteractionWiredEffect { - public static final WiredEffectType type = WiredEffectType.TELEPORT; - - private THashSet items = new THashSet<>(); - - private int offset = 0; - - public WiredEffectLowerFurni(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredEffectLowerFurni(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public void serializeWiredData(ServerMessage message, Room room) { - THashSet items = new THashSet<>(); - - for (HabboItem item : this.items) { - if (item.getRoomId() != this.getRoomId() || Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null) - items.add(item); - } - - for (HabboItem item : items) { - this.items.remove(item); - } - message.appendBoolean(false); - message.appendInt(WiredHandler.MAXIMUM_FURNI_SELECTION); - message.appendInt(this.items.size()); - for (HabboItem item : this.items) - message.appendInt(item.getId()); - message.appendInt(this.getBaseItem().getSpriteId()); - message.appendInt(this.getId()); - message.appendString(""); - message.appendInt(0); - message.appendInt(type.code); - message.appendInt(0); - message.appendInt(this.offset); - message.appendInt(0); - message.appendString(""); - } - - @Override - public boolean saveData(ClientMessage packet, GameClient gameClient) { - packet.readInt(); - packet.readString(); - - this.items.clear(); - - int count = packet.readInt(); - - for (int i = 0; i < count; i++) { - this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt())); - } - - this.offset = packet.readInt(); - - return true; - } - - @Override - public WiredEffectType getType() { - return type; - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - for (HabboItem item : this.items) { - if (item.getRoomId() == 0) - continue; - - if (item.getZ() > 0) { - double z = (0.1) * (double) this.offset; - double minZ = room.getLayout().getHeightAtSquare(item.getX(), item.getY()); - if (z < minZ) { - z = minZ; - } - - room.sendComposer(new FloorItemOnRollerComposer(item, null, room.getLayout().getTile(item.getX(), item.getY()), -z, room).compose()); - - room.updateHabbosAt(item.getX(), item.getY()); - } - } - - return true; - } - - @Override - public String getWiredData() { - StringBuilder wiredData = new StringBuilder(this.offset + "\t"); - - if (this.items != null && !this.items.isEmpty()) { - for (HabboItem item : this.items) { - wiredData.append(item.getId()).append(";"); - } - } - - return wiredData.toString(); - } - - @Override - public void loadWiredData(ResultSet set, Room room) throws SQLException { - this.items = new THashSet<>(); - String wiredData = set.getString("wired_data"); - - if (wiredData.contains("\t")) { - String[] data = wiredData.split("\t"); - - try { - this.offset = Integer.valueOf(data[0]); - } catch (Exception e) { - } - - if (data.length >= 2) { - if (data[1].contains(";")) { - for (String s : data[1].split(";")) { - HabboItem item = room.getHabboItem(Integer.valueOf(s)); - - if (item != null) - this.items.add(item); - } - } - } - } - } - - @Override - public void onPickUp() { - this.offset = 0; - this.items.clear(); - this.setDelay(0); - } -} diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectRaiseFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectRaiseFurni.java deleted file mode 100644 index 76baea9d..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectRaiseFurni.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired.effects; - -import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.HabboItem; -import com.eu.habbo.habbohotel.wired.WiredEffectType; -import com.eu.habbo.habbohotel.wired.WiredHandler; -import com.eu.habbo.messages.ClientMessage; -import com.eu.habbo.messages.ServerMessage; -import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer; -import gnu.trove.set.hash.THashSet; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class WiredEffectRaiseFurni extends InteractionWiredEffect { - public static final WiredEffectType type = WiredEffectType.TELEPORT; - - private THashSet items = new THashSet<>(); - - private int offset = 0; - - public WiredEffectRaiseFurni(ResultSet set, Item baseItem) throws SQLException { - super(set, baseItem); - } - - public WiredEffectRaiseFurni(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - } - - @Override - public void serializeWiredData(ServerMessage message, Room room) { - THashSet items = new THashSet<>(); - - for (HabboItem item : this.items) { - if (item.getRoomId() != this.getRoomId() || Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null) - items.add(item); - } - - for (HabboItem item : items) { - this.items.remove(item); - } - message.appendBoolean(false); - message.appendInt(WiredHandler.MAXIMUM_FURNI_SELECTION); - message.appendInt(this.items.size()); - for (HabboItem item : this.items) - message.appendInt(item.getId()); - message.appendInt(this.getBaseItem().getSpriteId()); - message.appendInt(this.getId()); - message.appendString(""); - message.appendInt(0); - message.appendInt(type.code); - message.appendInt(0); - message.appendInt(this.offset); - message.appendInt(0); - message.appendString(""); - } - - @Override - public boolean saveData(ClientMessage packet, GameClient gameClient) { - packet.readInt(); - packet.readString(); - - this.items.clear(); - - int count = packet.readInt(); - - for (int i = 0; i < count; i++) { - this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt())); - } - - this.offset = packet.readInt(); - - return true; - } - - @Override - public WiredEffectType getType() { - return type; - } - - @Override - public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - for (HabboItem item : this.items) { - if (item.getRoomId() == 0) - continue; - - double offsetZ = (((0.1) * this.offset)) % 127; - room.sendComposer(new FloorItemOnRollerComposer(item, null, room.getLayout().getTile(item.getX(), item.getY()), offsetZ, room).compose()); - room.updateHabbosAt(item.getX(), item.getY()); - } - - return true; - } - - @Override - public String getWiredData() { - StringBuilder wiredData = new StringBuilder(this.offset + "\t"); - - if (this.items != null && !this.items.isEmpty()) { - for (HabboItem item : this.items) { - wiredData.append(item.getId()).append(";"); - } - } - - return wiredData.toString(); - } - - @Override - public void loadWiredData(ResultSet set, Room room) throws SQLException { - this.items = new THashSet<>(); - String wiredData = set.getString("wired_data"); - - if (wiredData.contains("\t")) { - String[] data = wiredData.split("\t"); - - try { - this.offset = Integer.valueOf(data[0]); - } catch (Exception e) { - } - - if (data.length >= 2) { - if (data[1].contains(";")) { - for (String s : data[1].split(";")) { - HabboItem item = room.getHabboItem(Integer.valueOf(s)); - - if (item != null) - this.items.add(item); - } - } - } - } - } - - @Override - public void onPickUp() { - this.offset = 0; - this.items.clear(); - this.setDelay(0); - } -} From 4056e48643d4f24bedf0a5854a3dbe6edb82490e Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Tue, 21 Apr 2020 15:48:53 +0100 Subject: [PATCH 011/215] Made OpenSearches use the default value instead of setting it to 1. --- .../eu/habbo/habbohotel/users/HabboNavigatorWindowSettings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboNavigatorWindowSettings.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboNavigatorWindowSettings.java index 88c37d56..caaaf4b8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboNavigatorWindowSettings.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboNavigatorWindowSettings.java @@ -31,7 +31,7 @@ public class HabboNavigatorWindowSettings { this.y = set.getInt("y"); this.width = set.getInt("width"); this.height = set.getInt("height"); - this.openSearches = set.getString("open_searches").equals("1"); + this.openSearches = set.getBoolean("open_searches"); this.unknown = 0; } From f261e8c10c2c734e1d44d93ac90086bb57fac13f Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Tue, 21 Apr 2020 16:28:24 +0100 Subject: [PATCH 012/215] Fixed List Mode setting itself to thumbnails. Now uses the default. --- .../habbohotel/users/HabboNavigatorPersonalDisplayMode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboNavigatorPersonalDisplayMode.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboNavigatorPersonalDisplayMode.java index df103c70..1731bdf8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboNavigatorPersonalDisplayMode.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboNavigatorPersonalDisplayMode.java @@ -16,7 +16,7 @@ public class HabboNavigatorPersonalDisplayMode { } public HabboNavigatorPersonalDisplayMode(ResultSet set) throws SQLException { - this.listMode = set.getString("list_type").equals("thumbnails") ? ListMode.THUMBNAILS : ListMode.LIST; + this.listMode = set.getBoolean("list_type") ? ListMode.THUMBNAILS : ListMode.LIST; this.displayMode = DisplayMode.valueOf(set.getString("display").toUpperCase()); } } From 5617e4164d1e59690c5574085e5feb5e305c0011 Mon Sep 17 00:00:00 2001 From: Harmonic Date: Tue, 21 Apr 2020 11:36:17 -0400 Subject: [PATCH 013/215] Revert "Fixed List Mode setting itself to thumbnails. Now uses the default." This reverts commit f261e8c10c2c734e1d44d93ac90086bb57fac13f --- .../habbohotel/users/HabboNavigatorPersonalDisplayMode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboNavigatorPersonalDisplayMode.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboNavigatorPersonalDisplayMode.java index 1731bdf8..df103c70 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboNavigatorPersonalDisplayMode.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboNavigatorPersonalDisplayMode.java @@ -16,7 +16,7 @@ public class HabboNavigatorPersonalDisplayMode { } public HabboNavigatorPersonalDisplayMode(ResultSet set) throws SQLException { - this.listMode = set.getBoolean("list_type") ? ListMode.THUMBNAILS : ListMode.LIST; + this.listMode = set.getString("list_type").equals("thumbnails") ? ListMode.THUMBNAILS : ListMode.LIST; this.displayMode = DisplayMode.valueOf(set.getString("display").toUpperCase()); } } From fc6dd9790daea518d11d3facb99dbab28b5c829e Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Thu, 23 Apr 2020 16:06:17 +0100 Subject: [PATCH 014/215] Fix WiredEffectTriggerStacks NPE. --- .../wired/effects/WiredEffectTriggerStacks.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java index 6016e7ab..dd136015 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java @@ -102,7 +102,7 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect { @Override public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - if (stuff != null && stuff.length >= 1 && stuff[stuff.length - 1] instanceof WiredEffectTriggerStacks) { + if (stuff == null && stuff.length >= 1 && stuff[stuff.length - 1] instanceof WiredEffectTriggerStacks) { return false; } @@ -126,14 +126,14 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect { } } } + Object[] newStuff = new Object[stuff.length + 1]; + System.arraycopy(stuff, 0, newStuff, 0, stuff.length); + newStuff[newStuff.length - 1] = this; + WiredHandler.executeEffectsAtTiles(usedTiles, roomUnit, room, stuff); - Object[] newStuff = new Object[stuff.length + 1]; - System.arraycopy(stuff, 0, newStuff, 0, stuff.length); - newStuff[newStuff.length - 1] = this; - WiredHandler.executeEffectsAtTiles(usedTiles, roomUnit, room, stuff); + return true; + } - return true; - } @Override public String getWiredData() { From df2641f215a9e25ffee696fc1e019b6aca578bf0 Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Thu, 23 Apr 2020 18:08:37 +0100 Subject: [PATCH 015/215] Replace all Runnables with lambda . --- .gitmodules | 3 ++ .../eu/habbo/habbohotel/bots/ButlerBot.java | 17 +++----- .../habbohotel/commands/MassGiftCommand.java | 23 +++++----- .../interactions/InteractionEffectGiver.java | 9 ++-- .../interactions/InteractionHanditem.java | 9 ++-- .../interactions/InteractionHanditemTile.java | 9 ++-- .../InteractionPressurePlate.java | 14 +------ .../InteractionTileEffectProvider.java | 9 ++-- .../items/interactions/InteractionTrap.java | 9 ++-- .../pets/InteractionPetBreedingNest.java | 29 ++++++------- .../interactions/pets/InteractionPetToy.java | 13 +++--- .../WiredEffectChangeFurniDirection.java | 7 +--- .../effects/WiredEffectMoveFurniAway.java | 7 +--- .../com/eu/habbo/habbohotel/rooms/Room.java | 40 ++++++------------ .../incoming/handshake/SecureLoginEvent.java | 15 +++---- .../incoming/modtool/ReportEvent.java | 42 ++++++++----------- .../com/eu/habbo/threading/ThreadPooling.java | 13 +++--- .../runnables/hopper/HopperActionOne.java | 9 ++-- 18 files changed, 98 insertions(+), 179 deletions(-) create mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..efe4ac3e --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "morningstar-default-database"] + path = morningstar-default-database + url = https://git.krews.org/morningstar/morningstar-default-database diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/ButlerBot.java b/src/main/java/com/eu/habbo/habbohotel/bots/ButlerBot.java index 7d56944c..3f169e7c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/ButlerBot.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/ButlerBot.java @@ -75,20 +75,13 @@ public class ButlerBot extends Bot { tasks.add(new RoomUnitGiveHanditem(serveEvent.habbo.getRoomUnit(), serveEvent.habbo.getHabboInfo().getCurrentRoom(), serveEvent.itemId)); tasks.add(new RoomUnitGiveHanditem(this.getRoomUnit(), serveEvent.habbo.getHabboInfo().getCurrentRoom(), 0)); - tasks.add(new Runnable() { - @Override - public void run() { - b.talk(Emulator.getTexts().getValue("bots.butler.given").replace("%key%", key).replace("%username%", serveEvent.habbo.getHabboInfo().getUsername())); - } - }); + tasks.add(() -> b.talk(Emulator.getTexts().getValue("bots.butler.given").replace("%key%", key).replace("%username%", serveEvent.habbo.getHabboInfo().getUsername()))); List failedReached = new ArrayList(); - failedReached.add(new Runnable() { - public void run() { - if (b.getRoomUnit().getCurrentLocation().distance(serveEvent.habbo.getRoomUnit().getCurrentLocation()) <= Emulator.getConfig().getInt("hotel.bot.butler.servedistance", 8)) { - for (Runnable t : tasks) { - t.run(); - } + failedReached.add(() -> { + if (b.getRoomUnit().getCurrentLocation().distance(serveEvent.habbo.getRoomUnit().getCurrentLocation()) <= Emulator.getConfig().getInt("hotel.bot.butler.servedistance", 8)) { + for (Runnable t : tasks) { + t.run(); } } }); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/MassGiftCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/MassGiftCommand.java index 6855b6b2..1c1055b1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/MassGiftCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/MassGiftCommand.java @@ -59,24 +59,21 @@ public class MassGiftCommand extends Command { keys.put("message", Emulator.getTexts().getValue("generic.gift.received.anonymous")); ServerMessage giftNotificiationMessage = new BubbleAlertComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys).compose(); - Emulator.getThreading().run(new Runnable() { - @Override - public void run() { - for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { - Habbo habbo = set.getValue(); + Emulator.getThreading().run(() -> { + for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { + Habbo habbo = set.getValue(); - HabboItem item = Emulator.getGameEnvironment().getItemManager().createItem(0, baseItem, 0, 0, ""); + HabboItem item = Emulator.getGameEnvironment().getItemManager().createItem(0, baseItem, 0, 0, ""); - Item giftItem = Emulator.getGameEnvironment().getItemManager().getItem((Integer) Emulator.getGameEnvironment().getCatalogManager().giftFurnis.values().toArray()[Emulator.getRandom().nextInt(Emulator.getGameEnvironment().getCatalogManager().giftFurnis.size())]); + Item giftItem = Emulator.getGameEnvironment().getItemManager().getItem((Integer) Emulator.getGameEnvironment().getCatalogManager().giftFurnis.values().toArray()[Emulator.getRandom().nextInt(Emulator.getGameEnvironment().getCatalogManager().giftFurnis.size())]); - String extraData = "1\t" + item.getId(); - extraData += "\t0\t0\t0\t" + finalMessage + "\t0\t0"; + String extraData = "1\t" + item.getId(); + extraData += "\t0\t0\t0\t" + finalMessage + "\t0\t0"; - Emulator.getGameEnvironment().getItemManager().createGift(habbo.getHabboInfo().getUsername(), giftItem, extraData, 0, 0); + Emulator.getGameEnvironment().getItemManager().createGift(habbo.getHabboInfo().getUsername(), giftItem, extraData, 0, 0); - habbo.getClient().sendResponse(new InventoryRefreshComposer()); - habbo.getClient().sendResponse(giftNotificiationMessage); - } + habbo.getClient().sendResponse(new InventoryRefreshComposer()); + habbo.getClient().sendResponse(giftNotificiationMessage); } }); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGiver.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGiver.java index 2d9106c9..99df17f1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGiver.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGiver.java @@ -44,12 +44,9 @@ public class InteractionEffectGiver extends InteractionDefault { this.setExtradata("1"); room.updateItem(this); - Emulator.getThreading().run(new Runnable() { - @Override - public void run() { - InteractionEffectGiver.this.setExtradata("0"); - room.updateItem(instance); - } + Emulator.getThreading().run(() -> { + InteractionEffectGiver.this.setExtradata("0"); + room.updateItem(instance); }, 500); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditem.java index b6923128..7782736b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditem.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditem.java @@ -42,12 +42,9 @@ public class InteractionHanditem extends InteractionDefault { this.setExtradata("1"); room.updateItem(this); - Emulator.getThreading().run(new Runnable() { - @Override - public void run() { - InteractionHanditem.this.setExtradata("0"); - room.updateItem(instance); - } + Emulator.getThreading().run(() -> { + InteractionHanditem.this.setExtradata("0"); + room.updateItem(instance); }, 500); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditemTile.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditemTile.java index 83e1bd24..786e369f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditemTile.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditemTile.java @@ -20,12 +20,9 @@ public class InteractionHanditemTile extends InteractionHanditem { @Override public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { InteractionHanditemTile instance = this; - Emulator.getThreading().run(new Runnable() { - @Override - public void run() { - if (roomUnit.getCurrentLocation().x == instance.getX() && roomUnit.getCurrentLocation().y == instance.getY()) { - instance.handle(room, roomUnit); - } + Emulator.getThreading().run(() -> { + if (roomUnit.getCurrentLocation().x == instance.getX() && roomUnit.getCurrentLocation().y == instance.getY()) { + instance.handle(room, roomUnit); } }, 3000); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPressurePlate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPressurePlate.java index 17b77a39..0eee202b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPressurePlate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPressurePlate.java @@ -56,24 +56,14 @@ public class InteractionPressurePlate extends HabboItem { public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { super.onWalkOn(roomUnit, room, objects); - Emulator.getThreading().run(new Runnable() { - @Override - public void run() { - updateState(room); - } - }, 100); + Emulator.getThreading().run(() -> updateState(room), 100); } @Override public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { super.onWalkOff(roomUnit, room, objects); - Emulator.getThreading().run(new Runnable() { - @Override - public void run() { - updateState(room); - } - }, 100); + Emulator.getThreading().run(() -> updateState(room), 100); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTileEffectProvider.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTileEffectProvider.java index 733d6c45..c58f6193 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTileEffectProvider.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTileEffectProvider.java @@ -48,12 +48,9 @@ public class InteractionTileEffectProvider extends InteractionCustomValues { room.updateItem(this); final InteractionTileEffectProvider proxy = this; - Emulator.getThreading().run(new Runnable() { - @Override - public void run() { - proxy.values.put("state", "0"); - room.updateItem(proxy); - } + Emulator.getThreading().run(() -> { + proxy.values.put("state", "0"); + room.updateItem(proxy); }, 500); room.giveEffect(roomUnit, effectId, -1); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrap.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrap.java index adf949e0..54b9baaa 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrap.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrap.java @@ -52,12 +52,9 @@ public class InteractionTrap extends InteractionDefault { roomUnit.setCanWalk(false); - Emulator.getThreading().run(new Runnable() { - @Override - public void run() { - room.giveEffect(roomUnit, 0, -1); - roomUnit.setCanWalk(true); - } + Emulator.getThreading().run(() -> { + room.giveEffect(roomUnit, 0, -1); + roomUnit.setCanWalk(true); }, delay); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetBreedingNest.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetBreedingNest.java index 16d219a9..9ec50ff9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetBreedingNest.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetBreedingNest.java @@ -150,24 +150,21 @@ public class InteractionPetBreedingNest extends HabboItem { HabboItem box = this; Pet petOne = this.petOne; Pet petTwo = this.petTwo; - Emulator.getThreading().run(new Runnable() { - @Override - public void run() { - Pet offspring = Emulator.getGameEnvironment().getPetManager().createPet(petOne.getPetData().getOffspringType(), (int) Math.min(Math.round(Math.max(1d, PetManager.getNormalDistributionForBreeding(petOne.getLevel(), petTwo.getLevel()).sample())), 20), name, habbo.getClient()); + Emulator.getThreading().run(() -> { + Pet offspring = Emulator.getGameEnvironment().getPetManager().createPet(petOne.getPetData().getOffspringType(), (int) Math.min(Math.round(Math.max(1d, PetManager.getNormalDistributionForBreeding(petOne.getLevel(), petTwo.getLevel()).sample())), 20), name, habbo.getClient()); - //habbo.getClient().sendResponse(new PetPackageNameValidationComposer(box.getId(), PetPackageNameValidationComposer.CLOSE_WIDGET, "")); - habbo.getHabboInfo().getCurrentRoom().placePet(offspring, box.getX(), box.getY(), box.getZ(), box.getRotation()); - offspring.needsUpdate = true; - offspring.run(); - InteractionPetBreedingNest.this.freePets(); - habbo.getHabboInfo().getCurrentRoom().removeHabboItem(box); - habbo.getClient().sendResponse(new PetBreedingCompleted(offspring.getId(), Emulator.getGameEnvironment().getPetManager().getRarityForOffspring(offspring))); + //habbo.getClient().sendResponse(new PetPackageNameValidationComposer(box.getId(), PetPackageNameValidationComposer.CLOSE_WIDGET, "")); + habbo.getHabboInfo().getCurrentRoom().placePet(offspring, box.getX(), box.getY(), box.getZ(), box.getRotation()); + offspring.needsUpdate = true; + offspring.run(); + InteractionPetBreedingNest.this.freePets(); + habbo.getHabboInfo().getCurrentRoom().removeHabboItem(box); + habbo.getClient().sendResponse(new PetBreedingCompleted(offspring.getId(), Emulator.getGameEnvironment().getPetManager().getRarityForOffspring(offspring))); - if (box.getBaseItem().getName().startsWith("pet_breeding_")) { - String boxType = box.getBaseItem().getName().replace("pet_breeding_", ""); - String achievement = boxType.substring(0, 1).toUpperCase() + boxType.substring(1) + "Breeder"; - AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement(achievement)); - } + if (box.getBaseItem().getName().startsWith("pet_breeding_")) { + String boxType = box.getBaseItem().getName().replace("pet_breeding_", ""); + String achievement = boxType.substring(0, 1).toUpperCase() + boxType.substring(1) + "Breeder"; + AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement(achievement)); } }, 2000); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetToy.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetToy.java index 680bae5a..caeaf54f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetToy.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetToy.java @@ -45,14 +45,11 @@ public class InteractionPetToy extends InteractionDefault { pet.getRoomUnit().setStatus(RoomUnitStatus.PLAY, "0"); pet.packetUpdate = true; HabboItem item = this; - Emulator.getThreading().run(new Runnable() { - @Override - public void run() { - pet.addHappyness(25); - item.setExtradata("0"); - room.updateItem(item); - new PetClearPosture(pet, RoomUnitStatus.PLAY, null, true).run(); - } + Emulator.getThreading().run(() -> { + pet.addHappyness(25); + item.setExtradata("0"); + room.updateItem(item); + new PetClearPosture(pet, RoomUnitStatus.PLAY, null, true).run(); }, 2500 + (Emulator.getRandom().nextInt(20) * 500)); this.setExtradata("1"); room.updateItemState(this); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java index c41094e9..bbb44819 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java @@ -72,12 +72,7 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect { boolean hasHabbos = false; for (Habbo habbo : room.getHabbosAt(targetTile)) { hasHabbos = true; - Emulator.getThreading().run(new Runnable() { - @Override - public void run() { - WiredHandler.handle(WiredTriggerType.COLLISION, habbo.getRoomUnit(), room, new Object[]{entry.getKey()}); - } - }); + Emulator.getThreading().run(() -> WiredHandler.handle(WiredTriggerType.COLLISION, habbo.getRoomUnit(), room, new Object[]{entry.getKey()})); } if (!hasHabbos) { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java index 83d32cda..556e56c3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java @@ -58,12 +58,7 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect { if (target != null) { if (RoomLayout.tilesAdjecent(target.getRoomUnit().getCurrentLocation(), room.getLayout().getTile(item.getX(), item.getY())) && (target.getRoomUnit().getX() == item.getX() || target.getRoomUnit().getY() == item.getY())) { final Habbo finalTarget = target; - Emulator.getThreading().run(new Runnable() { - @Override - public void run() { - WiredHandler.handle(WiredTriggerType.COLLISION, finalTarget.getRoomUnit(), room, new Object[]{item}); - } - }, 500); + Emulator.getThreading().run(() -> WiredHandler.handle(WiredTriggerType.COLLISION, finalTarget.getRoomUnit(), room, new Object[]{item}), 500); continue; } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 56c2ec02..3f153217 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -717,14 +717,11 @@ public class Room implements Comparable, ISerialize, Runnable { } if (oldZ != roomUnit.getZ()) { - this.scheduledTasks.add(new Runnable() { - @Override - public void run() { - try { - item.onWalkOn(roomUnit, Room.this, null); - } catch (Exception e) { + this.scheduledTasks.add(() -> { + try { + item.onWalkOn(roomUnit, Room.this, null); + } catch (Exception e) { - } } }); } @@ -1039,12 +1036,7 @@ public class Room implements Comparable, ISerialize, Runnable { if (this.loaded) { try { Emulator.getThreading().run( - new Runnable() { - @Override - public void run() { - Room.this.cycle(); - } - }); + Room.this::cycle); } catch (Exception e) { Emulator.getLogging().logErrorLine(e); } @@ -1175,12 +1167,7 @@ public class Room implements Comparable, ISerialize, Runnable { habbo.getRoomUnit().kickCount++; if (habbo.getRoomUnit().kickCount >= 5) { - this.scheduledTasks.add(new Runnable() { - @Override - public void run() { - Emulator.getGameEnvironment().getRoomManager().leaveRoom(habbo, room); - } - }); + this.scheduledTasks.add(() -> Emulator.getGameEnvironment().getRoomManager().leaveRoom(habbo, room)); continue; } } @@ -1471,15 +1458,12 @@ public class Room implements Comparable, ISerialize, Runnable { HabboItem item = room.getTopItemAt(tileInFront.x, tileInFront.y); if (item != null && itemsNewTile.contains(item)) { - Emulator.getThreading().run(new Runnable() { - @Override - public void run() { - if (unit.getGoal() == rollerTile) { - try { - item.onWalkOn(unit, room, null); - } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); - } + Emulator.getThreading().run(() -> { + if (unit.getGoal() == rollerTile) { + try { + item.onWalkOn(unit, room, null); + } catch (Exception e) { + Emulator.getLogging().logErrorLine(e); } } }, this.getRollerSpeed() == 0 ? 250 : InteractionRoller.DELAY); diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java index 0a8f2685..84d3d5e9 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java @@ -8,7 +8,6 @@ import com.eu.habbo.habbohotel.navigation.NavigatorSavedSearch; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboManager; -import com.eu.habbo.habbohotel.users.inventory.EffectsComponent; import com.eu.habbo.messages.NoAuthMessage; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.incoming.MessageHandler; @@ -36,7 +35,6 @@ import com.eu.habbo.plugin.events.users.UserLoginEvent; import gnu.trove.map.hash.THashMap; import java.util.ArrayList; -import java.util.Arrays; import java.util.Date; @NoAuthMessage @@ -178,14 +176,11 @@ public class SecureLoginEvent extends MessageHandler { if (Emulator.getConfig().getBoolean("hotel.welcome.alert.enabled")) { final Habbo finalHabbo = habbo; - Emulator.getThreading().run(new Runnable() { - @Override - public void run() { - if (Emulator.getConfig().getBoolean("hotel.welcome.alert.oldstyle")) { - SecureLoginEvent.this.client.sendResponse(new MessagesForYouComposer(HabboManager.WELCOME_MESSAGE.replace("%username%", finalHabbo.getHabboInfo().getUsername()).replace("%user%", finalHabbo.getHabboInfo().getUsername()).split("
"))); - } else { - SecureLoginEvent.this.client.sendResponse(new GenericAlertComposer(HabboManager.WELCOME_MESSAGE.replace("%username%", finalHabbo.getHabboInfo().getUsername()).replace("%user%", finalHabbo.getHabboInfo().getUsername()))); - } + Emulator.getThreading().run(() -> { + if (Emulator.getConfig().getBoolean("hotel.welcome.alert.oldstyle")) { + SecureLoginEvent.this.client.sendResponse(new MessagesForYouComposer(HabboManager.WELCOME_MESSAGE.replace("%username%", finalHabbo.getHabboInfo().getUsername()).replace("%user%", finalHabbo.getHabboInfo().getUsername()).split("
"))); + } else { + SecureLoginEvent.this.client.sendResponse(new GenericAlertComposer(HabboManager.WELCOME_MESSAGE.replace("%username%", finalHabbo.getHabboInfo().getUsername()).replace("%user%", finalHabbo.getHabboInfo().getUsername()))); } }, Emulator.getConfig().getInt("hotel.welcome.alert.delay", 5000)); } diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/ReportEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/ReportEvent.java index 79fc8faa..8b2122e5 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/ReportEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/ReportEvent.java @@ -70,18 +70,15 @@ public class ReportEvent extends MessageHandler { if (cfhTopic != null) { if (cfhTopic.action != CfhActionType.MODS) { - Emulator.getThreading().run(new Runnable() { - @Override - public void run() { - if (issue.state == ModToolTicketState.OPEN) { - if (cfhTopic.action == CfhActionType.AUTO_IGNORE) { - ReportEvent.this.client.getHabbo().getHabboStats().ignoreUser(reported.getHabboInfo().getId()); - ReportEvent.this.client.sendResponse(new RoomUserIgnoredComposer(reported, RoomUserIgnoredComposer.IGNORED)); - } - - ReportEvent.this.client.sendResponse(new ModToolIssueHandledComposer(cfhTopic.reply).compose()); - Emulator.getGameEnvironment().getModToolManager().closeTicketAsHandled(issue, null); + Emulator.getThreading().run(() -> { + if (issue.state == ModToolTicketState.OPEN) { + if (cfhTopic.action == CfhActionType.AUTO_IGNORE) { + ReportEvent.this.client.getHabbo().getHabboStats().ignoreUser(reported.getHabboInfo().getId()); + ReportEvent.this.client.sendResponse(new RoomUserIgnoredComposer(reported, RoomUserIgnoredComposer.IGNORED)); } + + ReportEvent.this.client.sendResponse(new ModToolIssueHandledComposer(cfhTopic.reply).compose()); + Emulator.getGameEnvironment().getModToolManager().closeTicketAsHandled(issue, null); } }, 30 * 1000); } @@ -99,21 +96,18 @@ public class ReportEvent extends MessageHandler { if (cfhTopic != null) { if (cfhTopic.action != CfhActionType.MODS) { - Emulator.getThreading().run(new Runnable() { - @Override - public void run() { - if (issue.state == ModToolTicketState.OPEN) { - if (cfhTopic.action == CfhActionType.AUTO_IGNORE) { - ReportEvent.this.client.getHabbo().getHabboStats().ignoreUser(issue.reportedId); - Habbo reported = Emulator.getGameEnvironment().getHabboManager().getHabbo(issue.reportedId); - if (reported != null) { - ReportEvent.this.client.sendResponse(new RoomUserIgnoredComposer(reported, RoomUserIgnoredComposer.IGNORED)); - } + Emulator.getThreading().run(() -> { + if (issue.state == ModToolTicketState.OPEN) { + if (cfhTopic.action == CfhActionType.AUTO_IGNORE) { + ReportEvent.this.client.getHabbo().getHabboStats().ignoreUser(issue.reportedId); + Habbo reported = Emulator.getGameEnvironment().getHabboManager().getHabbo(issue.reportedId); + if (reported != null) { + ReportEvent.this.client.sendResponse(new RoomUserIgnoredComposer(reported, RoomUserIgnoredComposer.IGNORED)); } - - ReportEvent.this.client.sendResponse(new ModToolIssueHandledComposer(cfhTopic.reply).compose()); - Emulator.getGameEnvironment().getModToolManager().closeTicketAsHandled(issue, null); } + + ReportEvent.this.client.sendResponse(new ModToolIssueHandledComposer(cfhTopic.reply).compose()); + Emulator.getGameEnvironment().getModToolManager().closeTicketAsHandled(issue, null); } }, 30 * 1000); } diff --git a/src/main/java/com/eu/habbo/threading/ThreadPooling.java b/src/main/java/com/eu/habbo/threading/ThreadPooling.java index 349781a7..62178767 100644 --- a/src/main/java/com/eu/habbo/threading/ThreadPooling.java +++ b/src/main/java/com/eu/habbo/threading/ThreadPooling.java @@ -38,14 +38,11 @@ public class ThreadPooling { public ScheduledFuture run(Runnable run, long delay) { try { if (this.canAdd) { - return this.scheduledPool.schedule(new Runnable() { - @Override - public void run() { - try { - run.run(); - } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); - } + return this.scheduledPool.schedule(() -> { + try { + run.run(); + } catch (Exception e) { + Emulator.getLogging().logErrorLine(e); } }, delay, TimeUnit.MILLISECONDS); } diff --git a/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionOne.java b/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionOne.java index 76ee6ab1..25319d21 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionOne.java +++ b/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionOne.java @@ -29,12 +29,9 @@ public class HopperActionOne implements Runnable { this.client.getHabbo().getRoomUnit().setZ(this.teleportOne.getZ()); this.client.getHabbo().getRoomUnit().setPreviousLocationZ(this.teleportOne.getZ()); - Emulator.getThreading().run(new Runnable() { - @Override - public void run() { - HopperActionOne.this.client.getHabbo().getRoomUnit().removeStatus(RoomUnitStatus.MOVE); - HopperActionOne.this.room.sendComposer(new RoomUserStatusComposer(HopperActionOne.this.client.getHabbo().getRoomUnit()).compose()); - } + Emulator.getThreading().run(() -> { + HopperActionOne.this.client.getHabbo().getRoomUnit().removeStatus(RoomUnitStatus.MOVE); + HopperActionOne.this.room.sendComposer(new RoomUserStatusComposer(HopperActionOne.this.client.getHabbo().getRoomUnit()).compose()); }, 750); Emulator.getThreading().run(new HopperActionTwo(this.teleportOne, this.room, this.client), 1250); From 78905c2a05ff247597baf074e984d27a9428cfa0 Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Thu, 23 Apr 2020 22:17:04 +0100 Subject: [PATCH 016/215] Added Sticky Limits to rooms (default 200 like habbo) --- sqlupdates/2_3_1_TO_2_4_0-RC-1.sql | 1 + .../rooms/FurnitureMovementError.java | 4 +- .../com/eu/habbo/habbohotel/rooms/Room.java | 45 +++++++++++++------ .../rooms/items/PostItPlaceEvent.java | 37 +++++++++------ .../com/eu/habbo/plugin/PluginManager.java | 1 + 5 files changed, 59 insertions(+), 29 deletions(-) create mode 100644 sqlupdates/2_3_1_TO_2_4_0-RC-1.sql diff --git a/sqlupdates/2_3_1_TO_2_4_0-RC-1.sql b/sqlupdates/2_3_1_TO_2_4_0-RC-1.sql new file mode 100644 index 00000000..bee4dbe3 --- /dev/null +++ b/sqlupdates/2_3_1_TO_2_4_0-RC-1.sql @@ -0,0 +1 @@ +INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.room.stickies.max', '200'); diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/FurnitureMovementError.java b/src/main/java/com/eu/habbo/habbohotel/rooms/FurnitureMovementError.java index be20b9e9..9c1ddb76 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/FurnitureMovementError.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/FurnitureMovementError.java @@ -13,7 +13,9 @@ public enum FurnitureMovementError { TILE_HAS_BOTS("${room.error.cant_set_item}"), MAX_DIMMERS("${room.error.max_dimmers}"), MAX_SOUNDFURNI("${room.errors.max_soundfurni}"), - MAX_ITEMS("${room.error.max_furniture}"); + MAX_ITEMS("${room.error.max_furniture}"), + MAX_STICKIES("${room.error.max_stickies}"); + public final String errorCode; diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 3f153217..3d3e4893 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -86,25 +86,19 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; public class Room implements Comparable, ISerialize, Runnable { - public static final Comparator SORT_SCORE = new Comparator() { - @Override - public int compare(Object o1, Object o2) { + public static final Comparator SORT_SCORE = (o1, o2) -> { - if (!(o1 instanceof Room && o2 instanceof Room)) - return 0; + if (!(o1 instanceof Room && o2 instanceof Room)) + return 0; - return ((Room) o2).getScore() - ((Room) o1).getScore(); - } + return ((Room) o2).getScore() - ((Room) o1).getScore(); }; - public static final Comparator SORT_ID = new Comparator() { - @Override - public int compare(Object o1, Object o2) { + public static final Comparator SORT_ID = (o1, o2) -> { - if (!(o1 instanceof Room && o2 instanceof Room)) - return 0; + if (!(o1 instanceof Room && o2 instanceof Room)) + return 0; - return ((Room) o2).getId() - ((Room) o1).getId(); - } + return ((Room) o2).getId() - ((Room) o1).getId(); }; private static final TIntObjectHashMap defaultMoodData = new TIntObjectHashMap<>(); //Configuration. Loaded from database & updated accordingly. @@ -112,6 +106,7 @@ public class Room implements Comparable, ISerialize, Runnable { public static int MAXIMUM_BOTS = 10; public static int MAXIMUM_PETS = 10; public static int MAXIMUM_FURNI = 2500; + public static int MAXIMUM_POSTITNOTES = 200; public static int HAND_ITEM_TIME = 10; public static int IDLE_CYCLES = 240; public static int IDLE_CYCLES_KICK = 480; @@ -427,6 +422,7 @@ public class Room implements Comparable, ISerialize, Runnable { if (this.itemCount() > Room.MAXIMUM_FURNI) { Emulator.getLogging().logErrorLine("Room ID: " + this.getId() + " has exceeded the furniture limit (" + this.itemCount() + " > " + Room.MAXIMUM_FURNI + ")."); } + } private synchronized void loadWiredData(Connection connection) { @@ -2556,6 +2552,25 @@ public class Room implements Comparable, ISerialize, Runnable { } + public THashSet getPostItNotes() { + THashSet items = new THashSet<>(); + TIntObjectIterator iterator = this.roomItems.iterator(); + + for (int i = this.roomItems.size(); i-- > 0; ) { + try { + iterator.advance(); + } catch (Exception e) { + break; + } + + if (iterator.value().getBaseItem().getInteractionType().getType() == InteractionPostIt.class) + items.add(iterator.value()); + } + + return items; + + } + public void addHabbo(Habbo habbo) { synchronized (this.roomUnitLock) { habbo.getRoomUnit().setId(this.unitCounter); @@ -4340,6 +4355,8 @@ public class Room implements Comparable, ISerialize, Runnable { return FurnitureMovementError.MAX_ITEMS; } + + rotation %= 8; if (this.hasRights(habbo) || this.guildRightLevel(habbo) >= 2 || habbo.hasPermission(Permission.ACC_MOVEROTATE)) { return FurnitureMovementError.NONE; diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItPlaceEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItPlaceEvent.java index 45713d4f..67f1d202 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItPlaceEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItPlaceEvent.java @@ -4,9 +4,12 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.achievements.AchievementManager; import com.eu.habbo.habbohotel.items.interactions.InteractionPostIt; import com.eu.habbo.habbohotel.items.interactions.InteractionStickyPole; +import com.eu.habbo.habbohotel.rooms.FurnitureMovementError; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.incoming.MessageHandler; +import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer; +import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys; import com.eu.habbo.messages.outgoing.inventory.RemoveHabboItemComposer; import com.eu.habbo.messages.outgoing.rooms.items.AddWallItemComposer; @@ -23,21 +26,27 @@ public class PostItPlaceEvent extends MessageHandler { HabboItem item = this.client.getHabbo().getInventory().getItemsComponent().getHabboItem(itemId); if (item instanceof InteractionPostIt) { - room.addHabboItem(item); - item.setExtradata("FFFF33"); - item.setRoomId(this.client.getHabbo().getHabboInfo().getCurrentRoom().getId()); - item.setWallPosition(location); - item.setUserId(this.client.getHabbo().getHabboInfo().getId()); - item.needsUpdate(true); - room.sendComposer(new AddWallItemComposer(item, this.client.getHabbo().getHabboInfo().getUsername()).compose()); - this.client.getHabbo().getInventory().getItemsComponent().removeHabboItem(item); - this.client.sendResponse(new RemoveHabboItemComposer(item.getGiftAdjustedId())); - item.setFromGift(false); - Emulator.getThreading().run(item); + if (room.getPostItNotes().size() < Room.MAXIMUM_POSTITNOTES) { + room.addHabboItem(item); + item.setExtradata("FFFF33"); + item.setRoomId(this.client.getHabbo().getHabboInfo().getCurrentRoom().getId()); + item.setWallPosition(location); + item.setUserId(this.client.getHabbo().getHabboInfo().getId()); + item.needsUpdate(true); + room.sendComposer(new AddWallItemComposer(item, this.client.getHabbo().getHabboInfo().getUsername()).compose()); + this.client.getHabbo().getInventory().getItemsComponent().removeHabboItem(item); + this.client.sendResponse(new RemoveHabboItemComposer(item.getGiftAdjustedId())); + item.setFromGift(false); + Emulator.getThreading().run(item); - if (room.getOwnerId() != this.client.getHabbo().getHabboInfo().getId()) { - AchievementManager.progressAchievement(room.getOwnerId(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("NotesReceived")); - AchievementManager.progressAchievement(this.client.getHabbo().getHabboInfo().getId(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("NotesLeft")); + if (room.getOwnerId() != this.client.getHabbo().getHabboInfo().getId()) { + AchievementManager.progressAchievement(room.getOwnerId(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("NotesReceived")); + AchievementManager.progressAchievement(this.client.getHabbo().getHabboInfo().getId(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("NotesLeft")); + } + + } + else { + this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.key, FurnitureMovementError.MAX_STICKIES.errorCode)); } //this.client.sendResponse(new PostItStickyPoleOpenComposer(item)); diff --git a/src/main/java/com/eu/habbo/plugin/PluginManager.java b/src/main/java/com/eu/habbo/plugin/PluginManager.java index 7edf9579..562df384 100644 --- a/src/main/java/com/eu/habbo/plugin/PluginManager.java +++ b/src/main/java/com/eu/habbo/plugin/PluginManager.java @@ -91,6 +91,7 @@ public class PluginManager { Room.MAXIMUM_BOTS = Emulator.getConfig().getInt("hotel.max.bots.room"); Room.MAXIMUM_PETS = Emulator.getConfig().getInt("hotel.pets.max.room"); Room.MAXIMUM_FURNI = Emulator.getConfig().getInt("hotel.room.furni.max", 2500); + Room.MAXIMUM_POSTITNOTES = Emulator.getConfig().getInt("hotel.room.stickies.max", 200); Room.HAND_ITEM_TIME = Emulator.getConfig().getInt("hotel.rooms.handitem.time"); Room.IDLE_CYCLES = Emulator.getConfig().getInt("hotel.roomuser.idle.cycles", 240); Room.IDLE_CYCLES_KICK = Emulator.getConfig().getInt("hotel.roomuser.idle.cycles.kick", 480); From bd21fd9096a717eedc30716bf7437be126f5c632 Mon Sep 17 00:00:00 2001 From: Thijmen Stavenuiter Date: Sat, 25 Apr 2020 11:04:48 +0200 Subject: [PATCH 017/215] Builder config for Project Dobby --- .gitlab-ci.yml | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a0cacc72..f443c3ff 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,10 +1,15 @@ image: maven:latest +stages: + - build + - deploy + cache: paths: - target/ build: + stage: build script: - mvn package only: @@ -12,4 +17,33 @@ build: - master artifacts: paths: - - target/Habbo-*.jar \ No newline at end of file + - target/Habbo-*.jar + + +.notify_builder: ¬ify_builder + stage: deploy + trigger: + project: project-dobby/builder + strategy: depend + + +notify_deploy_release: + <<: *notify_builder + variables: + UPSTREAM_DECISION: "tag" + UPSTREAM_COMMIT_SHA: $CI_COMMIT_SHA + UPSTREAM_PROJECT: $CI_PROJECT_PATH + UPSTREAM_BRANCH: $CI_COMMIT_TAG + only: + - tags + +notify_deploy_dev: + <<: *notify_builder + variables: + UPSTREAM_DECISION: "dev" + UPSTREAM_COMMIT_SHA: $CI_COMMIT_SHA + UPSTREAM_PROJECT: $CI_PROJECT_PATH + UPSTREAM_BRANCH: "dev" + only: + - dev + \ No newline at end of file From 6120285d9b692e867d067ec5b47822d26853e0d8 Mon Sep 17 00:00:00 2001 From: David Silva Date: Mon, 27 Apr 2020 01:53:59 +0200 Subject: [PATCH 018/215] fix(Room): allow magictile to be moved under user/pets/bots --- src/main/java/com/eu/habbo/habbohotel/rooms/Room.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 3d3e4893..dd6597d4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -4497,9 +4497,9 @@ public class Room implements Comparable, ISerialize, Runnable { HabboItem tileTopItem = this.getTopItemAt(t.x, t.y); if (!magicTile && ((tileTopItem != null && tileTopItem != item ? (t.state.equals(RoomTileState.INVALID) || !t.getAllowStack() || !tileTopItem.getBaseItem().allowStack()) : this.calculateTileState(t, item).equals(RoomTileState.INVALID)))) return FurnitureMovementError.CANT_STACK; - if (this.hasHabbosAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_HABBOS; - if (this.hasBotsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_BOTS; - if (this.hasPetsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_PETS; + if (!magicTile && this.hasHabbosAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_HABBOS; + if (!magicTile && this.hasBotsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_BOTS; + if (!magicTile && this.hasPetsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_PETS; } } From fed9d2a61486ab449cbae9cbded875e894780156 Mon Sep 17 00:00:00 2001 From: David Silva Date: Mon, 27 Apr 2020 03:34:57 +0200 Subject: [PATCH 019/215] fix(MonsterplantPet): rare seed should be rare --- .../pets/InteractionMonsterPlantSeed.java | 12 ++++++++++++ .../habbo/habbohotel/pets/MonsterplantPet.java | 16 ++++++++-------- .../com/eu/habbo/habbohotel/pets/PetManager.java | 15 +++++++++------ .../rooms/items/ToggleFloorItemEvent.java | 9 +++++++-- 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionMonsterPlantSeed.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionMonsterPlantSeed.java index 8bbe249c..cbd2ea22 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionMonsterPlantSeed.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionMonsterPlantSeed.java @@ -30,6 +30,18 @@ public class InteractionMonsterPlantSeed extends HabboItem { } } + public static int randomGoldenRarityLevel() { + int number = Emulator.getRandom().nextInt(66); + int count = 0; + for (int i = 8; i < 11; i++) { + count += 11 - i; + if (number <= count) { + return i; + } + } + return 10; + } + public static int randomRarityLevel() { int number = Emulator.getRandom().nextInt(66); int count = 0; diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java b/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java index 19bb4181..88b98991 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java @@ -26,32 +26,32 @@ public class MonsterplantPet extends Pet implements IPetLook { public static final Map> bodyRarity = new LinkedHashMap>() { { this.put(1, new Pair<>("Blungon", 0)); - this.put(5, new Pair<>("Squarg", 0)); this.put(2, new Pair<>("Wailzor", 1)); this.put(3, new Pair<>("Stumpy", 1)); this.put(4, new Pair<>("Sunspike", 2)); - this.put(9, new Pair<>("Weggylum", 2)); + this.put(5, new Pair<>("Squarg", 0)); this.put(6, new Pair<>("Shroomer", 3)); this.put(7, new Pair<>("Zuchinu", 3)); + this.put(8, new Pair<>("Abysswirl", 5)); + this.put(9, new Pair<>("Weggylum", 2)); this.put(10, new Pair<>("Wystique", 4)); this.put(11, new Pair<>("Hairbullis", 4)); - this.put(8, new Pair<>("Abysswirl", 5)); this.put(12, new Pair<>("Snozzle", 5)); //Rarity??? } }; public static final Map> colorRarity = new LinkedHashMap>() { { this.put(0, new Pair<>("Aenueus", 0)); - this.put(9, new Pair<>("Fulvus", 0)); this.put(1, new Pair<>("Griseus", 1)); - this.put(3, new Pair<>("Viridulus", 1)); this.put(2, new Pair<>("Phoenicus", 2)); + this.put(3, new Pair<>("Viridulus", 1)); + this.put(4, new Pair<>("Cyaneus", 5)); this.put(5, new Pair<>("Incarnatus", 2)); - this.put(8, new Pair<>("Amethyst", 3)); - this.put(10, new Pair<>("Cinereus", 3)); this.put(6, new Pair<>("Azureus", 4)); this.put(7, new Pair<>("Atamasc", 4)); - this.put(4, new Pair<>("Cyaneus", 5)); + this.put(8, new Pair<>("Amethyst", 3)); + this.put(9, new Pair<>("Fulvus", 0)); + this.put(10, new Pair<>("Cinereus", 3)); } }; public static final ArrayList> indexedBody = new ArrayList<>(MonsterplantPet.bodyRarity.values()); diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java b/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java index 7335963d..981dfffd 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java @@ -19,6 +19,7 @@ import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.procedure.TIntObjectProcedure; import gnu.trove.set.hash.THashSet; import org.apache.commons.math3.distribution.NormalDistribution; +import org.apache.commons.math3.util.Pair; import java.sql.*; import java.util.ArrayList; @@ -101,13 +102,15 @@ public class PetManager { return 100 * level; } - public static int randomBody(int minimumRarity) { - int randomRarity = random(Math.max(minimumRarity - 1, 0), MonsterplantPet.bodyRarity.size(), 2.0); + public static int randomBody(int minimumRarity, boolean isRare) { + int randomRarity = isRare ? random(Math.max(minimumRarity - 1, 0), (MonsterplantPet.bodyRarity.size() - minimumRarity) + (minimumRarity - 1), 2.0) : random(Math.max(minimumRarity - 1, 0), MonsterplantPet.bodyRarity.size(), 2.0); + return MonsterplantPet.bodyRarity.get(MonsterplantPet.bodyRarity.keySet().toArray()[randomRarity]).getValue(); } - public static int randomColor(int minimumRarity) { - int randomRarity = random(Math.max(minimumRarity - 1, 0), MonsterplantPet.colorRarity.size(), 2.0); + public static int randomColor(int minimumRarity, boolean isRare) { + int randomRarity = isRare ? random(Math.max(minimumRarity - 1, 0), (MonsterplantPet.colorRarity.size() - minimumRarity) + (minimumRarity - 1), 2.0) : random(Math.max(minimumRarity - 1, 0), MonsterplantPet.colorRarity.size(), 2.0); + return MonsterplantPet.colorRarity.get(MonsterplantPet.colorRarity.keySet().toArray()[randomRarity]).getValue(); } @@ -426,8 +429,8 @@ public class PetManager { public MonsterplantPet createMonsterplant(Room room, Habbo habbo, boolean rare, RoomTile t, int minimumRarity) { MonsterplantPet pet = new MonsterplantPet( habbo.getHabboInfo().getId(), //Owner ID - randomBody(rare ? 4 : minimumRarity), - randomColor(rare ? 4 : minimumRarity), + randomBody(minimumRarity, rare), + randomColor(minimumRarity, rare), Emulator.getRandom().nextInt(12) + 1, Emulator.getRandom().nextInt(11), Emulator.getRandom().nextInt(12) + 1, diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/ToggleFloorItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/ToggleFloorItemEvent.java index e9e04c73..0ad6804a 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/ToggleFloorItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/ToggleFloorItemEvent.java @@ -81,14 +81,19 @@ public class ToggleFloorItemEvent extends MessageHandler { if (item instanceof InteractionMonsterPlantSeed) { Emulator.getThreading().run(new QueryDeleteHabboItem(item.getId())); int rarity = 0; - if (item.getExtradata().isEmpty()) rarity = InteractionMonsterPlantSeed.randomRarityLevel(); + + boolean isRare = item.getBaseItem().getName().contains("rare"); + + if ((!item.getExtradata().isEmpty() && Integer.valueOf(item.getExtradata()) - 1 < 0) || item.getExtradata().isEmpty()) { + rarity = isRare ? InteractionMonsterPlantSeed.randomGoldenRarityLevel() : InteractionMonsterPlantSeed.randomRarityLevel(); + } else { try { rarity = Integer.valueOf(item.getExtradata()) - 1; } catch (Exception e) { } } - MonsterplantPet pet = Emulator.getGameEnvironment().getPetManager().createMonsterplant(room, this.client.getHabbo(), item.getBaseItem().getName().contains("rare"), room.getLayout().getTile(item.getX(), item.getY()), rarity); + MonsterplantPet pet = Emulator.getGameEnvironment().getPetManager().createMonsterplant(room, this.client.getHabbo(), isRare, room.getLayout().getTile(item.getX(), item.getY()), rarity); room.sendComposer(new RemoveFloorItemComposer(item, true).compose()); room.removeHabboItem(item); room.updateTile(room.getLayout().getTile(item.getX(), item.getY())); From 0f16d9aa42d99e2b0870baf1b95ed641433f562a Mon Sep 17 00:00:00 2001 From: David Silva Date: Tue, 28 Apr 2020 00:35:13 +0200 Subject: [PATCH 020/215] fix(RequestUserDataEvent): patch auto redirect when nux is done --- .../habbo/messages/incoming/users/RequestUserDataEvent.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/users/RequestUserDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/users/RequestUserDataEvent.java index 56f75a1b..174f5ef1 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/users/RequestUserDataEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/users/RequestUserDataEvent.java @@ -39,9 +39,9 @@ public class RequestUserDataEvent extends MessageHandler { messages.add(new UserDataComposer(this.client.getHabbo()).compose()); messages.add(new UserPerksComposer(this.client.getHabbo()).compose()); - if (this.client.getHabbo().getHabboInfo().getHomeRoom() != 0) + if (!this.client.getHabbo().getHabboStats().nux && this.client.getHabbo().getHabboInfo().getHomeRoom() != 0) messages.add(new ForwardToRoomComposer(this.client.getHabbo().getHabboInfo().getHomeRoom()).compose()); - else if (RoomManager.HOME_ROOM_ID > 0) + else if (!this.client.getHabbo().getHabboStats().nux && RoomManager.HOME_ROOM_ID > 0) messages.add(new ForwardToRoomComposer(RoomManager.HOME_ROOM_ID).compose()); messages.add(new MeMenuSettingsComposer(this.client.getHabbo()).compose()); From f7539f0aae02250407c26b8f33d31f424b1381af Mon Sep 17 00:00:00 2001 From: David Silva Date: Tue, 28 Apr 2020 01:16:56 +0200 Subject: [PATCH 021/215] feat(HabboStats): update last catalogue purchase --- sqlupdates/2_3_1_TO_2_4_0-RC-1.sql | 2 ++ .../eu/habbo/habbohotel/catalog/CatalogManager.java | 2 ++ .../java/com/eu/habbo/habbohotel/users/HabboStats.java | 10 +++++++--- .../messages/incoming/catalog/CatalogBuyItemEvent.java | 2 ++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/sqlupdates/2_3_1_TO_2_4_0-RC-1.sql b/sqlupdates/2_3_1_TO_2_4_0-RC-1.sql index bee4dbe3..8727e26a 100644 --- a/sqlupdates/2_3_1_TO_2_4_0-RC-1.sql +++ b/sqlupdates/2_3_1_TO_2_4_0-RC-1.sql @@ -1 +1,3 @@ INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.room.stickies.max', '200'); + +ALTER TABLE `users_settings` ADD COLUMN `last_purchase_timestamp` int(11) NOT NULL DEFAULT UNIX_TIMESTAMP(); \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java index 009b0828..bcb5a67c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java @@ -1124,6 +1124,8 @@ public class CatalogManager { habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); } } finally { + habbo.getHabboStats().lastPurchaseTimestamp = Emulator.getIntUnixTimestamp(); + habbo.getHabboStats().run(); habbo.getHabboStats().isPurchasingFurniture = false; } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java index 7373b749..5e84e5cb 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java @@ -78,7 +78,7 @@ public class HabboStats implements Runnable { public int forumPostsCount; public THashMap> ltdPurchaseLog = new THashMap<>(0); public long lastTradeTimestamp = Emulator.getIntUnixTimestamp(); - public long lastPurchaseTimestamp = Emulator.getIntUnixTimestamp(); + public int lastPurchaseTimestamp; public long lastGiftTimestamp = Emulator.getIntUnixTimestamp(); public int uiFlags; public boolean hasGottenDefaultSavedSearches; @@ -135,6 +135,8 @@ public class HabboStats implements Runnable { this.forumPostsCount = set.getInt("forums_post_count"); this.uiFlags = set.getInt("ui_flags"); this.hasGottenDefaultSavedSearches = set.getInt("has_gotten_default_saved_searches") == 1; + this.lastPurchaseTimestamp = set.getInt("last_purchase_timestamp"); + this.nuxReward = this.nux; try (PreparedStatement statement = set.getStatement().getConnection().prepareStatement("SELECT * FROM user_window_settings WHERE user_id = ? LIMIT 1")) { @@ -294,7 +296,7 @@ public class HabboStats implements Runnable { @Override public void run() { try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) { - try (PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET achievement_score = ?, respects_received = ?, respects_given = ?, daily_respect_points = ?, block_following = ?, block_friendrequests = ?, online_time = online_time + ?, guild_id = ?, daily_pet_respect_points = ?, club_expire_timestamp = ?, login_streak = ?, rent_space_id = ?, rent_space_endtime = ?, volume_system = ?, volume_furni = ?, volume_trax = ?, block_roominvites = ?, old_chat = ?, block_camera_follow = ?, chat_color = ?, hof_points = ?, block_alerts = ?, talent_track_citizenship_level = ?, talent_track_helpers_level = ?, ignore_bots = ?, ignore_pets = ?, nux = ?, mute_end_timestamp = ?, allow_name_change = ?, perk_trade = ?, can_trade = ?, `forums_post_count` = ?, ui_flags = ?, has_gotten_default_saved_searches = ? WHERE user_id = ? LIMIT 1")) { + try (PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET achievement_score = ?, respects_received = ?, respects_given = ?, daily_respect_points = ?, block_following = ?, block_friendrequests = ?, online_time = online_time + ?, guild_id = ?, daily_pet_respect_points = ?, club_expire_timestamp = ?, login_streak = ?, rent_space_id = ?, rent_space_endtime = ?, volume_system = ?, volume_furni = ?, volume_trax = ?, block_roominvites = ?, old_chat = ?, block_camera_follow = ?, chat_color = ?, hof_points = ?, block_alerts = ?, talent_track_citizenship_level = ?, talent_track_helpers_level = ?, ignore_bots = ?, ignore_pets = ?, nux = ?, mute_end_timestamp = ?, allow_name_change = ?, perk_trade = ?, can_trade = ?, `forums_post_count` = ?, ui_flags = ?, has_gotten_default_saved_searches = ?, last_purchase_timestamp = ? WHERE user_id = ? LIMIT 1")) { statement.setInt(1, this.achievementScore); statement.setInt(2, this.respectPointsReceived); statement.setInt(3, this.respectPointsGiven); @@ -329,8 +331,10 @@ public class HabboStats implements Runnable { statement.setInt(32, this.forumPostsCount); statement.setInt(33, this.uiFlags); statement.setInt(34, this.hasGottenDefaultSavedSearches ? 1 : 0); + statement.setInt(35, this.lastPurchaseTimestamp); - statement.setInt(35, this.habboInfo.getId()); + statement.setInt(36, this.habboInfo.getId()); + statement.executeUpdate(); } diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java index 67a89975..f7cc5ad7 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java @@ -177,6 +177,8 @@ public class CatalogBuyItemEvent extends MessageHandler { this.client.sendResponse(new PurchaseOKComposer(null)); this.client.sendResponse(new InventoryRefreshComposer()); + + this.client.getHabbo().getHabboStats().lastPurchaseTimestamp = Emulator.getIntUnixTimestamp(); this.client.getHabbo().getHabboStats().run(); } return; From 97f163be4506959f26dddd904020a2da7824cd56 Mon Sep 17 00:00:00 2001 From: David Silva Date: Tue, 28 Apr 2020 02:56:28 +0200 Subject: [PATCH 022/215] chore(.gitignore): ignore stupid file on mac --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 04b8b762..54f0682d 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,6 @@ config.ini *.txt *.jar *.log -*.zip \ No newline at end of file +*.zip +.DS_Store + From 8f5b55c9d76617e43edf9ebea7fea680f63ac77e Mon Sep 17 00:00:00 2001 From: David Silva Date: Wed, 29 Apr 2020 05:18:11 -0400 Subject: [PATCH 023/215] fix(ChannelReadHandler): patch vuln --- .../runnables/ChannelReadHandler.java | 64 +++++++++++++------ 1 file changed, 44 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/eu/habbo/threading/runnables/ChannelReadHandler.java b/src/main/java/com/eu/habbo/threading/runnables/ChannelReadHandler.java index f21cbea6..59ccd39a 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/ChannelReadHandler.java +++ b/src/main/java/com/eu/habbo/threading/runnables/ChannelReadHandler.java @@ -11,6 +11,7 @@ import io.netty.channel.ChannelHandlerContext; public class ChannelReadHandler implements Runnable { private final ChannelHandlerContext ctx; private final Object msg; + //private int _header; public ChannelReadHandler(ChannelHandlerContext ctx, Object msg) { this.ctx = ctx; @@ -18,29 +19,52 @@ public class ChannelReadHandler implements Runnable { } public void run() { - ByteBuf m = (ByteBuf) this.msg; - int length = m.readInt(); - short header = m.readShort(); - GameClient client = this.ctx.channel().attr(GameClientManager.CLIENT).get(); + try { + ByteBuf m = (ByteBuf) this.msg; + int length = m.readInt(); + short header = m.readShort(); + //_header = header; + GameClient client = this.ctx.channel().attr(GameClientManager.CLIENT).get(); - if (client != null) { - int count = 0; - int timestamp = Emulator.getIntUnixTimestamp(); - if (timestamp - client.lastPacketCounterCleared > 1) { - client.incomingPacketCounter.clear(); - client.lastPacketCounterCleared = timestamp; - } else { - count = client.incomingPacketCounter.getOrDefault(header, 0); + if (m.readableBytes() + 2 < length) { + return; } - if (count <= 10) { - count++; - client.incomingPacketCounter.put((int) header, count); - ByteBuf body = Unpooled.wrappedBuffer(m.readBytes(m.readableBytes())); - Emulator.getGameServer().getPacketManager().handlePacket(client, new ClientMessage(header, body)); - body.release(); + if (client != null) { + int count = 0; + int timestamp = Emulator.getIntUnixTimestamp(); + if (timestamp - client.lastPacketCounterCleared > 1) { + client.incomingPacketCounter.clear(); + client.lastPacketCounterCleared = timestamp; + } else { + if (m.readableBytes() + 2 < length) { + m.resetReaderIndex(); + client.incomingPacketCounter.put((int) header, 0); + count = 0; + return; + } else { + count = client.incomingPacketCounter.getOrDefault(header, 0); + } + } + + if (count <= 10) { + count++; + if (m.readableBytes() + 2 < length) { + m.resetReaderIndex(); + client.incomingPacketCounter.put((int) header, 0); + count = 0; + return; + } + client.incomingPacketCounter.put((int) header, count); + ByteBuf body = Unpooled.wrappedBuffer(m.readBytes(m.readableBytes())); + Emulator.getGameServer().getPacketManager().handlePacket(client, new ClientMessage(header, body)); + body.release(); + } } + + m.release(); + } catch (Exception e) { + //System.out.println("Potential packet overflow occurring, careful! header: " + _header + e.getMessage()); } - m.release(); } -} \ No newline at end of file +} From 7503275af7aac5fe845d7a355f69487dab543d55 Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Wed, 29 Apr 2020 10:53:30 +0100 Subject: [PATCH 024/215] NPE and Typo Fix for WiredEffectTriggerStacks. --- .../interactions/wired/effects/WiredEffectTriggerStacks.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java index dd136015..41a38dd8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java @@ -102,7 +102,8 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect { @Override public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - if (stuff == null && stuff.length >= 1 && stuff[stuff.length - 1] instanceof WiredEffectTriggerStacks) { + + if (stuff == null || (stuff.length >= 1 && stuff[stuff.length - 1] instanceof WiredEffectTriggerStacks)) { return false; } From 3695f4e7019a021959ec821ac37adcf011fc3644 Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Wed, 29 Apr 2020 20:40:56 +0100 Subject: [PATCH 025/215] Add homeroom config to make it work like how retros are used to. --- sqlupdates/2_3_1_TO_2_4_0-RC-1.sql | 4 +++- .../habbo/messages/incoming/users/RequestUserDataEvent.java | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sqlupdates/2_3_1_TO_2_4_0-RC-1.sql b/sqlupdates/2_3_1_TO_2_4_0-RC-1.sql index 8727e26a..561df6ff 100644 --- a/sqlupdates/2_3_1_TO_2_4_0-RC-1.sql +++ b/sqlupdates/2_3_1_TO_2_4_0-RC-1.sql @@ -1,3 +1,5 @@ INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.room.stickies.max', '200'); -ALTER TABLE `users_settings` ADD COLUMN `last_purchase_timestamp` int(11) NOT NULL DEFAULT UNIX_TIMESTAMP(); \ No newline at end of file +ALTER TABLE `users_settings` ADD COLUMN `last_purchase_timestamp` int(11) NOT NULL DEFAULT UNIX_TIMESTAMP(); + +INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('retro.style.homeroom', '1'); diff --git a/src/main/java/com/eu/habbo/messages/incoming/users/RequestUserDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/users/RequestUserDataEvent.java index 174f5ef1..01f1f1af 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/users/RequestUserDataEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/users/RequestUserDataEvent.java @@ -39,9 +39,9 @@ public class RequestUserDataEvent extends MessageHandler { messages.add(new UserDataComposer(this.client.getHabbo()).compose()); messages.add(new UserPerksComposer(this.client.getHabbo()).compose()); - if (!this.client.getHabbo().getHabboStats().nux && this.client.getHabbo().getHabboInfo().getHomeRoom() != 0) + if (!this.client.getHabbo().getHabboStats().nux || Emulator.getConfig().getBoolean("retro.style.homeroom") && this.client.getHabbo().getHabboInfo().getHomeRoom() != 0) messages.add(new ForwardToRoomComposer(this.client.getHabbo().getHabboInfo().getHomeRoom()).compose()); - else if (!this.client.getHabbo().getHabboStats().nux && RoomManager.HOME_ROOM_ID > 0) + else if (!this.client.getHabbo().getHabboStats().nux || Emulator.getConfig().getBoolean("retro.style.homeroom") && RoomManager.HOME_ROOM_ID > 0) messages.add(new ForwardToRoomComposer(RoomManager.HOME_ROOM_ID).compose()); messages.add(new MeMenuSettingsComposer(this.client.getHabbo()).compose()); From 4c16c25508b5aae7627f775a680da5ee1fa87d16 Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Wed, 29 Apr 2020 22:57:26 +0100 Subject: [PATCH 026/215] Temp patch to CatalogBuyItemEvent --- .../incoming/catalog/CatalogBuyItemEvent.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java index f7cc5ad7..f3a4a8d5 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java @@ -5,10 +5,7 @@ import com.eu.habbo.habbohotel.catalog.CatalogItem; import com.eu.habbo.habbohotel.catalog.CatalogManager; import com.eu.habbo.habbohotel.catalog.CatalogPage; import com.eu.habbo.habbohotel.catalog.ClubOffer; -import com.eu.habbo.habbohotel.catalog.layouts.ClubBuyLayout; -import com.eu.habbo.habbohotel.catalog.layouts.RecentPurchasesLayout; -import com.eu.habbo.habbohotel.catalog.layouts.RoomBundleLayout; -import com.eu.habbo.habbohotel.catalog.layouts.VipBuyLayout; +import com.eu.habbo.habbohotel.catalog.layouts.*; import com.eu.habbo.habbohotel.items.FurnitureType; import com.eu.habbo.habbohotel.users.HabboBadge; import com.eu.habbo.habbohotel.users.HabboInventory; @@ -24,6 +21,7 @@ import com.eu.habbo.messages.outgoing.users.*; import com.eu.habbo.threading.runnables.ShutdownEmulator; import gnu.trove.map.hash.THashMap; import gnu.trove.procedure.TObjectProcedure; +import org.apache.commons.lang3.StringUtils; public class CatalogBuyItemEvent extends MessageHandler { @Override @@ -190,7 +188,14 @@ public class CatalogBuyItemEvent extends MessageHandler { item = this.client.getHabbo().getHabboStats().getRecentPurchases().get(itemId); else item = page.getCatalogItem(itemId); - + + // temp patch, can a dev with better knowledge than me look into this asap pls. + if (page instanceof PetsLayout) { + String check = extraData.replace("\n", ""); + if (!StringUtils.isAlphanumeric(check)) { + return; + } + } Emulator.getGameEnvironment().getCatalogManager().purchaseItem(page, item, this.client.getHabbo(), count, extraData, false); } else { From 958c6a6c15be01c85429bb83dff9d6493b805bf3 Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Wed, 29 Apr 2020 23:22:43 +0100 Subject: [PATCH 027/215] Updated patch to CatalogBuyItemEvent. --- .../incoming/catalog/CatalogBuyItemEvent.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java index f3a4a8d5..cb706455 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java @@ -188,12 +188,14 @@ public class CatalogBuyItemEvent extends MessageHandler { item = this.client.getHabbo().getHabboStats().getRecentPurchases().get(itemId); else item = page.getCatalogItem(itemId); - + // temp patch, can a dev with better knowledge than me look into this asap pls. - if (page instanceof PetsLayout) { - String check = extraData.replace("\n", ""); - if (!StringUtils.isAlphanumeric(check)) { - return; + if (page instanceof PetsLayout) { // checks it's the petlayout + String[] check = extraData.split("\n"); // splits the extradata + if (check.length != 3) return; // checks if there's 3 parts (always is with pets, if not it fucks them off) + String petName = check[0]; // gets the pet name + if (!StringUtils.isAlphanumeric(petName)) { // checks the data to see if it has any nasties. + return; // if it does it fucks off. } } Emulator.getGameEnvironment().getCatalogManager().purchaseItem(page, item, this.client.getHabbo(), count, extraData, false); From f9642879e2b359d1ad8bb5db8b07deeb4cfcaa4c Mon Sep 17 00:00:00 2001 From: Harmonic Date: Wed, 29 Apr 2020 18:34:11 -0400 Subject: [PATCH 028/215] Revert "Updated patch to CatalogBuyItemEvent." This reverts commit 958c6a6c15be01c85429bb83dff9d6493b805bf3 --- .../incoming/catalog/CatalogBuyItemEvent.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java index cb706455..f3a4a8d5 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java @@ -188,14 +188,12 @@ public class CatalogBuyItemEvent extends MessageHandler { item = this.client.getHabbo().getHabboStats().getRecentPurchases().get(itemId); else item = page.getCatalogItem(itemId); - + // temp patch, can a dev with better knowledge than me look into this asap pls. - if (page instanceof PetsLayout) { // checks it's the petlayout - String[] check = extraData.split("\n"); // splits the extradata - if (check.length != 3) return; // checks if there's 3 parts (always is with pets, if not it fucks them off) - String petName = check[0]; // gets the pet name - if (!StringUtils.isAlphanumeric(petName)) { // checks the data to see if it has any nasties. - return; // if it does it fucks off. + if (page instanceof PetsLayout) { + String check = extraData.replace("\n", ""); + if (!StringUtils.isAlphanumeric(check)) { + return; } } Emulator.getGameEnvironment().getCatalogManager().purchaseItem(page, item, this.client.getHabbo(), count, extraData, false); From 4a84258f3e433e488c9bcdd49cc586cf7f530d75 Mon Sep 17 00:00:00 2001 From: Harmonic Date: Wed, 29 Apr 2020 18:34:21 -0400 Subject: [PATCH 029/215] Revert "Temp patch to CatalogBuyItemEvent" This reverts commit 4c16c25508b5aae7627f775a680da5ee1fa87d16 --- .../incoming/catalog/CatalogBuyItemEvent.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java index f3a4a8d5..f7cc5ad7 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java @@ -5,7 +5,10 @@ import com.eu.habbo.habbohotel.catalog.CatalogItem; import com.eu.habbo.habbohotel.catalog.CatalogManager; import com.eu.habbo.habbohotel.catalog.CatalogPage; import com.eu.habbo.habbohotel.catalog.ClubOffer; -import com.eu.habbo.habbohotel.catalog.layouts.*; +import com.eu.habbo.habbohotel.catalog.layouts.ClubBuyLayout; +import com.eu.habbo.habbohotel.catalog.layouts.RecentPurchasesLayout; +import com.eu.habbo.habbohotel.catalog.layouts.RoomBundleLayout; +import com.eu.habbo.habbohotel.catalog.layouts.VipBuyLayout; import com.eu.habbo.habbohotel.items.FurnitureType; import com.eu.habbo.habbohotel.users.HabboBadge; import com.eu.habbo.habbohotel.users.HabboInventory; @@ -21,7 +24,6 @@ import com.eu.habbo.messages.outgoing.users.*; import com.eu.habbo.threading.runnables.ShutdownEmulator; import gnu.trove.map.hash.THashMap; import gnu.trove.procedure.TObjectProcedure; -import org.apache.commons.lang3.StringUtils; public class CatalogBuyItemEvent extends MessageHandler { @Override @@ -188,14 +190,7 @@ public class CatalogBuyItemEvent extends MessageHandler { item = this.client.getHabbo().getHabboStats().getRecentPurchases().get(itemId); else item = page.getCatalogItem(itemId); - - // temp patch, can a dev with better knowledge than me look into this asap pls. - if (page instanceof PetsLayout) { - String check = extraData.replace("\n", ""); - if (!StringUtils.isAlphanumeric(check)) { - return; - } - } + Emulator.getGameEnvironment().getCatalogManager().purchaseItem(page, item, this.client.getHabbo(), count, extraData, false); } else { From 1765e337a2f5e57c698c5cb44c99f6c2caf7dad6 Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Wed, 29 Apr 2020 23:46:00 +0100 Subject: [PATCH 030/215] Fix pet name exploit. --- .../incoming/catalog/CatalogBuyItemEvent.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java index f7cc5ad7..15666b29 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java @@ -5,10 +5,7 @@ import com.eu.habbo.habbohotel.catalog.CatalogItem; import com.eu.habbo.habbohotel.catalog.CatalogManager; import com.eu.habbo.habbohotel.catalog.CatalogPage; import com.eu.habbo.habbohotel.catalog.ClubOffer; -import com.eu.habbo.habbohotel.catalog.layouts.ClubBuyLayout; -import com.eu.habbo.habbohotel.catalog.layouts.RecentPurchasesLayout; -import com.eu.habbo.habbohotel.catalog.layouts.RoomBundleLayout; -import com.eu.habbo.habbohotel.catalog.layouts.VipBuyLayout; +import com.eu.habbo.habbohotel.catalog.layouts.*; import com.eu.habbo.habbohotel.items.FurnitureType; import com.eu.habbo.habbohotel.users.HabboBadge; import com.eu.habbo.habbohotel.users.HabboInventory; @@ -24,6 +21,7 @@ import com.eu.habbo.messages.outgoing.users.*; import com.eu.habbo.threading.runnables.ShutdownEmulator; import gnu.trove.map.hash.THashMap; import gnu.trove.procedure.TObjectProcedure; +import org.apache.commons.lang3.StringUtils; public class CatalogBuyItemEvent extends MessageHandler { @Override @@ -188,8 +186,17 @@ public class CatalogBuyItemEvent extends MessageHandler { if (page instanceof RecentPurchasesLayout) item = this.client.getHabbo().getHabboStats().getRecentPurchases().get(itemId); + else item = page.getCatalogItem(itemId); + // temp patch, can a dev with better knowledge than me look into this asap pls. + if (page instanceof PetsLayout) { // checks it's the petlayout + String[] check = extraData.split("\n"); // splits the extradata + if (check.length != 3) return; // checks if there's 3 parts (always is with pets, if not it fucks them off) + if (!StringUtils.isAlphanumeric(check[0])) { // checks the data to see if it has any nasties. expected format is: name/0/COLORCODE + return; // if it does it fucks off. + } + } Emulator.getGameEnvironment().getCatalogManager().purchaseItem(page, item, this.client.getHabbo(), count, extraData, false); From a3f9d66fa5a4f0a000ef0b0b424d6f1794accc5b Mon Sep 17 00:00:00 2001 From: David Silva Date: Thu, 30 Apr 2020 03:28:09 +0200 Subject: [PATCH 031/215] fix(ModToolRoomInfoComposer): fix disconnect in pub rooms --- .../outgoing/modtool/ModToolRoomInfoComposer.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolRoomInfoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolRoomInfoComposer.java index 47792774..883b058d 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolRoomInfoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolRoomInfoComposer.java @@ -20,14 +20,12 @@ public class ModToolRoomInfoComposer extends MessageComposer { this.response.appendBoolean(this.room.getHabbo(this.room.getOwnerId()) != null); this.response.appendInt(this.room.getOwnerId()); this.response.appendString(this.room.getOwnerName()); - this.response.appendBoolean(!this.room.isPublicRoom()); - if (!this.room.isPublicRoom()) { - this.response.appendString(this.room.getName()); - this.response.appendString(this.room.getDescription()); - this.response.appendInt(this.room.getTags().split(";").length); - for (int i = 0; i < this.room.getTags().split(";").length; i++) { - this.response.appendString(this.room.getTags().split(";")[i]); - } + this.response.appendBoolean(this.room.isPublicRoom()); + this.response.appendString(this.room.getName()); + this.response.appendString(this.room.getDescription()); + this.response.appendInt(this.room.getTags().split(";").length); + for (int i = 0; i < this.room.getTags().split(";").length; i++) { + this.response.appendString(this.room.getTags().split(";")[i]); } return this.response; } From a71853d0c269b20fa259d67c4f192ffb0721af7d Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Thu, 30 Apr 2020 14:36:51 +0100 Subject: [PATCH 032/215] Cleanup pet exploit fix. --- .../messages/incoming/catalog/CatalogBuyItemEvent.java | 7 ++++--- .../habbo/messages/incoming/catalog/CheckPetNameEvent.java | 5 ++++- src/main/java/com/eu/habbo/plugin/PluginManager.java | 4 ++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java index 15666b29..6af3031a 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java @@ -23,6 +23,9 @@ import gnu.trove.map.hash.THashMap; import gnu.trove.procedure.TObjectProcedure; import org.apache.commons.lang3.StringUtils; +import static com.eu.habbo.messages.incoming.catalog.CheckPetNameEvent.PET_NAME_LENGTH_MAXIMUM; +import static com.eu.habbo.messages.incoming.catalog.CheckPetNameEvent.PET_NAME_LENGTH_MINIMUM; + public class CatalogBuyItemEvent extends MessageHandler { @Override public void handle() throws Exception { @@ -192,11 +195,9 @@ public class CatalogBuyItemEvent extends MessageHandler { // temp patch, can a dev with better knowledge than me look into this asap pls. if (page instanceof PetsLayout) { // checks it's the petlayout String[] check = extraData.split("\n"); // splits the extradata - if (check.length != 3) return; // checks if there's 3 parts (always is with pets, if not it fucks them off) - if (!StringUtils.isAlphanumeric(check[0])) { // checks the data to see if it has any nasties. expected format is: name/0/COLORCODE + if ((check.length != 3) || (check[0].length() < PET_NAME_LENGTH_MINIMUM) || (check[0].length() > PET_NAME_LENGTH_MAXIMUM) || (!StringUtils.isAlphanumeric(check[0])))// checks if there's 3 parts (always is with pets, if not it fucks them off) return; // if it does it fucks off. } - } Emulator.getGameEnvironment().getCatalogManager().purchaseItem(page, item, this.client.getHabbo(), count, extraData, false); diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CheckPetNameEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CheckPetNameEvent.java index d71897c5..cfa5dc2f 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CheckPetNameEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CheckPetNameEvent.java @@ -6,6 +6,9 @@ import com.eu.habbo.messages.outgoing.catalog.PetNameErrorComposer; import org.apache.commons.lang3.StringUtils; public class CheckPetNameEvent extends MessageHandler { + public static int PET_NAME_LENGTH_MINIMUM = Emulator.getConfig().getInt("hotel.pets.name.length.min"); + public static int PET_NAME_LENGTH_MAXIMUM = Emulator.getConfig().getInt("hotel.pets.name.length.max"); + @Override public void handle() throws Exception { String petName = this.packet.readString(); @@ -13,7 +16,7 @@ public class CheckPetNameEvent extends MessageHandler { int minLength = Emulator.getConfig().getInt("hotel.pets.name.length.min"); int maxLength = Emulator.getConfig().getInt("hotel.pets.name.length.max"); - if (petName.length() < minLength) { + if (petName.length() < PET_NAME_LENGTH_MINIMUM) { this.client.sendResponse(new PetNameErrorComposer(PetNameErrorComposer.NAME_TO_SHORT, minLength + "")); } else if (petName.length() > maxLength) { this.client.sendResponse(new PetNameErrorComposer(PetNameErrorComposer.NAME_TO_LONG, maxLength + "")); diff --git a/src/main/java/com/eu/habbo/plugin/PluginManager.java b/src/main/java/com/eu/habbo/plugin/PluginManager.java index 562df384..de5d991b 100644 --- a/src/main/java/com/eu/habbo/plugin/PluginManager.java +++ b/src/main/java/com/eu/habbo/plugin/PluginManager.java @@ -26,6 +26,7 @@ import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreManager; import com.eu.habbo.messages.PacketManager; import com.eu.habbo.messages.incoming.camera.CameraPublishToWebEvent; import com.eu.habbo.messages.incoming.camera.CameraPurchaseEvent; +import com.eu.habbo.messages.incoming.catalog.CheckPetNameEvent; import com.eu.habbo.messages.incoming.floorplaneditor.FloorPlanEditorSaveEvent; import com.eu.habbo.messages.incoming.hotelview.HotelViewRequestLTDAvailabilityEvent; import com.eu.habbo.messages.incoming.rooms.promotions.BuyRoomPromotionEvent; @@ -131,6 +132,9 @@ public class PluginManager { AchievementManager.TALENTTRACK_ENABLED = Emulator.getConfig().getBoolean("hotel.talenttrack.enabled"); InteractionRoller.NO_RULES = Emulator.getConfig().getBoolean("hotel.room.rollers.norules"); RoomManager.SHOW_PUBLIC_IN_POPULAR_TAB = Emulator.getConfig().getBoolean("hotel.navigator.populartab.publics"); + CheckPetNameEvent.PET_NAME_LENGTH_MINIMUM = Emulator.getConfig().getInt("hotel.pets.name.length.min"); + CheckPetNameEvent.PET_NAME_LENGTH_MAXIMUM = Emulator.getConfig().getInt("hotel.pets.name.length.max"); + ChangeNameCheckUsernameEvent.VALID_CHARACTERS = Emulator.getConfig().getValue("allowed.username.characters", "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_-=!?@:,."); CameraPublishToWebEvent.CAMERA_PUBLISH_POINTS = Emulator.getConfig().getInt("camera.price.points.publish", 5); From 649005cb904d470ad86764adb044df601a09128d Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Thu, 30 Apr 2020 14:37:42 +0100 Subject: [PATCH 033/215] Cleanup part 2. --- .../messages/incoming/catalog/CheckPetNameEvent.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CheckPetNameEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CheckPetNameEvent.java index cfa5dc2f..6b1726b4 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CheckPetNameEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CheckPetNameEvent.java @@ -13,13 +13,10 @@ public class CheckPetNameEvent extends MessageHandler { public void handle() throws Exception { String petName = this.packet.readString(); - int minLength = Emulator.getConfig().getInt("hotel.pets.name.length.min"); - int maxLength = Emulator.getConfig().getInt("hotel.pets.name.length.max"); - if (petName.length() < PET_NAME_LENGTH_MINIMUM) { - this.client.sendResponse(new PetNameErrorComposer(PetNameErrorComposer.NAME_TO_SHORT, minLength + "")); - } else if (petName.length() > maxLength) { - this.client.sendResponse(new PetNameErrorComposer(PetNameErrorComposer.NAME_TO_LONG, maxLength + "")); + this.client.sendResponse(new PetNameErrorComposer(PetNameErrorComposer.NAME_TO_SHORT, PET_NAME_LENGTH_MINIMUM + "")); + } else if (petName.length() > PET_NAME_LENGTH_MAXIMUM) { + this.client.sendResponse(new PetNameErrorComposer(PetNameErrorComposer.NAME_TO_LONG, PET_NAME_LENGTH_MAXIMUM + "")); } else if (!StringUtils.isAlphanumeric(petName)) { this.client.sendResponse(new PetNameErrorComposer(PetNameErrorComposer.FORBIDDEN_CHAR, petName)); } else { From ad86aeadf0fb8a8f17bdecb4710aebf1fb533a0b Mon Sep 17 00:00:00 2001 From: Harmonic Date: Fri, 1 May 2020 12:21:47 -0400 Subject: [PATCH 034/215] Fix group forum exploit --- .../incoming/guilds/forums/GuildForumPostThreadEvent.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumPostThreadEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumPostThreadEvent.java index c15f6198..a21ddc8f 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumPostThreadEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumPostThreadEvent.java @@ -13,6 +13,12 @@ import com.eu.habbo.messages.outgoing.handshake.ConnectionErrorComposer; public class GuildForumPostThreadEvent extends MessageHandler { + + @Override + public int getRatelimit() { + return 1000; + } + @Override public void handle() throws Exception { int guildId = this.packet.readInt(); From 74772b04eded484bb2b34f3773730bffc64ee21f Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Sat, 2 May 2020 02:18:09 +0200 Subject: [PATCH 035/215] Added DiffieHellman / RSA and RC4. --- src/main/java/com/eu/habbo/Emulator.java | 15 +- .../java/com/eu/habbo/core/CryptoConfig.java | 33 ++ .../eu/habbo/crypto/HabboDiffieHellman.java | 108 +++++ .../com/eu/habbo/crypto/HabboEncryption.java | 21 + .../java/com/eu/habbo/crypto/HabboRC4.java | 46 ++ .../com/eu/habbo/crypto/HabboRSACrypto.java | 168 ++++++++ .../exceptions/HabboCryptoException.java | 17 + .../habbo/crypto/utils/BigIntegerUtils.java | 17 + .../com/eu/habbo/crypto/utils/HexUtils.java | 27 ++ .../habbohotel/gameclients/GameClient.java | 147 ++++--- .../gameclients/GameClientManager.java | 9 +- .../com/eu/habbo/messages/PacketManager.java | 4 +- .../eu/habbo/messages/PacketManager_1006.java | 401 ------------------ .../eu/habbo/messages/incoming/Incoming.java | 4 +- .../CompleteDiffieHandshakeEvent.java | 27 ++ .../handshake/GenerateSecretKeyEvent.java | 11 - .../handshake/InitDiffieHandshakeEvent.java | 17 + .../handshake/RequestBannerToken.java | 12 - .../eu/habbo/messages/outgoing/Outgoing.java | 3 +- .../handshake/BannerTokenComposer.java | 24 -- .../CompleteDiffieHandshakeComposer.java | 29 ++ .../InitDiffieHandshakeComposer.java | 25 ++ .../gameserver/GameByteDecryption.java | 28 ++ .../gameserver/GameByteEncryption.java | 26 ++ .../gameserver/GameServerAttributes.java | 13 + .../runnables/ChannelReadHandler.java | 3 +- 26 files changed, 705 insertions(+), 530 deletions(-) create mode 100644 src/main/java/com/eu/habbo/core/CryptoConfig.java create mode 100644 src/main/java/com/eu/habbo/crypto/HabboDiffieHellman.java create mode 100644 src/main/java/com/eu/habbo/crypto/HabboEncryption.java create mode 100644 src/main/java/com/eu/habbo/crypto/HabboRC4.java create mode 100644 src/main/java/com/eu/habbo/crypto/HabboRSACrypto.java create mode 100644 src/main/java/com/eu/habbo/crypto/exceptions/HabboCryptoException.java create mode 100644 src/main/java/com/eu/habbo/crypto/utils/BigIntegerUtils.java create mode 100644 src/main/java/com/eu/habbo/crypto/utils/HexUtils.java delete mode 100644 src/main/java/com/eu/habbo/messages/PacketManager_1006.java create mode 100644 src/main/java/com/eu/habbo/messages/incoming/handshake/CompleteDiffieHandshakeEvent.java delete mode 100644 src/main/java/com/eu/habbo/messages/incoming/handshake/GenerateSecretKeyEvent.java create mode 100644 src/main/java/com/eu/habbo/messages/incoming/handshake/InitDiffieHandshakeEvent.java delete mode 100644 src/main/java/com/eu/habbo/messages/incoming/handshake/RequestBannerToken.java delete mode 100644 src/main/java/com/eu/habbo/messages/outgoing/handshake/BannerTokenComposer.java create mode 100644 src/main/java/com/eu/habbo/messages/outgoing/handshake/CompleteDiffieHandshakeComposer.java create mode 100644 src/main/java/com/eu/habbo/messages/outgoing/handshake/InitDiffieHandshakeComposer.java create mode 100644 src/main/java/com/eu/habbo/networking/gameserver/GameByteDecryption.java create mode 100644 src/main/java/com/eu/habbo/networking/gameserver/GameByteEncryption.java create mode 100644 src/main/java/com/eu/habbo/networking/gameserver/GameServerAttributes.java diff --git a/src/main/java/com/eu/habbo/Emulator.java b/src/main/java/com/eu/habbo/Emulator.java index c6b60f6d..4457d58a 100644 --- a/src/main/java/com/eu/habbo/Emulator.java +++ b/src/main/java/com/eu/habbo/Emulator.java @@ -1,9 +1,6 @@ package com.eu.habbo; -import com.eu.habbo.core.CleanerThread; -import com.eu.habbo.core.ConfigurationManager; -import com.eu.habbo.core.Logging; -import com.eu.habbo.core.TextsManager; +import com.eu.habbo.core.*; import com.eu.habbo.core.consolecommands.ConsoleCommand; import com.eu.habbo.database.Database; import com.eu.habbo.habbohotel.GameEnvironment; @@ -63,6 +60,7 @@ public final class Emulator { private static int timeStarted = 0; private static Runtime runtime; private static ConfigurationManager config; + private static CryptoConfig crypto; private static TextsManager texts; private static GameServer gameServer; private static RCONServer rconServer; @@ -106,6 +104,11 @@ public final class Emulator { Emulator.runtime = Runtime.getRuntime(); Emulator.config = new ConfigurationManager("config.ini"); + Emulator.crypto = new CryptoConfig( + Emulator.getConfig().getBoolean("enc.enabled", false), + Emulator.getConfig().getValue("enc.e"), + Emulator.getConfig().getValue("enc.n"), + Emulator.getConfig().getValue("enc.d")); Emulator.database = new Database(Emulator.getConfig()); Emulator.config.loaded = true; Emulator.config.loadFromDatabase(); @@ -274,6 +277,10 @@ public final class Emulator { return config; } + public static CryptoConfig getCrypto() { + return crypto; + } + public static TextsManager getTexts() { return texts; } diff --git a/src/main/java/com/eu/habbo/core/CryptoConfig.java b/src/main/java/com/eu/habbo/core/CryptoConfig.java new file mode 100644 index 00000000..28fbe7cd --- /dev/null +++ b/src/main/java/com/eu/habbo/core/CryptoConfig.java @@ -0,0 +1,33 @@ +package com.eu.habbo.core; + +public class CryptoConfig { + + private final boolean enabled; + private final String exponent; + private final String modulus; + private final String privateExponent; + + public CryptoConfig(boolean enabled, String exponent, String modulus, String privateExponent) { + this.enabled = enabled; + this.exponent = exponent; + this.modulus = modulus; + this.privateExponent = privateExponent; + } + + public boolean isEnabled() { + return enabled; + } + + public String getExponent() { + return exponent; + } + + public String getModulus() { + return modulus; + } + + public String getPrivateExponent() { + return privateExponent; + } + +} diff --git a/src/main/java/com/eu/habbo/crypto/HabboDiffieHellman.java b/src/main/java/com/eu/habbo/crypto/HabboDiffieHellman.java new file mode 100644 index 00000000..bf5f0ccc --- /dev/null +++ b/src/main/java/com/eu/habbo/crypto/HabboDiffieHellman.java @@ -0,0 +1,108 @@ +package com.eu.habbo.crypto; + +import com.eu.habbo.crypto.exceptions.HabboCryptoException; +import com.eu.habbo.crypto.utils.BigIntegerUtils; +import com.eu.habbo.crypto.utils.HexUtils; + +import java.math.BigInteger; +import java.nio.charset.StandardCharsets; +import java.util.concurrent.ThreadLocalRandom; + +public class HabboDiffieHellman { + + private static final int DH_PRIMES_BIT_SIZE = 128; + private static final int DH_KEY_BIT_SIZE = 128; + + private final HabboRSACrypto crypto; + + private BigInteger DHPrime; + private BigInteger DHGenerator; + private BigInteger DHPrivate; + private BigInteger DHPublic; + + public HabboDiffieHellman(HabboRSACrypto crypto) { + this.crypto = crypto; + this.generateDHPrimes(); + this.generateDHKeys(); + } + + public BigInteger getDHPrime() { + return DHPrime; + } + + public BigInteger getDHGenerator() { + return DHGenerator; + } + + private void generateDHPrimes() { + this.DHPrime = BigInteger.probablePrime(DH_PRIMES_BIT_SIZE, ThreadLocalRandom.current()); + this.DHGenerator = BigInteger.probablePrime(DH_PRIMES_BIT_SIZE, ThreadLocalRandom.current()); + + if (this.DHGenerator.compareTo(this.DHPrime) > 0) { + BigInteger temp = this.DHPrime; + + this.DHPrime = this.DHGenerator; + this.DHGenerator = temp; + } + } + + private void generateDHKeys() { + this.DHPrivate = BigInteger.probablePrime(DH_KEY_BIT_SIZE, ThreadLocalRandom.current()); + this.DHPublic = this.DHGenerator.modPow(this.DHPrivate, this.DHPrime); + } + + private String encryptBigInteger(BigInteger integer) throws HabboCryptoException { + String str = integer.toString(10); + byte[] bytes = str.getBytes(StandardCharsets.UTF_8); + byte[] encrypted = this.crypto.Sign(bytes); + + return HexUtils.toHex(encrypted).toLowerCase(); + } + + private BigInteger decryptBigInteger(String str) throws HabboCryptoException { + byte[] bytes = HexUtils.toBytes(str); + byte[] decrypted = this.crypto.Decrypt(bytes); + String intStr = new String(decrypted, StandardCharsets.UTF_8); + + return new BigInteger(intStr, 10); + } + + public String getPublicKey() throws HabboCryptoException { + return encryptBigInteger(this.DHPublic); + } + + public String getSignedPrime() throws HabboCryptoException { + return encryptBigInteger(this.DHPrime); + } + + public String getSignedGenerator() throws HabboCryptoException { + return encryptBigInteger(this.DHGenerator); + } + + public void doHandshake(String signedPrime, String signedGenerator) throws HabboCryptoException { + this.DHPrime = decryptBigInteger(signedPrime); + this.DHGenerator = decryptBigInteger(signedGenerator); + + if (this.DHPrime == null || this.DHGenerator == null) { + throw new HabboCryptoException("DHPrime or DHGenerator was null."); + } + + if (this.DHPrime.compareTo(BigInteger.valueOf(2)) < 1) { + throw new HabboCryptoException("Prime cannot be <= 2!\nPrime: " + this.DHPrime.toString()); + } + + if (this.DHGenerator.compareTo(this.DHPrime) > -1) { + throw new HabboCryptoException("Generator cannot be >= Prime!\nPrime: " + this.DHPrime.toString() + "\nGenerator: " + this.DHGenerator.toString()); + } + + generateDHKeys(); + } + + public byte[] getSharedKey(String publicKeyStr) throws HabboCryptoException { + BigInteger publicKey = this.decryptBigInteger(publicKeyStr); + BigInteger sharedKey = publicKey.modPow(this.DHPrivate, this.DHPrime); + + return BigIntegerUtils.toUnsignedByteArray(sharedKey); + } + +} diff --git a/src/main/java/com/eu/habbo/crypto/HabboEncryption.java b/src/main/java/com/eu/habbo/crypto/HabboEncryption.java new file mode 100644 index 00000000..42985f64 --- /dev/null +++ b/src/main/java/com/eu/habbo/crypto/HabboEncryption.java @@ -0,0 +1,21 @@ +package com.eu.habbo.crypto; + +public class HabboEncryption { + + private final HabboRSACrypto crypto; + private final HabboDiffieHellman diffie; + + public HabboEncryption(String e, String n, String d) { + this.crypto = new HabboRSACrypto(e, n, d); + this.diffie = new HabboDiffieHellman(this.crypto); + } + + public HabboRSACrypto getCrypto() { + return crypto; + } + + public HabboDiffieHellman getDiffie() { + return diffie; + } + +} diff --git a/src/main/java/com/eu/habbo/crypto/HabboRC4.java b/src/main/java/com/eu/habbo/crypto/HabboRC4.java new file mode 100644 index 00000000..b7959ed7 --- /dev/null +++ b/src/main/java/com/eu/habbo/crypto/HabboRC4.java @@ -0,0 +1,46 @@ +package com.eu.habbo.crypto; + +public class HabboRC4 { + + private int i; + private int j; + private final int[] table = new int[256]; + + public HabboRC4(byte[] key) { + int length = key.length; + + while (this.i < 256) { + table[this.i] = this.i; + this.i++; + } + + this.i = 0; + this.j = 0; + + while (this.i < 256) { + this.j = ((this.j + this.table[this.i]) + (key[this.i % length] & 0xff)) % 256; + this.swap(this.i, this.j); + this.i++; + } + + this.i = 0; + this.j = 0; + } + + private void swap(int a, int b) { + int num = table[a]; + table[a] = table[b]; + table[b] = num; + } + + public void parse(byte[] bytes) { + for (int index1 = 0; index1 < bytes.length; index1++) { + this.i = (this.i + 1) % 256; + this.j = (this.j + this.table[this.i]) % 256; + this.swap(this.i, this.j); + + bytes[index1] = (byte) ((bytes[index1] & 0xFF) ^ this.table[(this.table[this.i] + this.table[this.j]) % 256]); + } + } + +} diff --git a/src/main/java/com/eu/habbo/crypto/HabboRSACrypto.java b/src/main/java/com/eu/habbo/crypto/HabboRSACrypto.java new file mode 100644 index 00000000..7e1863ac --- /dev/null +++ b/src/main/java/com/eu/habbo/crypto/HabboRSACrypto.java @@ -0,0 +1,168 @@ +package com.eu.habbo.crypto; + +import com.eu.habbo.crypto.exceptions.HabboCryptoException; +import com.eu.habbo.crypto.utils.BigIntegerUtils; +import org.apache.commons.lang3.mutable.MutableInt; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.math.BigInteger; +import java.util.concurrent.ThreadLocalRandom; + +public class HabboRSACrypto { + + private final BigInteger e; + private final BigInteger n; + private final BigInteger d; + private final int blockSize; + + public HabboRSACrypto(String e, String n) { + this.e = new BigInteger(e, 16); + this.n = new BigInteger(n, 16); + this.d = null; + this.blockSize = (this.n.bitLength() + 7) / 8; + } + + public HabboRSACrypto(String e, String n, String d) { + this.e = new BigInteger(e, 16); + this.n = new BigInteger(n, 16); + this.d = new BigInteger(d, 16); + this.blockSize = (this.n.bitLength() + 7) / 8; + } + + public byte[] Encrypt(byte[] data) throws HabboCryptoException { + return DoEncrypt(data, true, 2); + } + + public byte[] Decrypt(byte[] data) throws HabboCryptoException { + return DoDecrypt(data, false, 2); + } + + public byte[] Sign(byte[] data) throws HabboCryptoException { + return DoEncrypt(data, false, 1); + } + + public byte[] Verify(byte[] data) throws HabboCryptoException { + return DoDecrypt(data, true, 1); + } + + private BigInteger DoPublic(BigInteger x) { + return x.modPow(this.e, this.n); + } + + private BigInteger DoPrivate(BigInteger x) { + return x.modPow(this.d, this.n); + } + + private byte[] DoEncrypt(byte[] data, boolean isPublic, int padType) throws HabboCryptoException { + try (ByteArrayOutputStream dst = new ByteArrayOutputStream()) { + int bl = this.blockSize; + int end = data.length; + MutableInt pos = new MutableInt(0); + + while (pos.intValue() < end) { + byte[] padded = Pkcs1Pad(data, pos, end, bl, padType); + BigInteger block = new BigInteger(padded); + BigInteger chunk = isPublic ? DoPublic(block) : DoPrivate(block); + + for (int b = (int) (bl - Math.ceil(chunk.bitLength() / 8.0)); b > 0; --b) { + dst.write(0x00); + } + + dst.write(BigIntegerUtils.toUnsignedByteArray(chunk)); + } + + return dst.toByteArray(); + } catch (IOException e) { + throw new HabboCryptoException(e); + } + } + + private byte[] DoDecrypt(byte[] data, boolean isPublic, int padType) throws HabboCryptoException { + if (data.length % this.blockSize != 0) { + throw new HabboCryptoException("Decryption data was not in blocks of " + this.blockSize + " bytes, total " + data.length + "."); + } + + try (ByteArrayOutputStream dst = new ByteArrayOutputStream()) { + int end = data.length; + int pos = 0; + + while (pos < end) { + byte[] blockData = new byte[this.blockSize]; + System.arraycopy(data, pos, blockData, 0, this.blockSize); + + BigInteger block = new BigInteger(1, blockData); + BigInteger chunk = isPublic ? DoPublic(block) : DoPrivate(block); + byte[] unpadded = Pkcs1Unpad(chunk.toByteArray(), this.blockSize, padType); + + pos += this.blockSize; + dst.write(unpadded); + } + + return dst.toByteArray(); + } catch (IOException e) { + throw new HabboCryptoException(e); + } + } + + private static byte[] Pkcs1Pad(byte[] src, MutableInt pos, int end, int n, int padType) { + byte[] result = new byte[n]; + int p = pos.intValue(); + end = Math.min(end, Math.min(src.length, p + n - 11)); + pos.setValue(end); + int i = end - 1; + + while (i >= p && n > 11) { + result[--n] = src[i--]; + } + + result[--n] = 0; + + if (padType == 2) { + while (n > 2) { + result[--n] = (byte) ThreadLocalRandom.current().nextInt(1, 256); + } + } else { + while (n > 2) { + result[--n] = (byte) 0xFF; + } + } + + result[--n] = (byte) padType; + result[--n] = 0; + + return result; + } + + private static byte[] Pkcs1Unpad(byte[] b, int n, int padType) throws HabboCryptoException { + byte[] result = new byte[n]; + int resultPos = 0; + int i = 0; + + while (i < b.length && b[i] == 0) { + ++i; + } + + if (b.length - i != n - 1 || b[i] != padType) { + throw new HabboCryptoException("PKCS#1 unpad: i=" + i + ", expected b[i]==" + padType + ", got b[i]=" + b[i]); + } + + ++i; + + while (b[i] != 0) { + if (++i >= b.length) { + throw new HabboCryptoException("PKCS#1 unpad: i=" + i + ", b[i-1]!=0 (=" + b[i-1] + ")"); + } + } + + while (++i < b.length) { + result[resultPos++] = b[i]; + } + + byte[] resultCopy = new byte[resultPos]; + System.arraycopy(result, 0, resultCopy, 0, resultPos); + + return resultCopy; + } + +} diff --git a/src/main/java/com/eu/habbo/crypto/exceptions/HabboCryptoException.java b/src/main/java/com/eu/habbo/crypto/exceptions/HabboCryptoException.java new file mode 100644 index 00000000..e2b86a8d --- /dev/null +++ b/src/main/java/com/eu/habbo/crypto/exceptions/HabboCryptoException.java @@ -0,0 +1,17 @@ +package com.eu.habbo.crypto.exceptions; + +public class HabboCryptoException extends Exception { + + public HabboCryptoException(String message) { + super(message); + } + + public HabboCryptoException(String message, Throwable cause) { + super(message, cause); + } + + public HabboCryptoException(Throwable cause) { + super(cause); + } + +} diff --git a/src/main/java/com/eu/habbo/crypto/utils/BigIntegerUtils.java b/src/main/java/com/eu/habbo/crypto/utils/BigIntegerUtils.java new file mode 100644 index 00000000..4998bde1 --- /dev/null +++ b/src/main/java/com/eu/habbo/crypto/utils/BigIntegerUtils.java @@ -0,0 +1,17 @@ +package com.eu.habbo.crypto.utils; + +import java.math.BigInteger; +import java.util.Arrays; + +public class BigIntegerUtils { + + public static byte[] toUnsignedByteArray(BigInteger bigInteger) { + byte[] bytes = bigInteger.toByteArray(); + if (bytes[0] == 0) { + bytes = Arrays.copyOfRange(bytes, 1, bytes.length); + } + + return bytes; + } + +} diff --git a/src/main/java/com/eu/habbo/crypto/utils/HexUtils.java b/src/main/java/com/eu/habbo/crypto/utils/HexUtils.java new file mode 100644 index 00000000..ae935ed0 --- /dev/null +++ b/src/main/java/com/eu/habbo/crypto/utils/HexUtils.java @@ -0,0 +1,27 @@ +package com.eu.habbo.crypto.utils; + +public class HexUtils { + + private static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray(); + + public static String toHex(byte[] bytes) { + char[] hexChars = new char[bytes.length * 2]; + for (int j = 0; j < bytes.length; j++) { + int v = bytes[j] & 0xFF; + hexChars[j * 2] = HEX_ARRAY[v >>> 4]; + hexChars[j * 2 + 1] = HEX_ARRAY[v & 0x0F]; + } + return new String(hexChars); + } + + public static byte[] toBytes(String hexString) { + int len = hexString.length(); + byte[] data = new byte[len / 2]; + for (int i = 0; i < len; i += 2) { + data[i / 2] = (byte) ((Character.digit(hexString.charAt(i), 16) << 4) + + Character.digit(hexString.charAt(i+1), 16)); + } + return data; + } + +} diff --git a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java index 6b7ff3f5..1e5120a2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java +++ b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.gameclients; import com.eu.habbo.Emulator; import com.eu.habbo.core.Logging; +import com.eu.habbo.crypto.HabboEncryption; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.PacketManager; import com.eu.habbo.messages.ServerMessage; @@ -18,87 +19,35 @@ import java.util.ArrayList; import java.util.concurrent.ConcurrentHashMap; public class GameClient { - public final ConcurrentHashMap incomingPacketCounter = new ConcurrentHashMap<>(25); + private final Channel channel; - public long lastPacketCounterCleared = Emulator.getIntUnixTimestamp(); + private final HabboEncryption encryption; + private Habbo habbo; private String machineId = ""; + + public final ConcurrentHashMap incomingPacketCounter = new ConcurrentHashMap<>(25); public final ConcurrentHashMap, Long> messageTimestamps = new ConcurrentHashMap<>(); + public long lastPacketCounterCleared = Emulator.getIntUnixTimestamp(); public GameClient(Channel channel) { this.channel = channel; - } - - - public void sendResponse(MessageComposer composer) { - if (this.channel.isOpen()) { - try { - ServerMessage msg = composer.compose(); - this.sendResponse(msg); - } catch (Exception e) { - Emulator.getLogging().logPacketError(e); - } - } - } - - - public void sendResponse(ServerMessage response) { - if (this.channel.isOpen()) { - if (response == null || response.getHeader() <= 0) { - return; - } - - if (PacketManager.DEBUG_SHOW_PACKETS) - Emulator.getLogging().logPacketLine("[" + Logging.ANSI_PURPLE + "SERVER" + Logging.ANSI_RESET + "] => [" + response.getHeader() + "] -> " + response.getBodyString()); - - this.channel.write(response.get(), this.channel.voidPromise()); - this.channel.flush(); - } - } - - - public void sendResponses(ArrayList responses) { - ByteBuf buffer = Unpooled.buffer(); - - if (this.channel.isOpen()) { - for (ServerMessage response : responses) { - if (response == null || response.getHeader() <= 0) { - return; - } - - if (PacketManager.DEBUG_SHOW_PACKETS) - Emulator.getLogging().logPacketLine("[" + Logging.ANSI_PURPLE + "SERVER" + Logging.ANSI_RESET + "] => [" + response.getHeader() + "] -> " + response.getBodyString()); - - buffer.writeBytes(response.get()); - } - this.channel.write(buffer.copy(), this.channel.voidPromise()); - this.channel.flush(); - } - buffer.release(); - } - - - public void dispose() { - try { - this.channel.close(); - - if (this.habbo != null) { - if (this.habbo.isOnline()) { - this.habbo.getHabboInfo().setOnline(false); - this.habbo.disconnect(); - } - - this.habbo = null; - } - } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); - } + this.encryption = Emulator.getCrypto().isEnabled() + ? new HabboEncryption( + Emulator.getCrypto().getExponent(), + Emulator.getCrypto().getModulus(), + Emulator.getCrypto().getPrivateExponent()) + : null; } public Channel getChannel() { return this.channel; } + public HabboEncryption getEncryption() { + return encryption; + } + public Habbo getHabbo() { return this.habbo; } @@ -127,4 +76,66 @@ public class GameClient { } } } + + public void sendResponse(MessageComposer composer) { + if (this.channel.isOpen()) { + try { + ServerMessage msg = composer.compose(); + this.sendResponse(msg); + } catch (Exception e) { + Emulator.getLogging().logPacketError(e); + } + } + } + + public void sendResponse(ServerMessage response) { + if (this.channel.isOpen()) { + if (response == null || response.getHeader() <= 0) { + return; + } + + if (PacketManager.DEBUG_SHOW_PACKETS) + Emulator.getLogging().logPacketLine("[" + Logging.ANSI_PURPLE + "SERVER" + Logging.ANSI_RESET + "] => [" + response.getHeader() + "] -> " + response.getBodyString()); + + this.channel.write(response.get(), this.channel.voidPromise()); + this.channel.flush(); + } + } + + public void sendResponses(ArrayList responses) { + ByteBuf buffer = Unpooled.buffer(); + + if (this.channel.isOpen()) { + for (ServerMessage response : responses) { + if (response == null || response.getHeader() <= 0) { + return; + } + + if (PacketManager.DEBUG_SHOW_PACKETS) + Emulator.getLogging().logPacketLine("[" + Logging.ANSI_PURPLE + "SERVER" + Logging.ANSI_RESET + "] => [" + response.getHeader() + "] -> " + response.getBodyString()); + + buffer.writeBytes(response.get()); + } + this.channel.write(buffer.copy(), this.channel.voidPromise()); + this.channel.flush(); + } + buffer.release(); + } + + public void dispose() { + try { + this.channel.close(); + + if (this.habbo != null) { + if (this.habbo.isOnline()) { + this.habbo.getHabboInfo().setOnline(false); + this.habbo.disconnect(); + } + + this.habbo = null; + } + } catch (Exception e) { + Emulator.getLogging().logErrorLine(e); + } + } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java index 4d1198f4..c8460d57 100644 --- a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.gameclients; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; +import com.eu.habbo.networking.gameserver.GameServerAttributes; import io.netty.channel.*; import io.netty.util.AttributeKey; @@ -12,7 +13,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; public class GameClientManager { - public static final AttributeKey CLIENT = AttributeKey.valueOf("GameClient"); + private final ConcurrentMap clients; public GameClientManager() { @@ -34,7 +35,7 @@ public class GameClientManager { } }); - ctx.channel().attr(CLIENT).set(client); + ctx.channel().attr(GameServerAttributes.CLIENT).set(client); ctx.fireChannelRegistered(); return this.clients.putIfAbsent(ctx.channel().id(), client) == null; @@ -46,13 +47,13 @@ public class GameClientManager { } private void disposeClient(Channel channel) { - GameClient client = channel.attr(CLIENT).get(); + GameClient client = channel.attr(GameServerAttributes.CLIENT).get(); if (client != null) { client.dispose(); } channel.deregister(); - channel.attr(CLIENT).set(null); + channel.attr(GameServerAttributes.CLIENT).set(null); channel.closeFuture(); channel.close(); this.clients.remove(channel.id()); diff --git a/src/main/java/com/eu/habbo/messages/PacketManager.java b/src/main/java/com/eu/habbo/messages/PacketManager.java index 8acc8689..37635461 100644 --- a/src/main/java/com/eu/habbo/messages/PacketManager.java +++ b/src/main/java/com/eu/habbo/messages/PacketManager.java @@ -260,8 +260,8 @@ public class PacketManager { private void registerHandshake() throws Exception { this.registerHandler(Incoming.ReleaseVersionEvent, ReleaseVersionEvent.class); - this.registerHandler(Incoming.GenerateSecretKeyEvent, GenerateSecretKeyEvent.class); - this.registerHandler(Incoming.RequestBannerToken, RequestBannerToken.class); + this.registerHandler(Incoming.InitDiffieHandshake, InitDiffieHandshakeEvent.class); + this.registerHandler(Incoming.CompleteDiffieHandshake, CompleteDiffieHandshakeEvent.class); this.registerHandler(Incoming.SecureLoginEvent, SecureLoginEvent.class); this.registerHandler(Incoming.MachineIDEvent, MachineIDEvent.class); this.registerHandler(Incoming.UsernameEvent, UsernameEvent.class); diff --git a/src/main/java/com/eu/habbo/messages/PacketManager_1006.java b/src/main/java/com/eu/habbo/messages/PacketManager_1006.java deleted file mode 100644 index 93edd722..00000000 --- a/src/main/java/com/eu/habbo/messages/PacketManager_1006.java +++ /dev/null @@ -1,401 +0,0 @@ -package com.eu.habbo.messages; - -import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.messages.incoming.Incoming; -import com.eu.habbo.messages.incoming.MessageHandler; -import com.eu.habbo.messages.incoming.achievements.RequestAchievementsEvent; -import com.eu.habbo.messages.incoming.ambassadors.AmbassadorAlertCommandEvent; -import com.eu.habbo.messages.incoming.ambassadors.AmbassadorVisitCommandEvent; -import com.eu.habbo.messages.incoming.catalog.*; -import com.eu.habbo.messages.incoming.catalog.marketplace.*; -import com.eu.habbo.messages.incoming.catalog.recycler.OpenRecycleBoxEvent; -import com.eu.habbo.messages.incoming.catalog.recycler.RecycleEvent; -import com.eu.habbo.messages.incoming.catalog.recycler.ReloadRecyclerEvent; -import com.eu.habbo.messages.incoming.catalog.recycler.RequestRecyclerLogicEvent; -import com.eu.habbo.messages.incoming.floorplaneditor.FloorPlanEditorRequestBlockedTilesEvent; -import com.eu.habbo.messages.incoming.floorplaneditor.FloorPlanEditorRequestDoorSettingsEvent; -import com.eu.habbo.messages.incoming.floorplaneditor.FloorPlanEditorSaveEvent; -import com.eu.habbo.messages.incoming.friends.*; -import com.eu.habbo.messages.incoming.guilds.*; -import com.eu.habbo.messages.incoming.handshake.*; -import com.eu.habbo.messages.incoming.helper.RequestTalentTrackEvent; -import com.eu.habbo.messages.incoming.hotelview.HotelViewDataEvent; -import com.eu.habbo.messages.incoming.hotelview.HotelViewEvent; -import com.eu.habbo.messages.incoming.hotelview.HotelViewRequestBonusRareEvent; -import com.eu.habbo.messages.incoming.hotelview.RequestNewsListEvent; -import com.eu.habbo.messages.incoming.inventory.RequestInventoryBadgesEvent; -import com.eu.habbo.messages.incoming.inventory.RequestInventoryBotsEvent; -import com.eu.habbo.messages.incoming.inventory.RequestInventoryItemsEvent; -import com.eu.habbo.messages.incoming.inventory.RequestInventoryPetsEvent; -import com.eu.habbo.messages.incoming.modtool.*; -import com.eu.habbo.messages.incoming.navigator.*; -import com.eu.habbo.messages.incoming.polls.AnswerPollEvent; -import com.eu.habbo.messages.incoming.polls.CancelPollEvent; -import com.eu.habbo.messages.incoming.polls.GetPollDataEvent; -import com.eu.habbo.messages.incoming.rooms.*; -import com.eu.habbo.messages.incoming.rooms.bots.BotPickupEvent; -import com.eu.habbo.messages.incoming.rooms.bots.BotPlaceEvent; -import com.eu.habbo.messages.incoming.rooms.bots.BotSaveSettingsEvent; -import com.eu.habbo.messages.incoming.rooms.bots.BotSettingsEvent; -import com.eu.habbo.messages.incoming.rooms.items.*; -import com.eu.habbo.messages.incoming.rooms.items.jukebox.JukeBoxEventOne; -import com.eu.habbo.messages.incoming.rooms.items.jukebox.JukeBoxEventTwo; -import com.eu.habbo.messages.incoming.rooms.items.jukebox.JukeBoxRequestPlayListEvent; -import com.eu.habbo.messages.incoming.rooms.items.rentablespace.RentSpaceCancelEvent; -import com.eu.habbo.messages.incoming.rooms.items.rentablespace.RentSpaceEvent; -import com.eu.habbo.messages.incoming.rooms.pets.*; -import com.eu.habbo.messages.incoming.rooms.users.*; -import com.eu.habbo.messages.incoming.trading.*; -import com.eu.habbo.messages.incoming.unknown.RequestResolutionEvent; -import com.eu.habbo.messages.incoming.unknown.UnknownEvent1; -import com.eu.habbo.messages.incoming.users.*; -import com.eu.habbo.messages.incoming.wired.WiredConditionSaveDataEvent; -import com.eu.habbo.messages.incoming.wired.WiredEffectSaveDataEvent; -import com.eu.habbo.messages.incoming.wired.WiredTriggerSaveDataEvent; -import gnu.trove.map.hash.THashMap; - -public class PacketManager_1006 { - - private final THashMap> incoming; - - public PacketManager_1006() { - this.incoming = new THashMap<>(); - - this.registerCatalog(); - this.registerHandshake(); - this.registerFriends(); - this.registerNavigator(); - this.registerUsers(); - this.registerHotelview(); - this.registerInventory(); - this.registerRooms(); - this.registerPolls(); - this.registerUnknown(); - this.registerModTool(); - this.registerTrading(); - this.registerGuilds(); - this.registerPets(); - this.registerWired(); - this.registerAchievements(); - this.registerFloorPlanEditor(); - this.registerAmbassadors(); - } - - void registerHandler(Integer header, Class handler) { - this.incoming.putIfAbsent(header, handler); - } - - public void handlePacket(GameClient client, ClientMessage packet) { - if (client == null) - return; - - try { - if (this.isRegistered(packet.getMessageId())) { - if (Emulator.getConfig().getBoolean("debug.show.packets")) - Emulator.getLogging().logPacketLine("[CLIENT][" + packet.getMessageId() + "] => " + packet.getMessageBody()); - - MessageHandler handler = this.incoming.get(packet.getMessageId()).newInstance(); - - handler.client = client; - handler.packet = packet; - - handler.handle(); - - } else { - if (Emulator.getConfig().getBoolean("debug.show.packets")) - Emulator.getLogging().logPacketLine("[CLIENT][UNDEFINED][" + packet.getMessageId() + "] => " + packet.getMessageBody()); - } - } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); - } - } - - boolean isRegistered(int header) { - return this.incoming.containsKey(header); - } - - private void registerAmbassadors() { - this.registerHandler(Incoming.AmbassadorAlertCommandEvent, AmbassadorAlertCommandEvent.class); - this.registerHandler(Incoming.AmbassadorVisitCommandEvent, AmbassadorVisitCommandEvent.class); - } - - private void registerCatalog() { - this.registerHandler(Incoming.RequestRecylerLogicEvent, RequestRecyclerLogicEvent.class); - this.registerHandler(Incoming.RequestDiscountEvent, RequestDiscountEvent.class); - this.registerHandler(Incoming.RequestGiftConfigurationEvent, RequestGiftConfigurationEvent.class); - this.registerHandler(Incoming.GetMarketplaceConfigEvent, RequestMarketplaceConfigEvent.class); - this.registerHandler(Incoming.RequestCatalogModeEvent, RequestCatalogModeEvent.class); - this.registerHandler(Incoming.RequestCatalogIndexEvent, RequestCatalogIndexEvent.class); - this.registerHandler(Incoming.RequestCatalogPageEvent, RequestCatalogPageEvent.class); - this.registerHandler(Incoming.CatalogBuyItemAsGiftEvent, CatalogBuyItemAsGiftEvent.class); - this.registerHandler(Incoming.CatalogBuyItemEvent, CatalogBuyItemEvent.class); - this.registerHandler(Incoming.RedeemVoucherEvent, RedeemVoucherEvent.class); - this.registerHandler(Incoming.ReloadRecyclerEvent, ReloadRecyclerEvent.class); - this.registerHandler(Incoming.RecycleEvent, RecycleEvent.class); - this.registerHandler(Incoming.OpenRecycleBoxEvent, OpenRecycleBoxEvent.class); - this.registerHandler(Incoming.RequestOwnItemsEvent, RequestOwnItemsEvent.class); - this.registerHandler(Incoming.TakeBackItemEvent, TakeBackItemEvent.class); - this.registerHandler(Incoming.RequestOffersEvent, RequestOffersEvent.class); - this.registerHandler(Incoming.RequestItemInfoEvent, RequestItemInfoEvent.class); - this.registerHandler(Incoming.BuyItemEvent, BuyItemEvent.class); - this.registerHandler(Incoming.RequestSellItemEvent, RequestSellItemEvent.class); - this.registerHandler(Incoming.SellItemEvent, SellItemEvent.class); - this.registerHandler(Incoming.RequestCreditsEvent, RequestCreditsEvent.class); - this.registerHandler(Incoming.RequestPetBreedsEvent, RequestPetBreedsEvent.class); - this.registerHandler(Incoming.CheckPetNameEvent, CheckPetNameEvent.class); - this.registerHandler(Incoming.GetClubDataEvent, RequestClubDataEvent.class); - this.registerHandler(Incoming.RequestClubGiftsEvent, RequestClubGiftsEvent.class); - this.registerHandler(Incoming.CatalogSearchedItemEvent, CatalogSearchedItemEvent.class); - } - - private void registerHandshake() { - this.registerHandler(Incoming.ReleaseVersionEvent, ReleaseVersionEvent.class); - this.registerHandler(Incoming.GenerateSecretKeyEvent, GenerateSecretKeyEvent.class); - this.registerHandler(Incoming.RequestBannerToken, RequestBannerToken.class); - this.registerHandler(Incoming.SecureLoginEvent, SecureLoginEvent.class); - this.registerHandler(Incoming.MachineIDEvent, MachineIDEvent.class); - this.registerHandler(Incoming.UsernameEvent, UsernameEvent.class); - this.registerHandler(Incoming.PingEvent, PingEvent.class); - } - - private void registerFriends() { - this.registerHandler(Incoming.RequestFriendsEvent, RequestFriendsEvent.class); - this.registerHandler(Incoming.ChangeRelationEvent, ChangeRelationEvent.class); - this.registerHandler(Incoming.RemoveFriendEvent, RemoveFriendEvent.class); - this.registerHandler(Incoming.SearchUserEvent, SearchUserEvent.class); - this.registerHandler(Incoming.FriendRequestEvent, FriendRequestEvent.class); - this.registerHandler(Incoming.AcceptFriendRequest, AcceptFriendRequestEvent.class); - this.registerHandler(Incoming.FriendPrivateMessageEvent, FriendPrivateMessageEvent.class); - this.registerHandler(Incoming.RequestFriendRequestEvent, RequestFriendRequestsEvent.class); - this.registerHandler(Incoming.StalkFriendEvent, StalkFriendEvent.class); - this.registerHandler(Incoming.RequestInitFriendsEvent, RequestInitFriendsEvent.class); - this.registerHandler(Incoming.FindNewFriendsEvent, FindNewFriendsEvent.class); - this.registerHandler(Incoming.InviteFriendsEvent, InviteFriendsEvent.class); - } - - private void registerUsers() { - this.registerHandler(Incoming.RequestUserDataEvent, RequestUserDataEvent.class); - this.registerHandler(Incoming.RequestUserCreditsEvent, RequestUserCreditsEvent.class); - this.registerHandler(Incoming.RequestUserClubEvent, RequestUserClubEvent.class); - this.registerHandler(Incoming.RequestMeMenuSettingsEvent, RequestMeMenuSettingsEvent.class); - this.registerHandler(Incoming.RequestUserCitizinShipEvent, RequestUserCitizinShipEvent.class); - this.registerHandler(Incoming.RequestUserProfileEvent, RequestUserProfileEvent.class); - this.registerHandler(Incoming.RequestProfileFriendsEvent, RequestProfileFriendsEvent.class); - this.registerHandler(Incoming.RequestUserWardrobeEvent, RequestUserWardrobeEvent.class); - this.registerHandler(Incoming.SaveWardrobeEvent, SaveWardrobeEvent.class); - this.registerHandler(Incoming.SaveMottoEvent, SaveMottoEvent.class); - this.registerHandler(Incoming.UserSaveLookEvent, UserSaveLookEvent.class); - this.registerHandler(Incoming.UserWearBadgeEvent, UserWearBadgeEvent.class); - this.registerHandler(Incoming.RequestWearingBadgesEvent, RequestWearingBadgesEvent.class); - this.registerHandler(Incoming.SaveUserVolumesEvent, SaveUserVolumesEvent.class); - this.registerHandler(Incoming.SaveBlockCameraFollowEvent, SaveBlockCameraFollowEvent.class); - this.registerHandler(Incoming.SaveIgnoreRoomInvitesEvent, SaveIgnoreRoomInvitesEvent.class); - this.registerHandler(Incoming.SavePreferOldChatEvent, SavePreferOldChatEvent.class); - } - - private void registerNavigator() { - this.registerHandler(Incoming.RequestRoomCategoriesEvent, RequestRoomCategoriesEvent.class); - this.registerHandler(Incoming.RequestPublicRoomsEvent, RequestPublicRoomsEvent.class); - this.registerHandler(Incoming.RequestPopularRoomsEvent, RequestPopularRoomsEvent.class); - this.registerHandler(Incoming.RequestHighestScoreRoomsEvent, RequestHighestScoreRoomsEvent.class); - this.registerHandler(Incoming.RequestMyRoomsEvent, RequestMyRoomsEvent.class); - this.registerHandler(Incoming.RequestCanCreateRoomEvent, RequestCanCreateRoomEvent.class); - this.registerHandler(Incoming.RequestPromotedRoomsEvent, RequestPromotedRoomsEvent.class); - this.registerHandler(Incoming.RequestCreateRoomEvent, RequestCreateRoomEvent.class); - this.registerHandler(Incoming.RequestTagsEvent, RequestTagsEvent.class); - this.registerHandler(Incoming.SearchRoomsByTagEvent, SearchRoomsByTagEvent.class); - this.registerHandler(Incoming.SearchRoomsEvent, SearchRoomsEvent.class); - this.registerHandler(Incoming.SearchRoomsFriendsNowEvent, SearchRoomsFriendsNowEvent.class); - this.registerHandler(Incoming.SearchRoomsFriendsOwnEvent, SearchRoomsFriendsOwnEvent.class); - this.registerHandler(Incoming.SearchRoomsWithRightsEvent, SearchRoomsWithRightsEvent.class); - this.registerHandler(Incoming.SearchRoomsInGroupEvent, SearchRoomsInGroupEvent.class); - this.registerHandler(Incoming.SearchRoomsMyFavoriteEvent, SearchRoomsMyFavouriteEvent.class); - this.registerHandler(Incoming.SearchRoomsVisitedEvent, SearchRoomsVisitedEvent.class); - this.registerHandler(Incoming.RequestNewNavigatorDataEvent, RequestNewNavigatorDataEvent.class); - this.registerHandler(Incoming.RequestNewNavigatorRoomsEvent, RequestNewNavigatorRoomsEvent.class); - this.registerHandler(Incoming.NewNavigatorActionEvent, NewNavigatorActionEvent.class); - } - - private void registerHotelview() { - this.registerHandler(Incoming.HotelViewEvent, HotelViewEvent.class); - this.registerHandler(Incoming.HotelViewRequestBonusRareEvent, HotelViewRequestBonusRareEvent.class); - this.registerHandler(Incoming.RequestNewsListEvent, RequestNewsListEvent.class); - this.registerHandler(Incoming.HotelViewDataEvent, HotelViewDataEvent.class); - } - - private void registerInventory() { - this.registerHandler(Incoming.RequestInventoryBadgesEvent, RequestInventoryBadgesEvent.class); - this.registerHandler(Incoming.RequestInventoryBotsEvent, RequestInventoryBotsEvent.class); - this.registerHandler(Incoming.RequestInventoryItemsEvent, RequestInventoryItemsEvent.class); - this.registerHandler(Incoming.HotelViewInventoryEvent, RequestInventoryItemsEvent.class); - this.registerHandler(Incoming.RequestInventoryPetsEvent, RequestInventoryPetsEvent.class); - } - - void registerRooms() { - this.registerHandler(Incoming.RequestRoomLoadEvent, RequestRoomLoadEvent.class); - this.registerHandler(Incoming.RequestHeightmapEvent, RequestRoomHeightmapEvent.class); - this.registerHandler(Incoming.RequestRoomHeightmapEvent, RequestRoomHeightmapEvent.class); - this.registerHandler(Incoming.RoomVoteEvent, RoomVoteEvent.class); - this.registerHandler(Incoming.RequestRoomDataEvent, RequestRoomDataEvent.class); - this.registerHandler(Incoming.RoomSettingsSaveEvent, RoomSettingsSaveEvent.class); - this.registerHandler(Incoming.RoomPlaceItemEvent, RoomPlaceItemEvent.class); - this.registerHandler(Incoming.RotateMoveItemEvent, RotateMoveItemEvent.class); - this.registerHandler(Incoming.MoveWallItemEvent, MoveWallItemEvent.class); - this.registerHandler(Incoming.RoomPickupItemEvent, RoomPickupItemEvent.class); - this.registerHandler(Incoming.RoomPlacePaintEvent, RoomPlacePaintEvent.class); - this.registerHandler(Incoming.RoomUserStartTypingEvent, RoomUserStartTypingEvent.class); - this.registerHandler(Incoming.RoomUserStopTypingEvent, RoomUserStopTypingEvent.class); - this.registerHandler(Incoming.ToggleFloorItemEvent, ToggleFloorItemEvent.class); - this.registerHandler(Incoming.ToggleWallItemEvent, ToggleWallItemEvent.class); - this.registerHandler(Incoming.RoomBackgroundEvent, RoomBackgroundEvent.class); - this.registerHandler(Incoming.MannequinSaveNameEvent, MannequinSaveNameEvent.class); - this.registerHandler(Incoming.MannequinSaveLookEvent, MannequinSaveLookEvent.class); - this.registerHandler(Incoming.AdvertisingSaveEvent, AdvertisingSaveEvent.class); - this.registerHandler(Incoming.RequestRoomSettingsEvent, RequestRoomSettingsEvent.class); - this.registerHandler(Incoming.MoodLightSettingsEvent, MoodLightSettingsEvent.class); - this.registerHandler(Incoming.MoodLightTurnOnEvent, MoodLightTurnOnEvent.class); - this.registerHandler(Incoming.RoomUserDropHandItemEvent, RoomUserDropHandItemEvent.class); - this.registerHandler(Incoming.RoomUserLookAtPoint, RoomUserLookAtPoint.class); - this.registerHandler(Incoming.RoomUserTalkEvent, RoomUserTalkEvent.class); - this.registerHandler(Incoming.RoomUserShoutEvent, RoomUserShoutEvent.class); - this.registerHandler(Incoming.RoomUserWhisperEvent, RoomUserWhisperEvent.class); - this.registerHandler(Incoming.RoomUserActionEvent, RoomUserActionEvent.class); - this.registerHandler(Incoming.RoomUserSitEvent, RoomUserSitEvent.class); - this.registerHandler(Incoming.RoomUserDanceEvent, RoomUserDanceEvent.class); - this.registerHandler(Incoming.RoomUserSignEvent, RoomUserSignEvent.class); - this.registerHandler(Incoming.RoomUserWalkEvent, RoomUserWalkEvent.class); - this.registerHandler(Incoming.RoomUserGiveRespectEvent, RoomUserGiveRespectEvent.class); - this.registerHandler(Incoming.RoomUserGiveRightsEvent, RoomUserGiveRightsEvent.class); - this.registerHandler(Incoming.RequestRoomRightsEvent, RequestRoomRightsEvent.class); - this.registerHandler(Incoming.RoomRemoveAllRightsEvent, RoomRemoveAllRightsEvent.class); - this.registerHandler(Incoming.RoomUserRemoveRightsEvent, RoomUserRemoveRightsEvent.class); - this.registerHandler(Incoming.BotPlaceEvent, BotPlaceEvent.class); - this.registerHandler(Incoming.BotPickupEvent, BotPickupEvent.class); - this.registerHandler(Incoming.BotSaveSettingsEvent, BotSaveSettingsEvent.class); - this.registerHandler(Incoming.BotSettingsEvent, BotSettingsEvent.class); - this.registerHandler(Incoming.TriggerDiceEvent, TriggerDiceEvent.class); - this.registerHandler(Incoming.CloseDiceEvent, CloseDiceEvent.class); - this.registerHandler(Incoming.TriggerColorWheelEvent, TriggerColorWheelEvent.class); - this.registerHandler(Incoming.RedeemItemEvent, RedeemItemEvent.class); - this.registerHandler(Incoming.PetPlaceEvent, PetPlaceEvent.class); - this.registerHandler(Incoming.RoomUserKickEvent, RoomUserKickEvent.class); - this.registerHandler(Incoming.SetStackHelperHeightEvent, SetStackHelperHeightEvent.class); - this.registerHandler(Incoming.TriggerOneWayGateEvent, TriggerOneWayGateEvent.class); - this.registerHandler(Incoming.HandleDoorbellEvent, HandleDoorbellEvent.class); - this.registerHandler(Incoming.RedeemClothingEvent, RedeemClothingEvent.class); - this.registerHandler(Incoming.PostItPlaceEvent, PostItPlaceEvent.class); - this.registerHandler(Incoming.PostItRequestDataEvent, PostItRequestDataEvent.class); - this.registerHandler(Incoming.PostItSaveDataEvent, PostItSaveDataEvent.class); - this.registerHandler(Incoming.PostItDeleteEvent, PostItDeleteEvent.class); - this.registerHandler(Incoming.MoodLightSaveSettingsEvent, MoodLightSaveSettingsEvent.class); - this.registerHandler(Incoming.RentSpaceEvent, RentSpaceEvent.class); - this.registerHandler(Incoming.RentSpaceCancelEvent, RentSpaceCancelEvent.class); - this.registerHandler(Incoming.SetHomeRoomEvent, SetHomeRoomEvent.class); - this.registerHandler(Incoming.RoomUserGiveHandItemEvent, RoomUserGiveHandItemEvent.class); - this.registerHandler(Incoming.RoomMuteEvent, RoomMuteEvent.class); - this.registerHandler(Incoming.RequestRoomWordFilterEvent, RequestRoomWordFilterEvent.class); - this.registerHandler(Incoming.RoomWordFilterModifyEvent, RoomWordFilterModifyEvent.class); - this.registerHandler(Incoming.RoomStaffPickEvent, RoomStaffPickEvent.class); - this.registerHandler(Incoming.RoomRequestBannedUsersEvent, RoomRequestBannedUsersEvent.class); - this.registerHandler(Incoming.JukeBoxRequestTrackCodeEvent, JukeBoxRequestTrackCodeEvent.class); - this.registerHandler(Incoming.JukeBoxRequestTrackDataEvent, JukeBoxRequestTrackDataEvent.class); - this.registerHandler(Incoming.JukeBoxRequestPlayListEvent, JukeBoxRequestPlayListEvent.class); - this.registerHandler(Incoming.JukeBoxEventOne, JukeBoxEventOne.class); - this.registerHandler(Incoming.JukeBoxEventTwo, JukeBoxEventTwo.class); - } - - void registerPolls() { - this.registerHandler(Incoming.CancelPollEvent, CancelPollEvent.class); - this.registerHandler(Incoming.GetPollDataEvent, GetPollDataEvent.class); - this.registerHandler(Incoming.AnswerPollEvent, AnswerPollEvent.class); - } - - void registerModTool() { - this.registerHandler(Incoming.ModToolRequestRoomInfoEvent, ModToolRequestRoomInfoEvent.class); - this.registerHandler(Incoming.ModToolRequestRoomChatlogEvent, ModToolRequestRoomChatlogEvent.class); - this.registerHandler(Incoming.ModToolRequestUserInfoEvent, ModToolRequestUserInfoEvent.class); - this.registerHandler(Incoming.ModToolPickTicketEvent, ModToolPickTicketEvent.class); - this.registerHandler(Incoming.ModToolCloseTicketEvent, ModToolCloseTicketEvent.class); - this.registerHandler(Incoming.ModToolReleaseTicketEvent, ModToolReleaseTicketEvent.class); - this.registerHandler(Incoming.ModToolAlertEvent, ModToolAlertEvent.class); - this.registerHandler(Incoming.ModToolWarnEvent, ModToolAlertEvent.class); - this.registerHandler(Incoming.ModToolKickEvent, ModToolKickEvent.class); - this.registerHandler(Incoming.ModToolRoomAlertEvent, ModToolRoomAlertEvent.class); - this.registerHandler(Incoming.ModToolRequestUserChatlogEvent, ModToolRequestUserChatlogEvent.class); - this.registerHandler(Incoming.ModToolChangeRoomSettingsEvent, ModToolChangeRoomSettingsEvent.class); - this.registerHandler(Incoming.ModToolRequestRoomVisitsEvent, ModToolRequestRoomVisitsEvent.class); - this.registerHandler(Incoming.ModToolRequestIssueChatlogEvent, ModToolRequestIssueChatlogEvent.class); - this.registerHandler(Incoming.ModToolRequestRoomUserChatlogEvent, ModToolRequestRoomUserChatlogEvent.class); - - this.registerHandler(Incoming.RequestReportRoomEvent, RequestReportRoomEvent.class); - this.registerHandler(Incoming.ReportEvent, ReportEvent.class); - } - - void registerTrading() { - this.registerHandler(Incoming.TradeStartEvent, TradeStartEvent.class); - this.registerHandler(Incoming.TradeOfferItemEvent, TradeOfferItemEvent.class); - this.registerHandler(Incoming.TradeCancelOfferItemEvent, TradeCancelOfferItemEvent.class); - this.registerHandler(Incoming.TradeAcceptEvent, TradeAcceptEvent.class); - this.registerHandler(Incoming.TradeUnAcceptEvent, TradeUnAcceptEvent.class); - this.registerHandler(Incoming.TradeConfirmEvent, TradeConfirmEvent.class); - this.registerHandler(Incoming.TradeCloseEvent, TradeCloseEvent.class); - } - - void registerGuilds() { - this.registerHandler(Incoming.RequestGuildBuyRoomsEvent, RequestGuildBuyRoomsEvent.class); - this.registerHandler(Incoming.RequestGuildPartsEvent, RequestGuildPartsEvent.class); - this.registerHandler(Incoming.RequestGuildBuyEvent, RequestGuildBuyEvent.class); - this.registerHandler(Incoming.RequestGuildInfoEvent, RequestGuildInfoEvent.class); - this.registerHandler(Incoming.RequestGuildManageEvent, RequestGuildManageEvent.class); - this.registerHandler(Incoming.RequestGuildMembersEvent, RequestGuildMembersEvent.class); - this.registerHandler(Incoming.RequestGuildJoinEvent, RequestGuildJoinEvent.class); - this.registerHandler(Incoming.GuildChangeNameDescEvent, GuildChangeNameDescEvent.class); - this.registerHandler(Incoming.GuildChangeBadgeEvent, GuildChangeBadgeEvent.class); - this.registerHandler(Incoming.GuildChangeColorsEvent, GuildChangeColorsEvent.class); - this.registerHandler(Incoming.GuildRemoveAdminEvent, GuildRemoveAdminEvent.class); - this.registerHandler(Incoming.GuildRemoveMemberEvent, GuildRemoveMemberEvent.class); - this.registerHandler(Incoming.GuildChangeSettingsEvent, GuildChangeSettingsEvent.class); - this.registerHandler(Incoming.GuildAcceptMembershipEvent, GuildAcceptMembershipEvent.class); - this.registerHandler(Incoming.GuildDeclineMembershipEvent, GuildDeclineMembershipEvent.class); - this.registerHandler(Incoming.GuildSetAdminEvent, GuildSetAdminEvent.class); - this.registerHandler(Incoming.GuildSetFavoriteEvent, GuildSetFavoriteEvent.class); - this.registerHandler(Incoming.RequestOwnGuildsEvent, RequestOwnGuildsEvent.class); - this.registerHandler(Incoming.RequestGuildFurniWidgetEvent, RequestGuildFurniWidgetEvent.class); - this.registerHandler(Incoming.GuildConfirmRemoveMemberEvent, GuildConfirmRemoveMemberEvent.class); - //this.registerHandler(Incoming.GuildRemoveFavoriteEvent, GuildRemoveFavoriteEvent.class); - this.registerHandler(Incoming.GuildDeleteEvent, GuildDeleteEvent.class); - } - - void registerPets() { - this.registerHandler(Incoming.RequestPetInformationEvent, RequestPetInformationEvent.class); - this.registerHandler(Incoming.PetPickupEvent, PetPickupEvent.class); - this.registerHandler(Incoming.ScratchPetEvent, ScratchPetEvent.class); - this.registerHandler(Incoming.RequestPetTrainingPanelEvent, RequestPetTrainingPanelEvent.class); - this.registerHandler(Incoming.PetUseItemEvent, PetUseItemEvent.class); - this.registerHandler(Incoming.HorseRideSettingsEvent, PetRideSettingsEvent.class); - this.registerHandler(Incoming.HorseRideEvent, PetRideEvent.class); - } - - void registerWired() { - this.registerHandler(Incoming.WiredTriggerSaveDataEvent, WiredTriggerSaveDataEvent.class); - this.registerHandler(Incoming.WiredEffectSaveDataEvent, WiredEffectSaveDataEvent.class); - this.registerHandler(Incoming.WiredConditionSaveDataEvent, WiredConditionSaveDataEvent.class); - } - - void registerUnknown() { - this.registerHandler(Incoming.RequestResolutionEvent, RequestResolutionEvent.class); - this.registerHandler(Incoming.RequestTalenTrackEvent, RequestTalentTrackEvent.class); //TODO - this.registerHandler(Incoming.UnknownEvent1, UnknownEvent1.class); - } - - void registerFloorPlanEditor() { - this.registerHandler(Incoming.FloorPlanEditorSaveEvent, FloorPlanEditorSaveEvent.class); - this.registerHandler(Incoming.FloorPlanEditorRequestBlockedTilesEvent, FloorPlanEditorRequestBlockedTilesEvent.class); - this.registerHandler(Incoming.FloorPlanEditorRequestDoorSettingsEvent, FloorPlanEditorRequestDoorSettingsEvent.class); - } - - void registerAchievements() { - this.registerHandler(Incoming.RequestAchievementsEvent, RequestAchievementsEvent.class); - } -} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/incoming/Incoming.java b/src/main/java/com/eu/habbo/messages/incoming/Incoming.java index dea1137b..ee3b7193 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/Incoming.java +++ b/src/main/java/com/eu/habbo/messages/incoming/Incoming.java @@ -18,7 +18,6 @@ public class Incoming { public static final int HorseRideEvent = 1036; public static final int RequestCreateRoomEvent = 2752; public static final int SaveMottoEvent = 2228; - public static final int GenerateSecretKeyEvent = -1;//3575 public static final int ModToolAlertEvent = 1840; public static final int TradeAcceptEvent = 3863; public static final int RequestCatalogModeEvent = 1195; @@ -78,7 +77,6 @@ public class Incoming { public static final int MannequinSaveNameEvent = 2850; public static final int SellItemEvent = 3447; public static final int GuildAcceptMembershipEvent = 3386; - public static final int RequestBannerToken = -1;//2619 public static final int RequestRecylerLogicEvent = 398; public static final int RequestGuildJoinEvent = 998; public static final int RequestCatalogIndexEvent = 2529; @@ -111,6 +109,8 @@ public class Incoming { public static final int AcceptFriendRequest = 137; public static final int DeclineFriendRequest = 2890; //835; //TODO public static final int ReleaseVersionEvent = 4000;//4000 + public static final int InitDiffieHandshake = 3110; + public static final int CompleteDiffieHandshake = 773; public static final int SearchRoomsMyFavoriteEvent = 2578; public static final int TradeStartEvent = 1481; public static final int RequestTargetOfferEvent = 2487; diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/CompleteDiffieHandshakeEvent.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/CompleteDiffieHandshakeEvent.java new file mode 100644 index 00000000..fb2f290f --- /dev/null +++ b/src/main/java/com/eu/habbo/messages/incoming/handshake/CompleteDiffieHandshakeEvent.java @@ -0,0 +1,27 @@ +package com.eu.habbo.messages.incoming.handshake; + +import com.eu.habbo.crypto.HabboRC4; +import com.eu.habbo.messages.NoAuthMessage; +import com.eu.habbo.messages.incoming.MessageHandler; +import com.eu.habbo.messages.outgoing.handshake.CompleteDiffieHandshakeComposer; +import com.eu.habbo.networking.gameserver.GameByteDecryption; +import com.eu.habbo.networking.gameserver.GameByteEncryption; +import com.eu.habbo.networking.gameserver.GameServerAttributes; + +@NoAuthMessage +public class CompleteDiffieHandshakeEvent extends MessageHandler { + + @Override + public void handle() throws Exception { + byte[] sharedKey = this.client.getEncryption().getDiffie().getSharedKey(this.packet.readString()); + + this.client.sendResponse(new CompleteDiffieHandshakeComposer(this.client.getEncryption().getDiffie().getPublicKey())); + + this.client.getChannel().attr(GameServerAttributes.CRYPTO_CLIENT).set(new HabboRC4(sharedKey)); + this.client.getChannel().attr(GameServerAttributes.CRYPTO_SERVER).set(new HabboRC4(sharedKey)); + + this.client.getChannel().pipeline().addFirst(new GameByteDecryption()); + this.client.getChannel().pipeline().addFirst(new GameByteEncryption()); + } + +} diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/GenerateSecretKeyEvent.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/GenerateSecretKeyEvent.java deleted file mode 100644 index 1e6fbff3..00000000 --- a/src/main/java/com/eu/habbo/messages/incoming/handshake/GenerateSecretKeyEvent.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.eu.habbo.messages.incoming.handshake; - -import com.eu.habbo.messages.incoming.MessageHandler; - -public class GenerateSecretKeyEvent extends MessageHandler { - - @Override - public void handle() throws Exception { - this.packet.readString(); - } -} diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/InitDiffieHandshakeEvent.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/InitDiffieHandshakeEvent.java new file mode 100644 index 00000000..e0e6424a --- /dev/null +++ b/src/main/java/com/eu/habbo/messages/incoming/handshake/InitDiffieHandshakeEvent.java @@ -0,0 +1,17 @@ +package com.eu.habbo.messages.incoming.handshake; + +import com.eu.habbo.messages.NoAuthMessage; +import com.eu.habbo.messages.incoming.MessageHandler; +import com.eu.habbo.messages.outgoing.handshake.InitDiffieHandshakeComposer; + +@NoAuthMessage +public class InitDiffieHandshakeEvent extends MessageHandler { + + @Override + public void handle() throws Exception { + this.client.sendResponse(new InitDiffieHandshakeComposer( + this.client.getEncryption().getDiffie().getSignedPrime(), + this.client.getEncryption().getDiffie().getSignedGenerator())); + } + +} diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/RequestBannerToken.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/RequestBannerToken.java deleted file mode 100644 index b5c751dc..00000000 --- a/src/main/java/com/eu/habbo/messages/incoming/handshake/RequestBannerToken.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.eu.habbo.messages.incoming.handshake; - -import com.eu.habbo.messages.incoming.MessageHandler; -import com.eu.habbo.messages.outgoing.handshake.BannerTokenComposer; - -public class RequestBannerToken extends MessageHandler { - - @Override - public void handle() throws Exception { - this.client.sendResponse(new BannerTokenComposer("Stop loggin, Imma ban your ass", false)); - } -} diff --git a/src/main/java/com/eu/habbo/messages/outgoing/Outgoing.java b/src/main/java/com/eu/habbo/messages/outgoing/Outgoing.java index b1d7dd27..38cba122 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/Outgoing.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/Outgoing.java @@ -66,7 +66,8 @@ public class Outgoing { public final static int UserBadgesComposer = 1087; public final static int GuildManageComposer = 3965; public final static int RemoveFriendComposer = -1;//error 404 - public final static int BannerTokenComposer = -1;//error 404 + public final static int InitDiffieHandshakeComposer = 1347; + public final static int CompleteDiffieHandshakeComposer = 3885; public final static int UserDataComposer = 2725; public final static int UserSearchResultComposer = 973; public final static int ModToolUserRoomVisitsComposer = 1752; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/handshake/BannerTokenComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/handshake/BannerTokenComposer.java deleted file mode 100644 index fb94d89a..00000000 --- a/src/main/java/com/eu/habbo/messages/outgoing/handshake/BannerTokenComposer.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.eu.habbo.messages.outgoing.handshake; - -import com.eu.habbo.messages.ServerMessage; -import com.eu.habbo.messages.outgoing.MessageComposer; -import com.eu.habbo.messages.outgoing.Outgoing; - -public class BannerTokenComposer extends MessageComposer { - private final String token; - private final boolean unknown; - - public BannerTokenComposer(String token, boolean unknown) { - this.token = token; - this.unknown = unknown; - } - - @Override - public ServerMessage compose() { - this.response.init(Outgoing.BannerTokenComposer); - this.response.appendString(this.token); - this.response.appendBoolean(this.unknown); - - return this.response; - } -} diff --git a/src/main/java/com/eu/habbo/messages/outgoing/handshake/CompleteDiffieHandshakeComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/handshake/CompleteDiffieHandshakeComposer.java new file mode 100644 index 00000000..96dfda3b --- /dev/null +++ b/src/main/java/com/eu/habbo/messages/outgoing/handshake/CompleteDiffieHandshakeComposer.java @@ -0,0 +1,29 @@ +package com.eu.habbo.messages.outgoing.handshake; + +import com.eu.habbo.messages.ServerMessage; +import com.eu.habbo.messages.outgoing.MessageComposer; +import com.eu.habbo.messages.outgoing.Outgoing; + +public class CompleteDiffieHandshakeComposer extends MessageComposer { + + private final String publicKey; + private final boolean clientEncryption; + + public CompleteDiffieHandshakeComposer(String publicKey) { + this(publicKey, true); + } + + public CompleteDiffieHandshakeComposer(String publicKey, boolean clientEncryption) { + this.publicKey = publicKey; + this.clientEncryption = clientEncryption; + } + + @Override + public ServerMessage compose() { + this.response.init(Outgoing.CompleteDiffieHandshakeComposer); + this.response.appendString(this.publicKey); + this.response.appendBoolean(this.clientEncryption); + return this.response; + } + +} diff --git a/src/main/java/com/eu/habbo/messages/outgoing/handshake/InitDiffieHandshakeComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/handshake/InitDiffieHandshakeComposer.java new file mode 100644 index 00000000..2952edde --- /dev/null +++ b/src/main/java/com/eu/habbo/messages/outgoing/handshake/InitDiffieHandshakeComposer.java @@ -0,0 +1,25 @@ +package com.eu.habbo.messages.outgoing.handshake; + +import com.eu.habbo.messages.ServerMessage; +import com.eu.habbo.messages.outgoing.MessageComposer; +import com.eu.habbo.messages.outgoing.Outgoing; + +public class InitDiffieHandshakeComposer extends MessageComposer { + + private final String signedPrime; + private final String signedGenerator; + + public InitDiffieHandshakeComposer(String signedPrime, String signedGenerator) { + this.signedPrime = signedPrime; + this.signedGenerator = signedGenerator; + } + + @Override + public ServerMessage compose() { + this.response.init(Outgoing.InitDiffieHandshakeComposer); + this.response.appendString(this.signedPrime); + this.response.appendString(this.signedGenerator); + return this.response; + } + +} diff --git a/src/main/java/com/eu/habbo/networking/gameserver/GameByteDecryption.java b/src/main/java/com/eu/habbo/networking/gameserver/GameByteDecryption.java new file mode 100644 index 00000000..27a6fcef --- /dev/null +++ b/src/main/java/com/eu/habbo/networking/gameserver/GameByteDecryption.java @@ -0,0 +1,28 @@ +package com.eu.habbo.networking.gameserver; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.ByteToMessageDecoder; + +import java.util.List; + +public class GameByteDecryption extends ByteToMessageDecoder { + + public GameByteDecryption() { + setSingleDecode(true); + } + + @Override + protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) { + // Read all available bytes. + byte[] data = in.readBytes(in.readableBytes()).array(); + + // Decrypt. + ctx.channel().attr(GameServerAttributes.CRYPTO_CLIENT).get().parse(data); + + // Continue in the pipeline. + out.add(Unpooled.wrappedBuffer(data)); + } + +} diff --git a/src/main/java/com/eu/habbo/networking/gameserver/GameByteEncryption.java b/src/main/java/com/eu/habbo/networking/gameserver/GameByteEncryption.java new file mode 100644 index 00000000..3f3fcce4 --- /dev/null +++ b/src/main/java/com/eu/habbo/networking/gameserver/GameByteEncryption.java @@ -0,0 +1,26 @@ +package com.eu.habbo.networking.gameserver; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelOutboundHandlerAdapter; +import io.netty.channel.ChannelPromise; + +public class GameByteEncryption extends ChannelOutboundHandlerAdapter { + + @Override + public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { + // Convert msg to ByteBuf. + ByteBuf out = (ByteBuf) msg; + + // Read all available bytes. + byte[] data = out.array(); + + // Encrypt. + ctx.channel().attr(GameServerAttributes.CRYPTO_SERVER).get().parse(data); + + // Continue in the pipeline. + ctx.write(Unpooled.wrappedBuffer(data)); + } + +} diff --git a/src/main/java/com/eu/habbo/networking/gameserver/GameServerAttributes.java b/src/main/java/com/eu/habbo/networking/gameserver/GameServerAttributes.java new file mode 100644 index 00000000..fca00731 --- /dev/null +++ b/src/main/java/com/eu/habbo/networking/gameserver/GameServerAttributes.java @@ -0,0 +1,13 @@ +package com.eu.habbo.networking.gameserver; + +import com.eu.habbo.crypto.HabboRC4; +import com.eu.habbo.habbohotel.gameclients.GameClient; +import io.netty.util.AttributeKey; + +public class GameServerAttributes { + + public static final AttributeKey CLIENT = AttributeKey.valueOf("GameClient"); + public static final AttributeKey CRYPTO_CLIENT = AttributeKey.valueOf("CryptoClient"); + public static final AttributeKey CRYPTO_SERVER = AttributeKey.valueOf("CryptoServer"); + +} diff --git a/src/main/java/com/eu/habbo/threading/runnables/ChannelReadHandler.java b/src/main/java/com/eu/habbo/threading/runnables/ChannelReadHandler.java index 59ccd39a..918ca4c2 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/ChannelReadHandler.java +++ b/src/main/java/com/eu/habbo/threading/runnables/ChannelReadHandler.java @@ -4,6 +4,7 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClientManager; import com.eu.habbo.messages.ClientMessage; +import com.eu.habbo.networking.gameserver.GameServerAttributes; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandlerContext; @@ -24,7 +25,7 @@ public class ChannelReadHandler implements Runnable { int length = m.readInt(); short header = m.readShort(); //_header = header; - GameClient client = this.ctx.channel().attr(GameClientManager.CLIENT).get(); + GameClient client = this.ctx.channel().attr(GameServerAttributes.CLIENT).get(); if (m.readableBytes() + 2 < length) { return; From a206a281640b04c9f59e292b69a5d68282d88be4 Mon Sep 17 00:00:00 2001 From: narzo <127-narzo62@users.noreply.git.krews.org> Date: Fri, 1 May 2020 20:52:46 -0400 Subject: [PATCH 036/215] Fix InteractionBattleBanzaiPuck cannot be moved when in a corner --- .../games/battlebanzai/InteractionBattleBanzaiPuck.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiPuck.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiPuck.java index 5c28cda7..67436d2a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiPuck.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiPuck.java @@ -124,7 +124,10 @@ public class InteractionBattleBanzaiPuck extends InteractionPushable { @Override public boolean validMove(Room room, RoomTile from, RoomTile to) { - return room != null && from != null && to != null; + if (to == null) return false; + HabboItem topItem = room.getTopItemAt(to.x, to.y, this); + return !(!room.getLayout().tileWalkable(to.x, to.y) || (topItem != null && (!topItem.getBaseItem().allowStack() || topItem.getBaseItem().allowSit() || topItem.getBaseItem().allowLay()))); + //return !(!room.getLayout().tileWalkable(to.x, to.y) || (topItem != null && (!topItem.getBaseItem().setAllowStack() || topItem.getBaseItem().allowSit() || topItem.getBaseItem().allowLay()))); } From 90061e8d7d40959caf30f36a72693783d006dcd7 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Sat, 2 May 2020 03:17:59 +0200 Subject: [PATCH 037/215] Clean up netty pipeline and actually use it. --- .../habbohotel/gameclients/GameClient.java | 19 ++----- .../com/eu/habbo/messages/ClientMessage.java | 4 ++ .../com/eu/habbo/messages/ServerMessage.java | 5 ++ .../CompleteDiffieHandshakeEvent.java | 4 +- .../gameserver/GameByteDecoder.java | 54 ------------------ .../networking/gameserver/GameServer.java | 24 +++++++- .../gameserver/decoders/GameByteDecoder.java | 19 +++++++ .../{ => decoders}/GameByteDecryption.java | 3 +- .../decoders/GameByteFrameDecoder.java | 26 +++++++++ .../{ => decoders}/GameMessageHandler.java | 21 +++++-- .../decoders/GameMessageRateLimit.java | 49 ++++++++++++++++ .../decoders/GamePolicyDecoder.java | 39 +++++++++++++ .../{ => encoders}/GameByteEncryption.java | 11 +++- .../encoders/GameServerMessageLogger.java | 20 +++++++ .../encoders/MessageComposerEncoder.java | 16 ++++++ .../encoders/ServerMessageEncoder.java | 22 +++++++ .../runnables/ChannelReadHandler.java | 57 +++---------------- 17 files changed, 264 insertions(+), 129 deletions(-) delete mode 100644 src/main/java/com/eu/habbo/networking/gameserver/GameByteDecoder.java create mode 100644 src/main/java/com/eu/habbo/networking/gameserver/decoders/GameByteDecoder.java rename src/main/java/com/eu/habbo/networking/gameserver/{ => decoders}/GameByteDecryption.java (86%) create mode 100644 src/main/java/com/eu/habbo/networking/gameserver/decoders/GameByteFrameDecoder.java rename src/main/java/com/eu/habbo/networking/gameserver/{ => decoders}/GameMessageHandler.java (67%) create mode 100644 src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageRateLimit.java create mode 100644 src/main/java/com/eu/habbo/networking/gameserver/decoders/GamePolicyDecoder.java rename src/main/java/com/eu/habbo/networking/gameserver/{ => encoders}/GameByteEncryption.java (70%) create mode 100644 src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java create mode 100644 src/main/java/com/eu/habbo/networking/gameserver/encoders/MessageComposerEncoder.java create mode 100644 src/main/java/com/eu/habbo/networking/gameserver/encoders/ServerMessageEncoder.java diff --git a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java index 1e5120a2..a4a1ea53 100644 --- a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java +++ b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java @@ -80,8 +80,8 @@ public class GameClient { public void sendResponse(MessageComposer composer) { if (this.channel.isOpen()) { try { - ServerMessage msg = composer.compose(); - this.sendResponse(msg); + this.channel.write(composer, this.channel.voidPromise()); + this.channel.flush(); } catch (Exception e) { Emulator.getLogging().logPacketError(e); } @@ -94,32 +94,23 @@ public class GameClient { return; } - if (PacketManager.DEBUG_SHOW_PACKETS) - Emulator.getLogging().logPacketLine("[" + Logging.ANSI_PURPLE + "SERVER" + Logging.ANSI_RESET + "] => [" + response.getHeader() + "] -> " + response.getBodyString()); - - this.channel.write(response.get(), this.channel.voidPromise()); + this.channel.write(response, this.channel.voidPromise()); this.channel.flush(); } } public void sendResponses(ArrayList responses) { - ByteBuf buffer = Unpooled.buffer(); - if (this.channel.isOpen()) { for (ServerMessage response : responses) { if (response == null || response.getHeader() <= 0) { return; } - if (PacketManager.DEBUG_SHOW_PACKETS) - Emulator.getLogging().logPacketLine("[" + Logging.ANSI_PURPLE + "SERVER" + Logging.ANSI_RESET + "] => [" + response.getHeader() + "] -> " + response.getBodyString()); - - buffer.writeBytes(response.get()); + this.channel.write(response); } - this.channel.write(buffer.copy(), this.channel.voidPromise()); + this.channel.flush(); } - buffer.release(); } public void dispose() { diff --git a/src/main/java/com/eu/habbo/messages/ClientMessage.java b/src/main/java/com/eu/habbo/messages/ClientMessage.java index 9859938e..4cbd2f2d 100644 --- a/src/main/java/com/eu/habbo/messages/ClientMessage.java +++ b/src/main/java/com/eu/habbo/messages/ClientMessage.java @@ -78,4 +78,8 @@ public class ClientMessage { return this.buffer.readableBytes(); } + public boolean release() { + return this.buffer.release(); + } + } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/ServerMessage.java b/src/main/java/com/eu/habbo/messages/ServerMessage.java index 2fb4d4df..e61d0d45 100644 --- a/src/main/java/com/eu/habbo/messages/ServerMessage.java +++ b/src/main/java/com/eu/habbo/messages/ServerMessage.java @@ -191,4 +191,9 @@ public class ServerMessage { return this.channelBuffer.copy(); } + + public void release() { + this.channelBuffer.release(); + } + } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/CompleteDiffieHandshakeEvent.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/CompleteDiffieHandshakeEvent.java index fb2f290f..83b015a9 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/handshake/CompleteDiffieHandshakeEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/handshake/CompleteDiffieHandshakeEvent.java @@ -4,8 +4,8 @@ import com.eu.habbo.crypto.HabboRC4; import com.eu.habbo.messages.NoAuthMessage; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.handshake.CompleteDiffieHandshakeComposer; -import com.eu.habbo.networking.gameserver.GameByteDecryption; -import com.eu.habbo.networking.gameserver.GameByteEncryption; +import com.eu.habbo.networking.gameserver.decoders.GameByteDecryption; +import com.eu.habbo.networking.gameserver.encoders.GameByteEncryption; import com.eu.habbo.networking.gameserver.GameServerAttributes; @NoAuthMessage diff --git a/src/main/java/com/eu/habbo/networking/gameserver/GameByteDecoder.java b/src/main/java/com/eu/habbo/networking/gameserver/GameByteDecoder.java deleted file mode 100644 index d6f096d2..00000000 --- a/src/main/java/com/eu/habbo/networking/gameserver/GameByteDecoder.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.eu.habbo.networking.gameserver; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.ByteToMessageDecoder; -import io.netty.util.CharsetUtil; - -import java.util.List; - -public class GameByteDecoder extends ByteToMessageDecoder { - @Override - protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) { - in.markReaderIndex(); - - //4 bytes length + 2 bytes header - if (in.readableBytes() < 6) { - in.resetReaderIndex(); - return; - } - - int length = in.readInt(); - - //if(length > 5120 && (length >> 24 != 60)) - //{ - - //} - - if (length == 1014001516) { - in.resetReaderIndex(); - //in.readBytes(in.readableBytes()); - - ChannelFuture f = ctx.writeAndFlush(Unpooled.copiedBuffer("\n" + - " \n" + - " \n" + - " \n" + - " " + (char) 0, CharsetUtil.UTF_8)); - - f.channel().close(); - ctx.channel().close(); - return; - } - - if (in.readableBytes() < length || length < 0) { - in.resetReaderIndex(); - return; - } - - in.resetReaderIndex(); - ByteBuf read = in.readBytes(length + 4); - out.add(read); - } -} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/networking/gameserver/GameServer.java b/src/main/java/com/eu/habbo/networking/gameserver/GameServer.java index e782887a..1b1a338e 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/GameServer.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/GameServer.java @@ -4,6 +4,10 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClientManager; import com.eu.habbo.messages.PacketManager; import com.eu.habbo.networking.Server; +import com.eu.habbo.networking.gameserver.decoders.*; +import com.eu.habbo.networking.gameserver.encoders.MessageComposerEncoder; +import com.eu.habbo.networking.gameserver.encoders.ServerMessageEncoder; +import com.eu.habbo.networking.gameserver.encoders.GameServerMessageLogger; import io.netty.channel.ChannelInitializer; import io.netty.channel.socket.SocketChannel; import io.netty.handler.logging.LoggingHandler; @@ -26,8 +30,24 @@ public class GameServer extends Server { @Override public void initChannel(SocketChannel ch) throws Exception { ch.pipeline().addLast("logger", new LoggingHandler()); - ch.pipeline().addLast("bytesDecoder", new GameByteDecoder()); - ch.pipeline().addLast(new GameMessageHandler()); + + // Decoders. + ch.pipeline().addLast( + new GamePolicyDecoder(), + new GameByteFrameDecoder(), + new GameByteDecoder(), + new GameMessageRateLimit(), + new GameMessageHandler() + ); + + // Encoders. + ch.pipeline().addLast(new ServerMessageEncoder()); + + if (PacketManager.DEBUG_SHOW_PACKETS) { + ch.pipeline().addLast(new GameServerMessageLogger()); + } + + ch.pipeline().addLast(new MessageComposerEncoder()); } }); } diff --git a/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameByteDecoder.java b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameByteDecoder.java new file mode 100644 index 00000000..e905eeea --- /dev/null +++ b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameByteDecoder.java @@ -0,0 +1,19 @@ +package com.eu.habbo.networking.gameserver.decoders; + +import com.eu.habbo.messages.ClientMessage; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.ByteToMessageDecoder; + +import java.util.List; + +public class GameByteDecoder extends ByteToMessageDecoder { + @Override + protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) { + short header = in.readShort(); + ByteBuf body = Unpooled.copiedBuffer(in.readBytes(in.readableBytes())); + + out.add(new ClientMessage(header, body)); + } +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/networking/gameserver/GameByteDecryption.java b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameByteDecryption.java similarity index 86% rename from src/main/java/com/eu/habbo/networking/gameserver/GameByteDecryption.java rename to src/main/java/com/eu/habbo/networking/gameserver/decoders/GameByteDecryption.java index 27a6fcef..6881e17f 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/GameByteDecryption.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameByteDecryption.java @@ -1,5 +1,6 @@ -package com.eu.habbo.networking.gameserver; +package com.eu.habbo.networking.gameserver.decoders; +import com.eu.habbo.networking.gameserver.GameServerAttributes; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandlerContext; diff --git a/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameByteFrameDecoder.java b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameByteFrameDecoder.java new file mode 100644 index 00000000..82e60ed4 --- /dev/null +++ b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameByteFrameDecoder.java @@ -0,0 +1,26 @@ +package com.eu.habbo.networking.gameserver.decoders; + +import io.netty.buffer.ByteBuf; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.LengthFieldBasedFrameDecoder; + +public class GameByteFrameDecoder extends LengthFieldBasedFrameDecoder { + + private static final int MAX_PACKET_LENGTH = 8192 * 4; + private static final int LENGTH_FIELD_OFFSET = 0; + private static final int LENGTH_FIELD_LENGTH = 4; + private static final int LENGTH_FIELD_ADJUSTMENT = 0; + private static final int INITIAL_BYTES_TO_STRIP = 4; + + public GameByteFrameDecoder() + { + super(MAX_PACKET_LENGTH, LENGTH_FIELD_OFFSET, LENGTH_FIELD_LENGTH, LENGTH_FIELD_ADJUSTMENT, INITIAL_BYTES_TO_STRIP); + } + + @Override + protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception + { + return super.decode(ctx, in); + } + +} diff --git a/src/main/java/com/eu/habbo/networking/gameserver/GameMessageHandler.java b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageHandler.java similarity index 67% rename from src/main/java/com/eu/habbo/networking/gameserver/GameMessageHandler.java rename to src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageHandler.java index 94b598b6..05e0164a 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/GameMessageHandler.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageHandler.java @@ -1,16 +1,19 @@ -package com.eu.habbo.networking.gameserver; +package com.eu.habbo.networking.gameserver.decoders; import com.eu.habbo.Emulator; +import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.PacketManager; import com.eu.habbo.threading.runnables.ChannelReadHandler; import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; +import io.netty.handler.codec.TooLongFrameException; import java.io.IOException; @ChannelHandler.Sharable public class GameMessageHandler extends ChannelInboundHandlerAdapter { + @Override public void channelRegistered(ChannelHandlerContext ctx) { if (!Emulator.getGameServer().getGameClientManager().addClient(ctx)) { @@ -25,8 +28,10 @@ public class GameMessageHandler extends ChannelInboundHandlerAdapter { @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { + ClientMessage message = (ClientMessage) msg; + try { - ChannelReadHandler handler = new ChannelReadHandler(ctx, msg); + ChannelReadHandler handler = new ChannelReadHandler(ctx, message); if (PacketManager.MULTI_THREADED_PACKET_HANDLING) { Emulator.getThreading().run(handler); @@ -46,12 +51,18 @@ public class GameMessageHandler extends ChannelInboundHandlerAdapter { @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { - if (cause instanceof Exception) { - if (!(cause instanceof IOException)) { - // cause.printStackTrace(Logging.getErrorsRuntimeWriter()); + if (cause instanceof TooLongFrameException) { + Emulator.getLogging().logErrorLine("Disconnecting client, reason: \"" + cause.getMessage() + "\"."); + } else { + Emulator.getLogging().logErrorLine("Disconnecting client, exception in GameMessageHander:"); + Emulator.getLogging().logErrorLine(cause.toString()); + + for (StackTraceElement element : cause.getStackTrace()) { + Emulator.getLogging().logErrorLine(element.toString()); } } ctx.channel().close(); } + } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageRateLimit.java b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageRateLimit.java new file mode 100644 index 00000000..7a4c8de2 --- /dev/null +++ b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageRateLimit.java @@ -0,0 +1,49 @@ +package com.eu.habbo.networking.gameserver.decoders; + +import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.gameclients.GameClient; +import com.eu.habbo.messages.ClientMessage; +import com.eu.habbo.networking.gameserver.GameServerAttributes; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.MessageToMessageDecoder; + +import java.util.List; + +public class GameMessageRateLimit extends MessageToMessageDecoder { + + private static final int RESET_TIME = 1; + private static final int MAX_COUNTER = 10; + + @Override + protected void decode(ChannelHandlerContext ctx, ClientMessage message, List out) throws Exception { + GameClient client = ctx.channel().attr(GameServerAttributes.CLIENT).get(); + + if (client == null) { + return; + } + + int count = 0; + + // Check if reset time has passed. + int timestamp = Emulator.getIntUnixTimestamp(); + if (timestamp - client.lastPacketCounterCleared > RESET_TIME) { + // Reset counter. + client.incomingPacketCounter.clear(); + client.lastPacketCounterCleared = timestamp; + } else { + // Get stored count for message id. + count = client.incomingPacketCounter.getOrDefault(message.getMessageId(), 0); + } + + // If we exceeded the counter, drop the packet. + if (count > MAX_COUNTER) { + return; + } + + client.incomingPacketCounter.put(message.getMessageId(), ++count); + + // Continue processing. + out.add(message); + } + +} diff --git a/src/main/java/com/eu/habbo/networking/gameserver/decoders/GamePolicyDecoder.java b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GamePolicyDecoder.java new file mode 100644 index 00000000..82938092 --- /dev/null +++ b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GamePolicyDecoder.java @@ -0,0 +1,39 @@ +package com.eu.habbo.networking.gameserver.decoders; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import io.netty.channel.ChannelFutureListener; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.ByteToMessageDecoder; +import io.netty.util.CharsetUtil; + +import java.util.List; + +public class GamePolicyDecoder extends ByteToMessageDecoder { + + private static final String POLICY = "\n" + + " \n" + + " \n" + + " \n" + + " " + (char) 0; + + @Override + protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) throws Exception { + in.markReaderIndex(); + + byte b = in.readByte(); + if (b == '<') { + in.resetReaderIndex(); + ctx.writeAndFlush(Unpooled.copiedBuffer(POLICY, CharsetUtil.UTF_8)) + .addListener(ChannelFutureListener.CLOSE); + return; + } + + // Remove ourselves since the first packet was not a policy request. + ctx.pipeline().remove(this); + + // Continue to the other pipelines. + in.resetReaderIndex(); + } + +} diff --git a/src/main/java/com/eu/habbo/networking/gameserver/GameByteEncryption.java b/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameByteEncryption.java similarity index 70% rename from src/main/java/com/eu/habbo/networking/gameserver/GameByteEncryption.java rename to src/main/java/com/eu/habbo/networking/gameserver/encoders/GameByteEncryption.java index 3f3fcce4..895addd0 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/GameByteEncryption.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameByteEncryption.java @@ -1,5 +1,6 @@ -package com.eu.habbo.networking.gameserver; +package com.eu.habbo.networking.gameserver.encoders; +import com.eu.habbo.networking.gameserver.GameServerAttributes; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandlerContext; @@ -14,7 +15,13 @@ public class GameByteEncryption extends ChannelOutboundHandlerAdapter { ByteBuf out = (ByteBuf) msg; // Read all available bytes. - byte[] data = out.array(); + byte[] data; + + if (out.hasArray()) { + data = out.array(); + } else { + data = out.readBytes(out.readableBytes()).array(); + } // Encrypt. ctx.channel().attr(GameServerAttributes.CRYPTO_SERVER).get().parse(data); diff --git a/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java b/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java new file mode 100644 index 00000000..224e227f --- /dev/null +++ b/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java @@ -0,0 +1,20 @@ +package com.eu.habbo.networking.gameserver.encoders; + +import com.eu.habbo.Emulator; +import com.eu.habbo.core.Logging; +import com.eu.habbo.messages.ServerMessage; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.MessageToMessageEncoder; + +import java.util.List; + +public class GameServerMessageLogger extends MessageToMessageEncoder { + + @Override + protected void encode(ChannelHandlerContext ctx, ServerMessage message, List out) throws Exception { + Emulator.getLogging().logPacketLine("[" + Logging.ANSI_PURPLE + "SERVER" + Logging.ANSI_RESET + "] => [" + message.getHeader() + "] -> " + message.getBodyString()); + + out.add(message); + } + +} diff --git a/src/main/java/com/eu/habbo/networking/gameserver/encoders/MessageComposerEncoder.java b/src/main/java/com/eu/habbo/networking/gameserver/encoders/MessageComposerEncoder.java new file mode 100644 index 00000000..a1a98cb7 --- /dev/null +++ b/src/main/java/com/eu/habbo/networking/gameserver/encoders/MessageComposerEncoder.java @@ -0,0 +1,16 @@ +package com.eu.habbo.networking.gameserver.encoders; + +import com.eu.habbo.messages.outgoing.MessageComposer; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.MessageToMessageEncoder; + +import java.util.List; + +public class MessageComposerEncoder extends MessageToMessageEncoder { + + @Override + protected void encode(ChannelHandlerContext ctx, MessageComposer message, List out) throws Exception { + out.add(message.compose()); + } + +} diff --git a/src/main/java/com/eu/habbo/networking/gameserver/encoders/ServerMessageEncoder.java b/src/main/java/com/eu/habbo/networking/gameserver/encoders/ServerMessageEncoder.java new file mode 100644 index 00000000..928264d4 --- /dev/null +++ b/src/main/java/com/eu/habbo/networking/gameserver/encoders/ServerMessageEncoder.java @@ -0,0 +1,22 @@ +package com.eu.habbo.networking.gameserver.encoders; + +import com.eu.habbo.messages.ServerMessage; +import io.netty.buffer.ByteBuf; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.MessageToByteEncoder; + +public class ServerMessageEncoder extends MessageToByteEncoder { + + @Override + protected void encode(ChannelHandlerContext ctx, ServerMessage message, ByteBuf out) { + ByteBuf buf = message.get(); + + try { + out.writeBytes(buf); + } finally { + buf.release(); + message.release(); + } + } + +} diff --git a/src/main/java/com/eu/habbo/threading/runnables/ChannelReadHandler.java b/src/main/java/com/eu/habbo/threading/runnables/ChannelReadHandler.java index 918ca4c2..a4caf09f 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/ChannelReadHandler.java +++ b/src/main/java/com/eu/habbo/threading/runnables/ChannelReadHandler.java @@ -2,70 +2,29 @@ package com.eu.habbo.threading.runnables; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.gameclients.GameClientManager; import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.networking.gameserver.GameServerAttributes; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandlerContext; public class ChannelReadHandler implements Runnable { - private final ChannelHandlerContext ctx; - private final Object msg; - //private int _header; - public ChannelReadHandler(ChannelHandlerContext ctx, Object msg) { + private final ChannelHandlerContext ctx; + private final ClientMessage message; + + public ChannelReadHandler(ChannelHandlerContext ctx, ClientMessage message) { this.ctx = ctx; - this.msg = msg; + this.message = message; } public void run() { try { - ByteBuf m = (ByteBuf) this.msg; - int length = m.readInt(); - short header = m.readShort(); - //_header = header; GameClient client = this.ctx.channel().attr(GameServerAttributes.CLIENT).get(); - if (m.readableBytes() + 2 < length) { - return; - } - if (client != null) { - int count = 0; - int timestamp = Emulator.getIntUnixTimestamp(); - if (timestamp - client.lastPacketCounterCleared > 1) { - client.incomingPacketCounter.clear(); - client.lastPacketCounterCleared = timestamp; - } else { - if (m.readableBytes() + 2 < length) { - m.resetReaderIndex(); - client.incomingPacketCounter.put((int) header, 0); - count = 0; - return; - } else { - count = client.incomingPacketCounter.getOrDefault(header, 0); - } - } - - if (count <= 10) { - count++; - if (m.readableBytes() + 2 < length) { - m.resetReaderIndex(); - client.incomingPacketCounter.put((int) header, 0); - count = 0; - return; - } - client.incomingPacketCounter.put((int) header, count); - ByteBuf body = Unpooled.wrappedBuffer(m.readBytes(m.readableBytes())); - Emulator.getGameServer().getPacketManager().handlePacket(client, new ClientMessage(header, body)); - body.release(); - } + Emulator.getGameServer().getPacketManager().handlePacket(client, message); } - - m.release(); - } catch (Exception e) { - //System.out.println("Potential packet overflow occurring, careful! header: " + _header + e.getMessage()); + } finally { + this.message.release(); } } } From 208be6210cc7ff52c4499880ad93378b4d93f962 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Sat, 2 May 2020 03:38:22 +0200 Subject: [PATCH 038/215] Null check for when encryption is disabled. --- .../incoming/handshake/CompleteDiffieHandshakeEvent.java | 6 ++++++ .../incoming/handshake/InitDiffieHandshakeEvent.java | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/CompleteDiffieHandshakeEvent.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/CompleteDiffieHandshakeEvent.java index 83b015a9..3794c800 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/handshake/CompleteDiffieHandshakeEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/handshake/CompleteDiffieHandshakeEvent.java @@ -1,5 +1,6 @@ package com.eu.habbo.messages.incoming.handshake; +import com.eu.habbo.Emulator; import com.eu.habbo.crypto.HabboRC4; import com.eu.habbo.messages.NoAuthMessage; import com.eu.habbo.messages.incoming.MessageHandler; @@ -13,6 +14,11 @@ public class CompleteDiffieHandshakeEvent extends MessageHandler { @Override public void handle() throws Exception { + if (this.client.getEncryption() == null) { + Emulator.getGameServer().getGameClientManager().disposeClient(this.client); + return; + } + byte[] sharedKey = this.client.getEncryption().getDiffie().getSharedKey(this.packet.readString()); this.client.sendResponse(new CompleteDiffieHandshakeComposer(this.client.getEncryption().getDiffie().getPublicKey())); diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/InitDiffieHandshakeEvent.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/InitDiffieHandshakeEvent.java index e0e6424a..3f0a3823 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/handshake/InitDiffieHandshakeEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/handshake/InitDiffieHandshakeEvent.java @@ -1,5 +1,6 @@ package com.eu.habbo.messages.incoming.handshake; +import com.eu.habbo.Emulator; import com.eu.habbo.messages.NoAuthMessage; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.handshake.InitDiffieHandshakeComposer; @@ -9,6 +10,11 @@ public class InitDiffieHandshakeEvent extends MessageHandler { @Override public void handle() throws Exception { + if (this.client.getEncryption() == null) { + Emulator.getGameServer().getGameClientManager().disposeClient(this.client); + return; + } + this.client.sendResponse(new InitDiffieHandshakeComposer( this.client.getEncryption().getDiffie().getSignedPrime(), this.client.getEncryption().getDiffie().getSignedGenerator())); From 57f66a1514eb2df8e45d8ad8d585a596e34a1cbf Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Sat, 2 May 2020 04:36:26 +0200 Subject: [PATCH 039/215] Force encryption to be used when it is enabled. Not doing this check would make it possible to skip encryption when it is enabled. --- .../com/eu/habbo/habbohotel/gameclients/GameClient.java | 9 +++++++++ .../incoming/handshake/CompleteDiffieHandshakeEvent.java | 1 + .../messages/incoming/handshake/SecureLoginEvent.java | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java index a4a1ea53..956620b6 100644 --- a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java +++ b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java @@ -24,6 +24,7 @@ public class GameClient { private final HabboEncryption encryption; private Habbo habbo; + private boolean handshakeFinished; private String machineId = ""; public final ConcurrentHashMap incomingPacketCounter = new ConcurrentHashMap<>(25); @@ -56,6 +57,14 @@ public class GameClient { this.habbo = habbo; } + public boolean isHandshakeFinished() { + return handshakeFinished; + } + + public void setHandshakeFinished(boolean handshakeFinished) { + this.handshakeFinished = handshakeFinished; + } + public String getMachineId() { return this.machineId; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/CompleteDiffieHandshakeEvent.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/CompleteDiffieHandshakeEvent.java index 3794c800..f4c218eb 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/handshake/CompleteDiffieHandshakeEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/handshake/CompleteDiffieHandshakeEvent.java @@ -21,6 +21,7 @@ public class CompleteDiffieHandshakeEvent extends MessageHandler { byte[] sharedKey = this.client.getEncryption().getDiffie().getSharedKey(this.packet.readString()); + this.client.setHandshakeFinished(true); this.client.sendResponse(new CompleteDiffieHandshakeComposer(this.client.getEncryption().getDiffie().getPublicKey())); this.client.getChannel().attr(GameServerAttributes.CRYPTO_CLIENT).set(new HabboRC4(sharedKey)); diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java index 84d3d5e9..13d1ee87 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java @@ -51,6 +51,11 @@ public class SecureLoginEvent extends MessageHandler { if (!Emulator.isReady) return; + if (Emulator.getCrypto().isEnabled() && !this.client.isHandshakeFinished()) { + Emulator.getGameServer().getGameClientManager().disposeClient(this.client); + return; + } + String sso = this.packet.readString().replace(" ", ""); if (Emulator.getPluginManager().fireEvent(new SSOAuthenticationEvent(sso)).isCancelled()) { From 1b97707bc757a0528e3f420661ef3568f9d6c1d7 Mon Sep 17 00:00:00 2001 From: Beny Date: Sat, 2 May 2020 23:53:59 +0200 Subject: [PATCH 040/215] Fix rotating monster plants --- .../eu/habbo/messages/incoming/rooms/pets/MovePetEvent.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/MovePetEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/MovePetEvent.java index fdd98baf..2038450d 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/MovePetEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/MovePetEvent.java @@ -3,6 +3,7 @@ package com.eu.habbo.messages.incoming.rooms.pets; import com.eu.habbo.habbohotel.pets.Pet; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; +import com.eu.habbo.habbohotel.rooms.RoomUserRotation; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer; @@ -23,7 +24,8 @@ public class MovePetEvent extends MessageHandler { if (tile != null) { pet.getRoomUnit().setLocation(tile); pet.getRoomUnit().setPreviousLocation(tile); - pet.getRoomUnit().setZ(this.packet.readInt() + tile.z); + pet.getRoomUnit().setZ(tile.z); + pet.getRoomUnit().setRotation(RoomUserRotation.fromValue(this.packet.readInt())); pet.getRoomUnit().setPreviousLocationZ(pet.getRoomUnit().getZ()); room.sendComposer(new RoomUserStatusComposer(pet.getRoomUnit()).compose()); pet.needsUpdate = true; From c590e49ff1ef9c7acafb73d5913b42c10c9a729d Mon Sep 17 00:00:00 2001 From: Beny Date: Sun, 3 May 2020 00:33:02 +0200 Subject: [PATCH 041/215] Fix sometimes incorrect Habbo height on item pickup --- .../com/eu/habbo/habbohotel/rooms/Room.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index dd6597d4..c8de883e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -735,23 +735,22 @@ public class Room implements Comparable, ISerialize, Runnable { THashSet roomUnits = new THashSet<>(); for (Habbo habbo : habbos) { + + double z = habbo.getRoomUnit().getCurrentLocation().getStackHeight(); + if ((item == null && !habbo.getRoomUnit().cmdSit) || (item != null && !item.getBaseItem().allowSit())) habbo.getRoomUnit().removeStatus(RoomUnitStatus.SIT); if ((item == null && !habbo.getRoomUnit().cmdLay) || (item != null && !item.getBaseItem().allowLay())) habbo.getRoomUnit().removeStatus(RoomUnitStatus.LAY); - if (item != null) { - if (item.getBaseItem().allowSit() || item.getBaseItem().allowLay()) { - habbo.getRoomUnit().setZ(item.getZ()); - habbo.getRoomUnit().setPreviousLocationZ(item.getZ()); - habbo.getRoomUnit().setRotation(RoomUserRotation.fromValue(item.getRotation())); - } else { - habbo.getRoomUnit().setZ(item.getZ() + Item.getCurrentHeight(item)); - } + if (item != null && (item.getBaseItem().allowSit() || item.getBaseItem().allowLay())) { + habbo.getRoomUnit().setZ(item.getZ()); + habbo.getRoomUnit().setPreviousLocationZ(item.getZ()); + habbo.getRoomUnit().setRotation(RoomUserRotation.fromValue(item.getRotation())); } else { - habbo.getRoomUnit().setZ(habbo.getRoomUnit().getCurrentLocation().getStackHeight()); - habbo.getRoomUnit().setPreviousLocationZ(habbo.getRoomUnit().getCurrentLocation().getStackHeight()); + habbo.getRoomUnit().setZ(z); + habbo.getRoomUnit().setPreviousLocationZ(z); } roomUnits.add(habbo.getRoomUnit()); } From 605dd000a63d447da7d4075fb1f9c25287ff8c82 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Sun, 3 May 2020 02:08:12 +0200 Subject: [PATCH 042/215] Fix MessageComposer race condition caused by #133. --- .../habbo/habbohotel/gameclients/GameClient.java | 2 +- .../habbo/networking/gameserver/GameServer.java | 3 --- .../encoders/MessageComposerEncoder.java | 16 ---------------- 3 files changed, 1 insertion(+), 20 deletions(-) delete mode 100644 src/main/java/com/eu/habbo/networking/gameserver/encoders/MessageComposerEncoder.java diff --git a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java index 956620b6..11b43f49 100644 --- a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java +++ b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java @@ -89,7 +89,7 @@ public class GameClient { public void sendResponse(MessageComposer composer) { if (this.channel.isOpen()) { try { - this.channel.write(composer, this.channel.voidPromise()); + this.channel.write(composer.compose(), this.channel.voidPromise()); this.channel.flush(); } catch (Exception e) { Emulator.getLogging().logPacketError(e); diff --git a/src/main/java/com/eu/habbo/networking/gameserver/GameServer.java b/src/main/java/com/eu/habbo/networking/gameserver/GameServer.java index 1b1a338e..933eb65a 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/GameServer.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/GameServer.java @@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.gameclients.GameClientManager; import com.eu.habbo.messages.PacketManager; import com.eu.habbo.networking.Server; import com.eu.habbo.networking.gameserver.decoders.*; -import com.eu.habbo.networking.gameserver.encoders.MessageComposerEncoder; import com.eu.habbo.networking.gameserver.encoders.ServerMessageEncoder; import com.eu.habbo.networking.gameserver.encoders.GameServerMessageLogger; import io.netty.channel.ChannelInitializer; @@ -46,8 +45,6 @@ public class GameServer extends Server { if (PacketManager.DEBUG_SHOW_PACKETS) { ch.pipeline().addLast(new GameServerMessageLogger()); } - - ch.pipeline().addLast(new MessageComposerEncoder()); } }); } diff --git a/src/main/java/com/eu/habbo/networking/gameserver/encoders/MessageComposerEncoder.java b/src/main/java/com/eu/habbo/networking/gameserver/encoders/MessageComposerEncoder.java deleted file mode 100644 index a1a98cb7..00000000 --- a/src/main/java/com/eu/habbo/networking/gameserver/encoders/MessageComposerEncoder.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.eu.habbo.networking.gameserver.encoders; - -import com.eu.habbo.messages.outgoing.MessageComposer; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.MessageToMessageEncoder; - -import java.util.List; - -public class MessageComposerEncoder extends MessageToMessageEncoder { - - @Override - protected void encode(ChannelHandlerContext ctx, MessageComposer message, List out) throws Exception { - out.add(message.compose()); - } - -} From 755c589ba60bf97ca2bdec52c62d41d183a12d15 Mon Sep 17 00:00:00 2001 From: Beny Date: Sun, 3 May 2020 03:01:49 +0200 Subject: [PATCH 043/215] Fix Issue #575 related to pathfinder changes --- src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java index 6f72b1ff..0c5582ee 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java @@ -239,6 +239,7 @@ public class RoomUnit { { if (!room.tileWalkable(next)) { this.room = room; + this.path.clear(); this.findPath(); if (this.path.isEmpty()) { From 81ff35fe6e3af5e7af23196ae9742673215aa390 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Sun, 3 May 2020 16:07:27 +0200 Subject: [PATCH 044/215] Fixes issue #588, netty IllegalReferenceCount --- .../habbohotel/gameclients/GameClient.java | 6 +-- .../com/eu/habbo/messages/ServerMessage.java | 43 +++++++++++++++++-- .../decoders/GameMessageHandler.java | 2 + .../encoders/GameServerMessageLogger.java | 2 +- .../encoders/ServerMessageEncoder.java | 2 +- 5 files changed, 47 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java index 11b43f49..eb9e6a8f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java +++ b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java @@ -89,7 +89,7 @@ public class GameClient { public void sendResponse(MessageComposer composer) { if (this.channel.isOpen()) { try { - this.channel.write(composer.compose(), this.channel.voidPromise()); + this.channel.write(composer.compose().retain(), this.channel.voidPromise()); this.channel.flush(); } catch (Exception e) { Emulator.getLogging().logPacketError(e); @@ -103,7 +103,7 @@ public class GameClient { return; } - this.channel.write(response, this.channel.voidPromise()); + this.channel.write(response.retain(), this.channel.voidPromise()); this.channel.flush(); } } @@ -115,7 +115,7 @@ public class GameClient { return; } - this.channel.write(response); + this.channel.write(response.retain()); } this.channel.flush(); diff --git a/src/main/java/com/eu/habbo/messages/ServerMessage.java b/src/main/java/com/eu/habbo/messages/ServerMessage.java index e61d0d45..ee84e2f9 100644 --- a/src/main/java/com/eu/habbo/messages/ServerMessage.java +++ b/src/main/java/com/eu/habbo/messages/ServerMessage.java @@ -4,11 +4,14 @@ import com.eu.habbo.Emulator; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufOutputStream; import io.netty.buffer.Unpooled; +import io.netty.util.IllegalReferenceCountException; +import io.netty.util.ReferenceCounted; import java.io.IOException; import java.nio.charset.Charset; -public class ServerMessage { +public class ServerMessage implements ReferenceCounted { + private int header; private ByteBufOutputStream stream; private ByteBuf channelBuffer; @@ -192,8 +195,42 @@ public class ServerMessage { return this.channelBuffer.copy(); } - public void release() { - this.channelBuffer.release(); + @Override + public int refCnt() { + return this.channelBuffer.refCnt(); + } + + @Override + public ReferenceCounted retain() { + this.channelBuffer.retain(); + return this; + } + + @Override + public ReferenceCounted retain(int i) { + this.channelBuffer.retain(i); + return this; + } + + @Override + public ReferenceCounted touch() { + this.channelBuffer.touch(); + return this; + } + + @Override + public ReferenceCounted touch(Object o) { + this.channelBuffer.touch(o); + return this; + } + + public boolean release() { + return this.channelBuffer.release(); + } + + @Override + public boolean release(int i) { + return this.channelBuffer.release(i); } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageHandler.java b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageHandler.java index 05e0164a..9674c707 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageHandler.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageHandler.java @@ -54,6 +54,8 @@ public class GameMessageHandler extends ChannelInboundHandlerAdapter { if (cause instanceof TooLongFrameException) { Emulator.getLogging().logErrorLine("Disconnecting client, reason: \"" + cause.getMessage() + "\"."); } else { + cause.printStackTrace(); + Emulator.getLogging().logErrorLine("Disconnecting client, exception in GameMessageHander:"); Emulator.getLogging().logErrorLine(cause.toString()); diff --git a/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java b/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java index 224e227f..264a7837 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java @@ -14,7 +14,7 @@ public class GameServerMessageLogger extends MessageToMessageEncoder out) throws Exception { Emulator.getLogging().logPacketLine("[" + Logging.ANSI_PURPLE + "SERVER" + Logging.ANSI_RESET + "] => [" + message.getHeader() + "] -> " + message.getBodyString()); - out.add(message); + out.add(message.retain()); } } diff --git a/src/main/java/com/eu/habbo/networking/gameserver/encoders/ServerMessageEncoder.java b/src/main/java/com/eu/habbo/networking/gameserver/encoders/ServerMessageEncoder.java index 928264d4..3baba4ce 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/encoders/ServerMessageEncoder.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/encoders/ServerMessageEncoder.java @@ -4,6 +4,7 @@ import com.eu.habbo.messages.ServerMessage; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToByteEncoder; +import io.netty.util.IllegalReferenceCountException; public class ServerMessageEncoder extends MessageToByteEncoder { @@ -15,7 +16,6 @@ public class ServerMessageEncoder extends MessageToByteEncoder { out.writeBytes(buf); } finally { buf.release(); - message.release(); } } From 196c1ef23d073382a19a245f2e933cca76dcba21 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Mon, 4 May 2020 05:41:28 +0200 Subject: [PATCH 045/215] Optimize water mask recalculations. --- .../items/interactions/InteractionWater.java | 282 +++++++++++------- .../com/eu/habbo/habbohotel/rooms/Room.java | 1 - .../eu/habbo/habbohotel/users/HabboItem.java | 18 ++ 3 files changed, 186 insertions(+), 115 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java index 9af96347..b85bd494 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java @@ -1,43 +1,43 @@ package com.eu.habbo.habbohotel.items.interactions; -import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.pets.Pet; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomTile; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.rooms.RoomUnitStatus; +import com.eu.habbo.habbohotel.rooms.*; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; -import gnu.trove.list.array.TIntArrayList; -import gnu.trove.map.hash.THashMap; import gnu.trove.set.hash.THashSet; import org.apache.commons.math3.util.Pair; +import java.awt.*; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; public class InteractionWater extends InteractionDefault { + + private static final String DEEP_WATER_NAME = "bw_water_2"; + private final boolean isDeepWater; + public InteractionWater(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); + this.isDeepWater = baseItem.getName().equalsIgnoreCase(DEEP_WATER_NAME); } public InteractionWater(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { super(id, userId, item, extradata, limitedStack, limitedSells); + this.isDeepWater = false; } @Override public void onMove(Room room, RoomTile oldLocation, RoomTile newLocation) { super.onMove(room, oldLocation, newLocation); - - this.recalculate(room); + this.updateWaters(room, oldLocation); } @Override public void onPickUp(Room room) { - this.recalculate(room); + this.updateWaters(room, null); Object[] empty = new Object[]{}; for (Habbo habbo : room.getHabbosOnItem(this)) { @@ -58,91 +58,10 @@ public class InteractionWater extends InteractionDefault { @Override public void onPlace(Room room) { - this.recalculate(room); + this.updateWaters(room, null); super.onPlace(room); } - public void refreshWaters(Room room) { - if (room == null) { - room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()); - } - - int _1 = 0; - int _2 = 0; - int _3 = 0; - int _4 = 0; - int _5 = 0; - int _6 = 0; - int _7 = 0; - int _8 = 0; - int _9 = 0; - int _10 = 0; - int _11 = 0; - int _12 = 0; - - for (HabboItem item : room.getRoomSpecialTypes().getItemsOfType(InteractionWaterItem.class)) { - ((InteractionWaterItem) item).update(); - } - - if (!this.getBaseItem().getName().equalsIgnoreCase("bw_water_2")) { - if (room.waterTiles.containsKey(this.getX() - 1) && room.waterTiles.get(this.getX() - 1).contains(this.getY() - 1)) - _1 = 1; - if (room.waterTiles.containsKey(this.getX()) && room.waterTiles.get(this.getX()).contains(this.getY() - 1)) - _2 = 1; - if (room.waterTiles.containsKey(this.getX() + 1) && room.waterTiles.get(this.getX() + 1).contains(this.getY() - 1)) - _3 = 1; - if (room.waterTiles.containsKey(this.getX() + 2) && room.waterTiles.get(this.getX() + 2).contains(this.getY() - 1)) - _4 = 1; - if (room.waterTiles.containsKey(this.getX() - 1) && room.waterTiles.get(this.getX() - 1).contains(this.getY())) - _5 = 1; - if (room.waterTiles.containsKey(this.getX() + 2) && room.waterTiles.get(this.getX() + 2).contains(this.getY())) - _6 = 1; - if (room.waterTiles.containsKey(this.getX() - 1) && room.waterTiles.get(this.getX() - 1).contains(this.getY() + 1)) - _7 = 1; - if (room.waterTiles.containsKey(this.getX() + 2) && room.waterTiles.get(this.getX() + 2).contains(this.getY() + 1)) - _8 = 1; - if (room.waterTiles.containsKey(this.getX() - 1) && room.waterTiles.get(this.getX() - 1).contains(this.getY() + 2)) - _9 = 1; - if (room.waterTiles.containsKey(this.getX()) && room.waterTiles.get(this.getX()).contains(this.getY() + 2)) - _10 = 1; - if (room.waterTiles.containsKey(this.getX() + 1) && room.waterTiles.get(this.getX() + 1).contains(this.getY() + 2)) - _11 = 1; - if (room.waterTiles.containsKey(this.getX() + 2) && room.waterTiles.get(this.getX() + 2).contains(this.getY() + 2)) - _12 = 1; - } - - //if (_1 == 0 && room.getLayout().isVoidTile((short)(this.getX() -1), (short) (this.getY() -1))) _1 = 1; - if (_2 == 0 && room.getLayout().isVoidTile(this.getX(), (short) (this.getY() - 1))) _2 = 1; - if (_3 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 1), (short) (this.getY() - 1))) _3 = 1; - //if (_4 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 2), (short) (this.getY() - 1))) _4 = 1; - if (_5 == 0 && room.getLayout().isVoidTile((short) (this.getX() - 1), this.getY())) _5 = 1; - if (_6 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 2), this.getY())) _6 = 1; - if (_7 == 0 && room.getLayout().isVoidTile((short) (this.getX() - 1), (short) (this.getY() + 1))) _7 = 1; - if (_8 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 2), (short) (this.getY() + 1))) _8 = 1; - //if (_9 == 0 && room.getLayout().isVoidTile((short)(this.getX() -1), (short) (this.getY() + 2))) _9 = 1; - if (_10 == 0 && room.getLayout().isVoidTile(this.getX(), (short) (this.getY() + 2))) _10 = 1; - if (_11 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 1), (short) (this.getY() + 2))) _11 = 1; - //if (_12 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 2), (short) (this.getY() + 2))) _12 = 1; - - int result = 0; - result |= _1 << 11; - result |= _2 << 10; - result |= _3 << 9; - result |= _4 << 8; - result |= _5 << 7; - result |= _6 << 6; - result |= _7 << 5; - result |= _8 << 4; - result |= _9 << 3; - result |= _10 << 2; - result |= _11 << 1; - result |= _12; - - this.setExtradata(result + ""); - this.needsUpdate(true); - room.updateItem(this); - } - @Override public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { super.onWalkOn(roomUnit, room, objects); @@ -169,28 +88,6 @@ public class InteractionWater extends InteractionDefault { pet.getRoomUnit().removeStatus(RoomUnitStatus.SWIM); } - private void recalculate(Room room) { - THashMap tiles = new THashMap<>(); - - for (HabboItem item : room.getRoomSpecialTypes().getItemsOfType(InteractionWater.class)) { - for (short i = 0; i < item.getBaseItem().getLength(); i++) { - for (short j = 0; j < item.getBaseItem().getWidth(); j++) { - if (!tiles.containsKey((short) (item.getX() + i))) { - tiles.put((short) (item.getX() + i), new TIntArrayList()); - } - - tiles.get((short) (item.getX() + i)).add(item.getY() + j); - } - } - } - - room.waterTiles = tiles; - - for (HabboItem item : room.getRoomSpecialTypes().getItemsOfType(InteractionWater.class)) { - ((InteractionWater) item).refreshWaters(room); - } - } - @Override public boolean allowWiredResetState() { return false; @@ -222,4 +119,161 @@ public class InteractionWater extends InteractionDefault { return pet == null || pet.getPetData().canSwim; } + + private void updateWaters(Room room, RoomTile oldLocation) { + // Update ourself. + this.updateWater(room); + + // Find targets containing furni to update. + Rectangle target = this.getRectangle(1, 1); + Rectangle targetOld = null; + + if (oldLocation != null) { + targetOld = RoomLayout.getRectangle( + oldLocation.x - 1, + oldLocation.y - 1, + this.getBaseItem().getWidth() + 2, + this.getBaseItem().getLength() + 2, + this.getRotation()); + } + + // Update neighbouring water. + for (HabboItem item : room.getRoomSpecialTypes().getItemsOfType(InteractionWater.class)) { + // We already updated ourself. + if (item == this) { + continue; + } + + // Check if found water furni is touching or intersecting our water furni. + // Check the same for the old location + Rectangle itemRectangle = item.getRectangle(); + + if (target.intersects(itemRectangle) || (targetOld != null && targetOld.intersects(itemRectangle))) { + ((InteractionWater) item).updateWater(room); + } + } + + // Update water items we might have missed in the old location. + if (targetOld != null) { + for (HabboItem item : room.getRoomSpecialTypes().getItemsOfType(InteractionWaterItem.class)) { + if (targetOld.intersects(item.getRectangle())) { + ((InteractionWaterItem) item).update(); + } + } + } + } + + private void updateWater(Room room) { + Rectangle target = this.getRectangle(); + + // Only update water item furnis that are intersecting with us. + for (HabboItem item : room.getRoomSpecialTypes().getItemsOfType(InteractionWaterItem.class)) { + if (target.intersects(item.getRectangle())) { + ((InteractionWaterItem) item).update(); + } + } + + // Prepare bits for cutting off water. + byte _1 = 0; + byte _2 = 0; + byte _3 = 0; + byte _4 = 0; + byte _5 = 0; + byte _6 = 0; + byte _7 = 0; + byte _8 = 0; + byte _9 = 0; + byte _10 = 0; + byte _11 = 0; + byte _12 = 0; + + // Check if we are touching a water tile. + if (this.isValidForMask(room, this.getX() - 1, this.getY() - 1, this.getZ())) { + _1 = 1; + } + if (this.isValidForMask(room, this.getX(), this.getY() - 1, this.getZ())) { + _2 = 1; + } + if (this.isValidForMask(room, this.getX() + 1, this.getY() - 1, this.getZ())) { + _3 = 1; + } + if (this.isValidForMask(room, this.getX() + 2, this.getY() - 1, this.getZ())) { + _4 = 1; + } + if (this.isValidForMask(room, this.getX() - 1, this.getY(), this.getZ())) { + _5 = 1; + } + if (this.isValidForMask(room, this.getX() + 2, this.getY(), this.getZ())) { + _6 = 1; + } + if (this.isValidForMask(room, this.getX() - 1, this.getY() + 1, this.getZ())) { + _7 = 1; + } + if (this.isValidForMask(room, this.getX() + 2, this.getY() + 1, this.getZ())) { + _8 = 1; + } + if (this.isValidForMask(room, this.getX() - 1, this.getY() + 2, this.getZ())) { + _9 = 1; + } + if (this.isValidForMask(room, this.getX(), this.getY() + 2, this.getZ())) { + _10 = 1; + } + if (this.isValidForMask(room, this.getX() + 1, this.getY() + 2, this.getZ())) { + _11 = 1; + } + if (this.isValidForMask(room, this.getX() + 2, this.getY() + 2, this.getZ())) { + _12 = 1; + } + + // Check if we are touching invalid tiles. + // if (_1 == 0 && room.getLayout().isVoidTile((short)(this.getX() -1), (short) (this.getY() -1))) _1 = 1; + if (_2 == 0 && room.getLayout().isVoidTile(this.getX(), (short) (this.getY() - 1))) _2 = 1; + if (_3 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 1), (short) (this.getY() - 1))) _3 = 1; + // if (_4 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 2), (short) (this.getY() - 1))) _4 = 1; + if (_5 == 0 && room.getLayout().isVoidTile((short) (this.getX() - 1), this.getY())) _5 = 1; + if (_6 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 2), this.getY())) _6 = 1; + if (_7 == 0 && room.getLayout().isVoidTile((short) (this.getX() - 1), (short) (this.getY() + 1))) _7 = 1; + if (_8 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 2), (short) (this.getY() + 1))) _8 = 1; + // if (_9 == 0 && room.getLayout().isVoidTile((short)(this.getX() -1), (short) (this.getY() + 2))) _9 = 1; + if (_10 == 0 && room.getLayout().isVoidTile(this.getX(), (short) (this.getY() + 2))) _10 = 1; + if (_11 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 1), (short) (this.getY() + 2))) _11 = 1; + // if (_12 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 2), (short) (this.getY() + 2))) _12 = 1; + + // Update water. + int result = (_1 << 11) + | (_2 << 10) + | (_3 << 9) + | (_4 << 8) + | (_5 << 7) + | (_6 << 6) + | (_7 << 5) + | (_8 << 4) + | (_9 << 3) + | (_10 << 2) + | (_11 << 1) + | _12; + + String updatedData = String.valueOf(result); + + if (!this.getExtradata().equals(updatedData)) { + this.setExtradata(updatedData); + this.needsUpdate(true); + room.updateItem(this); + } + } + + private boolean isValidForMask(Room room, int x, int y, double z) { + for (HabboItem item : room.getItemsAt(x, y, z)) { + if (item instanceof InteractionWater) { + // Only allow masking if both are deepwater or both not. + // This allows deepwater and normal water to look nice. + if (((InteractionWater) item).isDeepWater == this.isDeepWater) { + return true; + } + } + } + + return false; + } + } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index c8de883e..2c834c3c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -141,7 +141,6 @@ public class Room implements Comparable, ISerialize, Runnable { //Use appropriately. Could potentially cause memory leaks when used incorrectly. public volatile boolean preventUnloading = false; public volatile boolean preventUncaching = false; - public THashMap waterTiles; public ConcurrentSet scheduledComposers = new ConcurrentSet<>(); public ConcurrentSet scheduledTasks = new ConcurrentSet<>(); public String wordQuiz = ""; diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java index f689c504..6a37c611 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java @@ -512,4 +512,22 @@ public abstract class HabboItem implements Runnable, IEventTriggers { public boolean canOverrideTile(RoomUnit unit, Room room, RoomTile tile) { return false; } + + public Rectangle getRectangle() { + return RoomLayout.getRectangle( + this.getX(), + this.getY(), + this.getBaseItem().getWidth(), + this.getBaseItem().getLength(), + this.getRotation()); + } + + public Rectangle getRectangle(int marginX, int marginY) { + return RoomLayout.getRectangle( + this.getX() - marginX, + this.getY() - marginY, + this.getBaseItem().getWidth() + (marginX * 2), + this.getBaseItem().getLength() + (marginY * 2), + this.getRotation()); + } } From 87fdba280a815b3688d8b6b59a50e1f7baa80629 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Mon, 4 May 2020 05:53:28 +0200 Subject: [PATCH 046/215] Optimize water item update. --- .../interactions/InteractionWaterItem.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWaterItem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWaterItem.java index a9840636..0332c717 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWaterItem.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWaterItem.java @@ -42,12 +42,15 @@ public class InteractionWaterItem extends InteractionDefault { public void update() { Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()); - if (room == null) + if (room == null) { return; + } - Rectangle rectangle = RoomLayout.getRectangle(this.getX(), this.getY(), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()); + Rectangle rectangle = this.getRectangle(); + // Check if every tile of the furni is in water. boolean foundWater = true; + for (short x = (short) rectangle.x; x < rectangle.getWidth() + rectangle.x && foundWater; x++) { for (short y = (short) rectangle.y; y < rectangle.getHeight() + rectangle.y && foundWater; y++) { boolean tile = false; @@ -66,16 +69,14 @@ public class InteractionWaterItem extends InteractionDefault { } } - if (foundWater) { - this.setExtradata("1"); + // Update data if changed. + String updatedData = foundWater ? "1" : "0"; + + if (!this.getExtradata().equals(updatedData)) { + this.setExtradata(updatedData); this.needsUpdate(true); room.updateItem(this); - return; } - - this.setExtradata("0"); - this.needsUpdate(true); - room.updateItem(this); } @Override From 9a9b986948e71799f9c61147d9893ad5b08183e0 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Mon, 4 May 2020 06:18:12 +0200 Subject: [PATCH 047/215] Improve corner clipping and remove picked up furni from mask calculation --- .../items/interactions/InteractionWater.java | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java index b85bd494..d697ee4a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java @@ -17,16 +17,20 @@ import java.util.List; public class InteractionWater extends InteractionDefault { private static final String DEEP_WATER_NAME = "bw_water_2"; + private final boolean isDeepWater; + private boolean isInRoom; public InteractionWater(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); this.isDeepWater = baseItem.getName().equalsIgnoreCase(DEEP_WATER_NAME); + this.isInRoom = this.getRoomId() != 0; } public InteractionWater(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { super(id, userId, item, extradata, limitedStack, limitedSells); this.isDeepWater = false; + this.isInRoom = this.getRoomId() != 0; } @Override @@ -37,6 +41,7 @@ public class InteractionWater extends InteractionDefault { @Override public void onPickUp(Room room) { + this.isInRoom = false; this.updateWaters(room, null); Object[] empty = new Object[]{}; @@ -58,6 +63,7 @@ public class InteractionWater extends InteractionDefault { @Override public void onPlace(Room room) { + this.isInRoom = true; this.updateWaters(room, null); super.onPlace(room); } @@ -188,7 +194,7 @@ public class InteractionWater extends InteractionDefault { byte _12 = 0; // Check if we are touching a water tile. - if (this.isValidForMask(room, this.getX() - 1, this.getY() - 1, this.getZ())) { + if (this.isValidForMask(room, this.getX() - 1, this.getY() - 1, this.getZ(), true)) { _1 = 1; } if (this.isValidForMask(room, this.getX(), this.getY() - 1, this.getZ())) { @@ -197,7 +203,7 @@ public class InteractionWater extends InteractionDefault { if (this.isValidForMask(room, this.getX() + 1, this.getY() - 1, this.getZ())) { _3 = 1; } - if (this.isValidForMask(room, this.getX() + 2, this.getY() - 1, this.getZ())) { + if (this.isValidForMask(room, this.getX() + 2, this.getY() - 1, this.getZ(), true)) { _4 = 1; } if (this.isValidForMask(room, this.getX() - 1, this.getY(), this.getZ())) { @@ -212,7 +218,7 @@ public class InteractionWater extends InteractionDefault { if (this.isValidForMask(room, this.getX() + 2, this.getY() + 1, this.getZ())) { _8 = 1; } - if (this.isValidForMask(room, this.getX() - 1, this.getY() + 2, this.getZ())) { + if (this.isValidForMask(room, this.getX() - 1, this.getY() + 2, this.getZ(), true)) { _9 = 1; } if (this.isValidForMask(room, this.getX(), this.getY() + 2, this.getZ())) { @@ -221,7 +227,7 @@ public class InteractionWater extends InteractionDefault { if (this.isValidForMask(room, this.getX() + 1, this.getY() + 2, this.getZ())) { _11 = 1; } - if (this.isValidForMask(room, this.getX() + 2, this.getY() + 2, this.getZ())) { + if (this.isValidForMask(room, this.getX() + 2, this.getY() + 2, this.getZ(), true)) { _12 = 1; } @@ -263,11 +269,24 @@ public class InteractionWater extends InteractionDefault { } private boolean isValidForMask(Room room, int x, int y, double z) { + return this.isValidForMask(room, x, y, z, false); + } + + private boolean isValidForMask(Room room, int x, int y, double z, boolean corner) { for (HabboItem item : room.getItemsAt(x, y, z)) { if (item instanceof InteractionWater) { - // Only allow masking if both are deepwater or both not. + InteractionWater water = (InteractionWater) item; + + // Take out picked up water from the recalculation. + if (!water.isInRoom) { + continue; + } + + // Allow: + // - masking if both are deepwater or both not. + // - corners too because otherwise causes ugly clipping issues. // This allows deepwater and normal water to look nice. - if (((InteractionWater) item).isDeepWater == this.isDeepWater) { + if (corner && !this.isDeepWater || water.isDeepWater == this.isDeepWater) { return true; } } From 98c4f4e048adc5f673b171a9a46f884746640b29 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Mon, 4 May 2020 18:29:48 +0200 Subject: [PATCH 048/215] Update pipeline --- .gitlab-ci.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f443c3ff..2d63a30e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,29 +4,23 @@ stages: - build - deploy -cache: - paths: - - target/ - build: stage: build script: - mvn package only: - - dev - - master + changes: + - src/**/* artifacts: - paths: + paths: - target/Habbo-*.jar - .notify_builder: ¬ify_builder stage: deploy trigger: project: project-dobby/builder strategy: depend - notify_deploy_release: <<: *notify_builder variables: From 47f257f9ba52726b76bc8616ee93cedb02a1bd0e Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Mon, 4 May 2020 18:33:25 +0200 Subject: [PATCH 049/215] Update pipeline --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2d63a30e..02782e33 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,6 +12,7 @@ build: changes: - src/**/* artifacts: + expire_in: 2 weeks paths: - target/Habbo-*.jar From 9762d41aae8c3dc287d25cf90972d636d52d6562 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Mon, 4 May 2020 18:55:48 +0200 Subject: [PATCH 050/215] Update pipeline --- .gitlab-ci.yml | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 02782e33..190fab2a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,6 @@ image: maven:latest stages: - build - - deploy build: stage: build @@ -11,34 +10,8 @@ build: only: changes: - src/**/* + - pom.xml artifacts: expire_in: 2 weeks paths: - target/Habbo-*.jar - -.notify_builder: ¬ify_builder - stage: deploy - trigger: - project: project-dobby/builder - strategy: depend - -notify_deploy_release: - <<: *notify_builder - variables: - UPSTREAM_DECISION: "tag" - UPSTREAM_COMMIT_SHA: $CI_COMMIT_SHA - UPSTREAM_PROJECT: $CI_PROJECT_PATH - UPSTREAM_BRANCH: $CI_COMMIT_TAG - only: - - tags - -notify_deploy_dev: - <<: *notify_builder - variables: - UPSTREAM_DECISION: "dev" - UPSTREAM_COMMIT_SHA: $CI_COMMIT_SHA - UPSTREAM_PROJECT: $CI_PROJECT_PATH - UPSTREAM_BRANCH: "dev" - only: - - dev - \ No newline at end of file From 569205b9912998df465b127a04f31809f0da16b3 Mon Sep 17 00:00:00 2001 From: Harmony Date: Mon, 4 May 2020 13:39:57 -0400 Subject: [PATCH 051/215] Remove Project Dobby --- .gitlab-ci.yml | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f443c3ff..abb89732 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,32 +18,4 @@ build: artifacts: paths: - target/Habbo-*.jar - - -.notify_builder: ¬ify_builder - stage: deploy - trigger: - project: project-dobby/builder - strategy: depend - - -notify_deploy_release: - <<: *notify_builder - variables: - UPSTREAM_DECISION: "tag" - UPSTREAM_COMMIT_SHA: $CI_COMMIT_SHA - UPSTREAM_PROJECT: $CI_PROJECT_PATH - UPSTREAM_BRANCH: $CI_COMMIT_TAG - only: - - tags - -notify_deploy_dev: - <<: *notify_builder - variables: - UPSTREAM_DECISION: "dev" - UPSTREAM_COMMIT_SHA: $CI_COMMIT_SHA - UPSTREAM_PROJECT: $CI_PROJECT_PATH - UPSTREAM_BRANCH: "dev" - only: - - dev - \ No newline at end of file + From 4748c033adbd2a851e8ba02dfe6884b9863537d7 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Sun, 3 May 2020 01:46:07 +0200 Subject: [PATCH 052/215] Dependencies and logging progress --- pom.xml | 72 +--- src/main/java/com/eu/habbo/Emulator.java | 87 +++-- .../java/com/eu/habbo/core/CleanerThread.java | 62 +--- .../java/com/eu/habbo/core/CommandLog.java | 12 +- .../eu/habbo/core/ConfigurationManager.java | 40 +-- .../com/eu/habbo/core/CreditsScheduler.java | 6 +- .../{Loggable.java => DatabaseLoggable.java} | 8 +- .../com/eu/habbo/core/DatabaseLogger.java | 46 +++ src/main/java/com/eu/habbo/core/ErrorLog.java | 16 +- .../eu/habbo/core/GotwPointsScheduler.java | 6 +- src/main/java/com/eu/habbo/core/Logging.java | 338 ------------------ .../com/eu/habbo/core/PixelScheduler.java | 6 +- .../com/eu/habbo/core/PointsScheduler.java | 6 +- .../java/com/eu/habbo/core/TextsManager.java | 25 +- .../core/consolecommands/ConsoleCommand.java | 12 +- .../eu/habbo/crypto/HabboDiffieHellman.java | 2 +- .../com/eu/habbo/crypto/utils/HexUtils.java | 27 -- .../java/com/eu/habbo/database/Database.java | 20 +- .../eu/habbo/habbohotel/GameEnvironment.java | 16 +- .../achievements/AchievementManager.java | 18 +- .../achievements/TalentTrackLevel.java | 2 +- .../com/eu/habbo/habbohotel/bots/Bot.java | 2 +- .../eu/habbo/habbohotel/bots/BotManager.java | 22 +- .../eu/habbo/habbohotel/bots/ButlerBot.java | 2 +- .../habbo/habbohotel/catalog/CatalogItem.java | 6 +- .../catalog/CatalogLimitedConfiguration.java | 6 +- .../habbohotel/catalog/CatalogManager.java | 63 ++-- .../habbo/habbohotel/catalog/CatalogPage.java | 2 +- .../eu/habbo/habbohotel/catalog/Voucher.java | 4 +- .../catalog/layouts/RoomBundleLayout.java | 4 +- .../catalog/marketplace/MarketPlace.java | 18 +- .../catalog/marketplace/MarketPlaceOffer.java | 6 +- .../commands/AddYoutubePlaylistCommand.java | 2 +- .../habbohotel/commands/BadgeCommand.java | 2 +- .../habbohotel/commands/CommandHandler.java | 18 +- .../habbohotel/commands/EnableCommand.java | 2 +- .../commands/FilterWordCommand.java | 2 +- .../commands/RoomBundleCommand.java | 2 +- .../habbohotel/crafting/CraftingManager.java | 4 +- .../habbohotel/gameclients/GameClient.java | 14 +- .../com/eu/habbo/habbohotel/games/Game.java | 2 +- .../games/battlebanzai/BattleBanzaiGame.java | 2 +- .../habbohotel/games/freeze/FreezeGame.java | 2 +- .../com/eu/habbo/habbohotel/guilds/Guild.java | 4 +- .../habbo/habbohotel/guilds/GuildManager.java | 44 +-- .../habbohotel/guilds/forums/ForumThread.java | 10 +- .../guilds/forums/ForumThreadComment.java | 6 +- .../habbohotel/hotelview/HallOfFame.java | 2 +- .../hotelview/HotelViewManager.java | 11 +- .../habbo/habbohotel/hotelview/NewsList.java | 2 +- .../habbohotel/items/CrackableReward.java | 2 +- .../habbo/habbohotel/items/ItemManager.java | 61 ++-- .../habbohotel/items/YoutubeManager.java | 6 +- .../interactions/InteractionColorPlate.java | 2 +- .../InteractionRentableSpace.java | 4 +- .../items/interactions/InteractionWired.java | 2 +- .../InteractionWiredHighscore.java | 6 +- .../games/InteractionGameTimer.java | 4 +- .../WiredConditionHabboHasHandItem.java | 2 +- .../wired/effects/WiredEffectMatchFurni.java | 2 +- .../wired/effects/WiredEffectToggleFurni.java | 2 +- .../effects/WiredEffectToggleRandom.java | 2 +- .../triggers/WiredTriggerBotReachedFurni.java | 2 +- .../habbo/habbohotel/messenger/Message.java | 2 +- .../habbo/habbohotel/messenger/Messenger.java | 26 +- .../habbohotel/messenger/MessengerBuddy.java | 6 +- .../habbo/habbohotel/modtool/ModToolBan.java | 2 +- .../habbohotel/modtool/ModToolManager.java | 40 +-- .../habbohotel/modtool/ModToolSanctions.java | 14 +- .../habbo/habbohotel/modtool/WordFilter.java | 6 +- .../navigation/NavigatorManager.java | 22 +- .../permissions/PermissionsManager.java | 6 +- .../eu/habbo/habbohotel/pets/GnomePet.java | 2 +- .../eu/habbo/habbohotel/pets/HorsePet.java | 2 +- .../habbohotel/pets/MonsterplantPet.java | 2 +- .../com/eu/habbo/habbohotel/pets/Pet.java | 2 +- .../eu/habbo/habbohotel/pets/PetManager.java | 26 +- .../habbo/habbohotel/polls/PollManager.java | 4 +- .../habbohotel/rooms/CustomRoomLayout.java | 2 +- .../com/eu/habbo/habbohotel/rooms/Room.java | 94 ++--- .../eu/habbo/habbohotel/rooms/RoomBan.java | 4 +- .../habbohotel/rooms/RoomChatMessage.java | 23 +- .../eu/habbo/habbohotel/rooms/RoomLayout.java | 2 +- .../habbo/habbohotel/rooms/RoomManager.java | 53 +-- .../habbo/habbohotel/rooms/RoomPromotion.java | 2 +- .../eu/habbo/habbohotel/rooms/RoomTrade.java | 2 +- .../eu/habbo/habbohotel/rooms/RoomUnit.java | 2 +- .../habbo/habbohotel/rooms/TraxManager.java | 10 +- .../com/eu/habbo/habbohotel/users/Habbo.java | 4 +- .../eu/habbo/habbohotel/users/HabboBadge.java | 2 +- .../eu/habbo/habbohotel/users/HabboInfo.java | 16 +- .../habbohotel/users/HabboInventory.java | 12 +- .../eu/habbo/habbohotel/users/HabboItem.java | 6 +- .../habbo/habbohotel/users/HabboManager.java | 30 +- .../users/HabboNavigatorWindowSettings.java | 4 +- .../eu/habbo/habbohotel/users/HabboStats.java | 16 +- .../users/cache/HabboOfferPurchase.java | 2 +- .../users/inventory/BadgesComponent.java | 8 +- .../users/inventory/BotsComponent.java | 2 +- .../users/inventory/EffectsComponent.java | 10 +- .../users/inventory/ItemsComponent.java | 4 +- .../users/inventory/PetsComponent.java | 2 +- .../users/inventory/WardrobeComponent.java | 4 +- .../habbo/habbohotel/wired/WiredHandler.java | 8 +- .../highscores/WiredHighscoreManager.java | 6 +- .../com/eu/habbo/messages/PacketManager.java | 26 +- .../com/eu/habbo/messages/ServerMessage.java | 51 ++- .../camera/CameraPublishToWebEvent.java | 2 +- .../catalog/CatalogBuyItemAsGiftEvent.java | 4 +- .../incoming/friends/FriendRequestEvent.java | 2 +- .../guilds/forums/GuildForumListEvent.java | 4 +- .../incoming/handshake/SecureLoginEvent.java | 2 +- .../hotelview/HotelViewDataEvent.java | 2 +- .../inventory/RequestInventoryItemsEvent.java | 2 +- .../navigator/RequestDeleteRoomEvent.java | 2 +- .../RequestNewNavigatorRoomsEvent.java | 4 +- .../incoming/polls/AnswerPollEvent.java | 2 +- .../incoming/polls/CancelPollEvent.java | 2 +- .../rooms/items/RedeemClothingEvent.java | 2 +- .../rooms/items/ToggleFloorItemEvent.java | 2 +- .../rooms/items/UseRandomStateItemEvent.java | 2 +- .../rooms/pets/CompostMonsterplantEvent.java | 2 +- .../rooms/pets/HorseRemoveSaddleEvent.java | 2 +- .../rooms/users/RoomUserWalkEvent.java | 2 +- .../users/ConfirmChangeNameEvent.java | 2 +- .../achievements/AchievementListComposer.java | 2 +- .../catalog/CatalogPagesListComposer.java | 2 +- .../MarketplaceOwnItemsComposer.java | 2 +- .../outgoing/friends/FriendsComposer.java | 2 +- .../guilds/forums/GuildForumDataComposer.java | 2 +- .../inventory/InventoryItemsComposer.java | 2 +- .../modtool/ModToolUserInfoComposer.java | 2 +- .../navigator/PrivateRoomsComposer.java | 2 +- .../users/ProfileFriendsComposer.java | 4 +- .../outgoing/users/UserCurrencyComposer.java | 2 +- .../outgoing/users/UserProfileComposer.java | 2 +- .../habbo/messages/rcon/ExecuteCommand.java | 2 +- .../com/eu/habbo/messages/rcon/GiveBadge.java | 2 +- .../eu/habbo/messages/rcon/GiveCredits.java | 2 +- .../eu/habbo/messages/rcon/GivePixels.java | 2 +- .../eu/habbo/messages/rcon/GivePoints.java | 2 +- .../eu/habbo/messages/rcon/GiveRespect.java | 2 +- .../habbo/messages/rcon/GiveUserClothing.java | 2 +- .../eu/habbo/messages/rcon/IgnoreUser.java | 2 +- .../com/eu/habbo/messages/rcon/MuteUser.java | 2 +- .../com/eu/habbo/messages/rcon/SendGift.java | 2 +- .../com/eu/habbo/messages/rcon/SetMotto.java | 2 +- .../eu/habbo/messages/rcon/UpdateUser.java | 2 +- .../java/com/eu/habbo/networking/Server.java | 16 +- .../habbo/networking/camera/CameraClient.java | 12 +- .../camera/CameraPacketHandler.java | 2 +- .../incoming/CameraLoginStatusEvent.java | 31 +- .../incoming/CameraUpdateNotification.java | 12 +- .../decoders/GameMessageHandler.java | 2 +- .../encoders/GameServerMessageLogger.java | 13 +- .../networking/rconserver/RCONServer.java | 16 +- .../rconserver/RCONServerHandler.java | 13 +- .../com/eu/habbo/plugin/PluginManager.java | 35 +- .../com/eu/habbo/threading/ThreadPooling.java | 16 +- .../runnables/CameraClientAutoReconnect.java | 12 +- .../runnables/InsertModToolIssue.java | 7 +- .../habbo/threading/runnables/OpenGift.java | 2 +- .../runnables/QueryDeleteHabboBadge.java | 2 +- .../runnables/QueryDeleteHabboItem.java | 2 +- .../runnables/QueryDeleteHabboItems.java | 2 +- .../threading/runnables/RoomUnitTeleport.java | 2 +- .../RoomUnitTeleportWalkToAction.java | 2 +- .../RoomUnitVendingMachineAction.java | 2 +- .../threading/runnables/SaveScoreForTeam.java | 2 +- .../runnables/TeleportInteraction.java | 2 +- .../runnables/UpdateModToolIssue.java | 2 +- .../freeze/FreezeHandleSnowballExplosion.java | 2 +- .../runnables/hopper/HopperActionTwo.java | 2 +- .../runnables/teleport/TeleportActionTwo.java | 2 +- src/main/java/com/eu/habbo/util/HexUtils.java | 57 +++ .../habbo/util/callback/HTTPVersionCheck.java | 2 +- .../habbo/util/imager/badges/BadgeImager.java | 22 +- 177 files changed, 963 insertions(+), 1180 deletions(-) rename src/main/java/com/eu/habbo/core/{Loggable.java => DatabaseLoggable.java} (71%) create mode 100644 src/main/java/com/eu/habbo/core/DatabaseLogger.java delete mode 100644 src/main/java/com/eu/habbo/core/Logging.java delete mode 100644 src/main/java/com/eu/habbo/crypto/utils/HexUtils.java create mode 100644 src/main/java/com/eu/habbo/util/HexUtils.java diff --git a/pom.xml b/pom.xml index 1389b284..68c85820 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.3 + 3.8.1 1.8 1.8 @@ -42,7 +42,7 @@ org.apache.maven.plugins maven-assembly-plugin - 2.4.1 + 3.3.0 jar-with-dependencies @@ -67,7 +67,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.0.0 + 3.2.0 -Xdoclint:none public @@ -92,50 +92,21 @@ io.netty netty-all - 4.1.36.Final - - - - - org.fusesource.jansi - jansi - 1.18 - - - - - io.netty - netty-codec-http - 4.1.36.Final - compile - - - - io.netty - netty-codec-http2 - 4.1.36.Final - compile - - - - io.netty - netty-handler - 4.1.36.Final - compile + 4.1.49.Final com.google.code.gson gson - 2.8.4 + 2.8.6 mysql mysql-connector-java - 5.1.46 + 5.1.49 runtime @@ -151,16 +122,17 @@ com.zaxxer HikariCP - 3.1.0 + 3.4.3 compile org.apache.commons commons-lang3 - 3.7 + 3.10 compile + org.apache.commons commons-math3 @@ -171,35 +143,21 @@ org.jsoup jsoup - 1.11.3 + 1.13.1 compile - org.slf4j - slf4j-api - 1.7.25 - - - - org.slf4j - slf4j-simple - 1.7.25 + ch.qos.logback + logback-classic + 1.2.3 + compile joda-time joda-time - 2.9.9 + 2.10.6 - - - - - internal.repo - Internal repo - file:///home/thara/testesb/in - - \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/Emulator.java b/src/main/java/com/eu/habbo/Emulator.java index 4457d58a..8aece311 100644 --- a/src/main/java/com/eu/habbo/Emulator.java +++ b/src/main/java/com/eu/habbo/Emulator.java @@ -1,5 +1,6 @@ package com.eu.habbo; +import ch.qos.logback.classic.Level; import com.eu.habbo.core.*; import com.eu.habbo.core.consolecommands.ConsoleCommand; import com.eu.habbo.database.Database; @@ -14,7 +15,8 @@ import com.eu.habbo.plugin.events.emulator.EmulatorStartShutdownEvent; import com.eu.habbo.plugin.events.emulator.EmulatorStoppedEvent; import com.eu.habbo.threading.ThreadPooling; import com.eu.habbo.util.imager.badges.BadgeImager; -import org.fusesource.jansi.AnsiConsole; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.*; import java.security.MessageDigest; @@ -23,20 +25,17 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.Random; +import java.util.concurrent.ThreadLocalRandom; public final class Emulator { + private static final Logger LOGGER = LoggerFactory.getLogger(Emulator.class); public final static int MAJOR = 2; public final static int MINOR = 4; public final static int BUILD = 0; - public static final String ANSI_RED = "\u001B[31m"; - public static final String ANSI_BLUE = "\u001B[34m"; - public static final String ANSI_PURPLE = "\u001B[35m"; - public static final String ANSI_WHITE = "\u001B[37m"; - public static final String ANSI_YELLOW = "\u001B[33m"; -// This Build of 2.4.0 will not be released anytime soon. :) + // This Build of 2.4.0 will not be released anytime soon. :) public final static String PREVIEW = "RC-1"; public static final String version = "Arcturus Morningstar" + " " + MAJOR + "." + MINOR + "." + BUILD + "-" + PREVIEW; @@ -55,8 +54,6 @@ public final class Emulator { public static boolean isShuttingDown = false; public static boolean stopped = false; public static boolean debugging = false; - private static String classPath = System.getProperty("java.class.path"); - private static String osName = System.getProperty("os.name"); private static int timeStarted = 0; private static Runtime runtime; private static ConfigurationManager config; @@ -66,11 +63,10 @@ public final class Emulator { private static RCONServer rconServer; private static CameraClient cameraClient; private static Database database; - private static Logging logging; + private static DatabaseLogger databaseLogger; private static ThreadPooling threading; private static GameEnvironment gameEnvironment; private static PluginManager pluginManager; - private static Random random; private static BadgeImager badgeImager; static { @@ -85,21 +81,19 @@ public final class Emulator { public static void main(String[] args) throws Exception { try { - if (osName.startsWith("Windows") && (!classPath.contains("idea_rt.jar"))) { - AnsiConsole.systemInstall(); - } Locale.setDefault(new Locale("en")); setBuild(); Emulator.stopped = false; ConsoleCommand.load(); - Emulator.logging = new Logging(); - System.out.println(ANSI_PURPLE + logo ); - System.out.println(ANSI_WHITE + "This project is for educational purposes only. This Emulator is an open-source fork of Arcturus created by TheGeneral."); - System.out.println(ANSI_BLUE + "[VERSION] " + ANSI_WHITE + version); - System.out.println(ANSI_RED + "[BUILD] " + ANSI_WHITE + build + "\n"); - System.out.println(ANSI_YELLOW + "[KREWS] " + ANSI_WHITE + "Remember to sign up your hotel to join our toplist beta at https://bit.ly/2NN0rxq" ); - System.out.println(ANSI_YELLOW + "[KREWS] " + ANSI_WHITE + "Join our discord at https://discord.gg/syuqgN" + "\n"); - random = new Random(); + + System.out.println(logo); + + LOGGER.info("This project is for educational purposes only. This Emulator is an open-source fork of Arcturus created by TheGeneral."); + LOGGER.info("Version: {}", version); + LOGGER.info("Build: {}", build); + LOGGER.info("Remember to sign up your hotel to join our toplist beta at https://bit.ly/2NN0rxq"); + LOGGER.info("Join our discord at https://discord.gg/syuqgN"); + long startTime = System.nanoTime(); Emulator.runtime = Runtime.getRuntime(); @@ -110,6 +104,7 @@ public final class Emulator { Emulator.getConfig().getValue("enc.n"), Emulator.getConfig().getValue("enc.d")); Emulator.database = new Database(Emulator.getConfig()); + Emulator.databaseLogger = new DatabaseLogger(); Emulator.config.loaded = true; Emulator.config.loadFromDatabase(); Emulator.threading = new ThreadPooling(Emulator.getConfig().getInt("runtime.threads")); @@ -129,13 +124,17 @@ public final class Emulator { Emulator.rconServer.initializePipeline(); Emulator.rconServer.connect(); Emulator.badgeImager = new BadgeImager(); - Emulator.getLogging().logStart("Arcturus Morningstar has succesfully loaded. You're running: " + Emulator.version); - Emulator.getLogging().logStart("System launched in: " + (System.nanoTime() - startTime) / 1e6 + "ms. Using: " + (Runtime.getRuntime().availableProcessors() * 2) + " threads!"); - Emulator.getLogging().logStart("Memory: " + (runtime.totalMemory() - runtime.freeMemory()) / (1024 * 1024) + "/" + (runtime.freeMemory()) / (1024 * 1024) + "MB"); + + LOGGER.info("Arcturus Morningstar has succesfully loaded."); + LOGGER.info("System launched in: {}ms. Using {} threads!", (System.nanoTime() - startTime) / 1e6, Runtime.getRuntime().availableProcessors() * 2); + LOGGER.info("Memory: {}/{}MB", (runtime.totalMemory() - runtime.freeMemory()) / (1024 * 1024), (runtime.freeMemory()) / (1024 * 1024)); Emulator.debugging = Emulator.getConfig().getBoolean("debug.mode"); + if (debugging) { - Emulator.getLogging().logDebugLine("Debugging Enabled!"); + ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); + root.setLevel(Level.DEBUG); + LOGGER.debug("Debugging enabled."); } Emulator.getPluginManager().fireEvent(new EmulatorLoadedEvent()); @@ -143,7 +142,9 @@ public final class Emulator { Emulator.timeStarted = getIntUnixTimestamp(); if (Emulator.getConfig().getInt("runtime.threads") < (Runtime.getRuntime().availableProcessors() * 2)) { - Emulator.getLogging().logStart("Emulator settings runtime.threads (" + Emulator.getConfig().getInt("runtime.threads") + ") can be increased to " + (Runtime.getRuntime().availableProcessors() * 2) + " to possibly increase performance."); + LOGGER.warn("Emulator settings runtime.threads ({}) can be increased to {} to possibly increase performance.", + Emulator.getConfig().getInt("runtime.threads"), + Runtime.getRuntime().availableProcessors() * 2); } @@ -154,7 +155,6 @@ public final class Emulator { while (!isShuttingDown && isReady) { try { - String line = reader.readLine(); if (line != null) { @@ -163,7 +163,7 @@ public final class Emulator { System.out.println("Waiting for command: "); } catch (Exception e) { if (!(e instanceof IOException && e.getMessage().equals("Bad file descriptor"))) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Error while reading command", e); } } } @@ -199,11 +199,12 @@ public final class Emulator { } private static void dispose() { - Emulator.getThreading().setCanAdd(false); Emulator.isShuttingDown = true; Emulator.isReady = false; - Emulator.getLogging().logShutdownLine("Stopping Arcturus Emulator " + version + "..."); + + LOGGER.info("Stopping Arcturus Morningstar {}", version); + try { if (Emulator.getPluginManager() != null) Emulator.getPluginManager().fireEvent(new EmulatorStartShutdownEvent()); @@ -222,7 +223,6 @@ public final class Emulator { } catch (Exception e) { } - try { if (Emulator.gameEnvironment != null) Emulator.gameEnvironment.dispose(); @@ -241,8 +241,6 @@ public final class Emulator { } catch (Exception e) { } - Emulator.getLogging().saveLogs(); - try { if (Emulator.config != null) { Emulator.config.saveToDatabase(); @@ -255,16 +253,17 @@ public final class Emulator { Emulator.gameServer.stop(); } catch (Exception e) { } - Emulator.getLogging().logShutdownLine("Stopped Arcturus Emulator " + version + "..."); + + LOGGER.info("Stopped Arcturus Morningstar {}", version); if (Emulator.database != null) { Emulator.getDatabase().dispose(); } Emulator.stopped = true; - if (osName.startsWith("Windows") && (!classPath.contains("idea_rt.jar"))) { - AnsiConsole.systemUninstall(); - } + // if (osName.startsWith("Windows") && (!classPath.contains("idea_rt.jar"))) { + // AnsiConsole.systemUninstall(); + // } try { if (Emulator.threading != null) @@ -289,6 +288,10 @@ public final class Emulator { return database; } + public static DatabaseLogger getDatabaseLogger() { + return databaseLogger; + } + public static Runtime getRuntime() { return runtime; } @@ -301,10 +304,6 @@ public final class Emulator { return rconServer; } - public static Logging getLogging() { - return logging; - } - public static ThreadPooling getThreading() { return threading; } @@ -318,7 +317,7 @@ public final class Emulator { } public static Random getRandom() { - return random; + return ThreadLocalRandom.current(); } public static BadgeImager getBadgeImager() { @@ -361,7 +360,7 @@ public final class Emulator { try { res = format.parse(date); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Error parsing date", e); } return res; } diff --git a/src/main/java/com/eu/habbo/core/CleanerThread.java b/src/main/java/com/eu/habbo/core/CleanerThread.java index 764770d0..b9a721dc 100644 --- a/src/main/java/com/eu/habbo/core/CleanerThread.java +++ b/src/main/java/com/eu/habbo/core/CleanerThread.java @@ -6,6 +6,8 @@ import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.incoming.friends.SearchUserEvent; import com.eu.habbo.messages.incoming.navigator.SearchRoomsEvent; import com.eu.habbo.threading.runnables.AchievementUpdater; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -15,57 +17,26 @@ import java.util.Map; public class CleanerThread implements Runnable { + private static final Logger LOGGER = LoggerFactory.getLogger(CleanerThread.class); - public static final int DELAY = 10000; - - - public static final int RELOAD_HALL_OF_FAME = 1800; - - - public static final int RELOAD_NEWS_LIST = 3600; - - - public static final int REMOVE_INACTIVE_ROOMS = 120; - - - public static final int REMOVE_INACTIVE_GUILDS = 60; - - - public static final int REMOVE_INACTIVE_TOURS = 600; - - - public static final int SAVE_ERROR_LOGS = 30; - - - public static final int CLEAR_CACHED_VALUES = 60 * 60; - - + private static final int DELAY = 10000; + private static final int RELOAD_HALL_OF_FAME = 1800; + private static final int RELOAD_NEWS_LIST = 3600; + private static final int REMOVE_INACTIVE_ROOMS = 120; + private static final int REMOVE_INACTIVE_GUILDS = 60; + private static final int REMOVE_INACTIVE_TOURS = 600; + private static final int SAVE_ERROR_LOGS = 30; + private static final int CLEAR_CACHED_VALUES = 60 * 60; private static final int CALLBACK_TIME = 60 * 15; - private static int LAST_HOF_RELOAD = Emulator.getIntUnixTimestamp(); - - private static int LAST_NL_RELOAD = Emulator.getIntUnixTimestamp(); - - private static int LAST_INACTIVE_ROOMS_CLEARED = Emulator.getIntUnixTimestamp(); - - private static int LAST_INACTIVE_GUILDS_CLEARED = Emulator.getIntUnixTimestamp(); - - private static int LAST_INACTIVE_TOURS_CLEARED = Emulator.getIntUnixTimestamp(); - - private static int LAST_ERROR_LOGS_SAVED = Emulator.getIntUnixTimestamp(); - - private static int LAST_DAILY_REFILL = Emulator.getIntUnixTimestamp(); - private static int LAST_CALLBACK = Emulator.getIntUnixTimestamp(); - - private static int LAST_HABBO_CACHE_CLEARED = Emulator.getIntUnixTimestamp(); public CleanerThread() { @@ -110,7 +81,7 @@ public class CleanerThread implements Runnable { } if (time - LAST_ERROR_LOGS_SAVED > SAVE_ERROR_LOGS) { - Emulator.getLogging().saveLogs(); + Emulator.getDatabaseLogger().save(); LAST_ERROR_LOGS_SAVED = time; } @@ -156,9 +127,10 @@ public class CleanerThread implements Runnable { statement.execute("DELETE FROM users_effects WHERE total <= 0"); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } - Emulator.getLogging().logStart("Database -> Cleaned!"); + + LOGGER.info("Database -> Cleaned!"); } public void refillDailyRespects() { @@ -167,7 +139,7 @@ public class CleanerThread implements Runnable { statement.setInt(2, Emulator.getConfig().getInt("hotel.daily.respect.pets")); statement.executeUpdate(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } if (Emulator.isReady) { @@ -188,7 +160,7 @@ public class CleanerThread implements Runnable { habbo.clearCaches(); } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/core/CommandLog.java b/src/main/java/com/eu/habbo/core/CommandLog.java index 1f4cefbc..1dfb2847 100644 --- a/src/main/java/com/eu/habbo/core/CommandLog.java +++ b/src/main/java/com/eu/habbo/core/CommandLog.java @@ -6,8 +6,9 @@ import com.eu.habbo.habbohotel.commands.Command; import java.sql.PreparedStatement; import java.sql.SQLException; -public class CommandLog implements Loggable { - public static final String insertQuery = "INSERT INTO commandlogs (`user_id`, `timestamp`, `command`, `params`, `succes`) VALUES (?, ?, ?, ?, ?)"; +public class CommandLog implements DatabaseLoggable { + + private static final String INSERT_QUERY = "INSERT INTO commandlogs (`user_id`, `timestamp`, `command`, `params`, `succes`) VALUES (?, ?, ?, ?, ?)"; private final int userId; private final int timestamp = Emulator.getIntUnixTimestamp(); @@ -15,7 +16,6 @@ public class CommandLog implements Loggable { private final String params; private final boolean succes; - public CommandLog(int userId, Command command, String params, boolean succes) { this.userId = userId; this.command = command; @@ -23,6 +23,11 @@ public class CommandLog implements Loggable { this.succes = succes; } + @Override + public String getQuery() { + return CommandLog.INSERT_QUERY; + } + @Override public void log(PreparedStatement statement) throws SQLException { statement.setInt(1, this.userId); @@ -32,4 +37,5 @@ public class CommandLog implements Loggable { statement.setString(5, this.succes ? "yes" : "no"); statement.addBatch(); } + } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/core/ConfigurationManager.java b/src/main/java/com/eu/habbo/core/ConfigurationManager.java index 719fc4e4..29e50f73 100644 --- a/src/main/java/com/eu/habbo/core/ConfigurationManager.java +++ b/src/main/java/com/eu/habbo/core/ConfigurationManager.java @@ -3,6 +3,8 @@ package com.eu.habbo.core; import com.eu.habbo.Emulator; import com.eu.habbo.plugin.events.emulator.EmulatorConfigUpdatedEvent; import gnu.trove.map.hash.THashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.File; import java.io.FileInputStream; @@ -14,6 +16,8 @@ import java.util.Properties; public class ConfigurationManager { + private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationManager.class); + private final Properties properties; private final String configurationPath; public boolean loaded = false; @@ -25,7 +29,6 @@ public class ConfigurationManager { this.reload(); } - public void reload() { this.isLoading = true; this.properties.clear(); @@ -43,7 +46,7 @@ public class ConfigurationManager { this.properties.load(input); } catch (IOException ex) { - Emulator.getLogging().logErrorLine("[CRITICAL] FAILED TO LOAD CONFIG FILE! (" + this.configurationPath + ")"); + LOGGER.error("Failed to load config file.", ex); ex.printStackTrace(); } finally { if (input != null) { @@ -80,35 +83,31 @@ public class ConfigurationManager { envMapping.put("runtime.threads", "RT_THREADS"); envMapping.put("logging.errors.runtime", "RT_LOG_ERRORS"); - for (Map.Entry entry : envMapping.entrySet()) { String envValue = System.getenv(entry.getValue()); if (envValue == null || envValue.length() == 0) { - Emulator.getLogging().logStart("Cannot find environment-value for variable `" + entry.getValue() + "`"); + LOGGER.info("Cannot find environment-value for variable `" + entry.getValue() + "`"); } else { this.properties.setProperty(entry.getKey(), envValue); } } } - if (this.loaded) { this.loadFromDatabase(); } - this.isLoading = false; - Emulator.getLogging().logStart("Configuration Manager -> Loaded!"); + LOGGER.info("Configuration Manager -> Loaded!"); if (Emulator.getPluginManager() != null) { Emulator.getPluginManager().fireEvent(new EmulatorConfigUpdatedEvent()); } } - public void loadFromDatabase() { - Emulator.getLogging().logStart("Loading configuration from database..."); + LOGGER.info("Loading configuration from database..."); long millis = System.currentTimeMillis(); try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement()) { @@ -120,10 +119,10 @@ public class ConfigurationManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } - Emulator.getLogging().logStart("Configuration -> loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); + LOGGER.info("Configuration -> loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); } public void saveToDatabase() { @@ -134,7 +133,7 @@ public class ConfigurationManager { statement.executeUpdate(); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -149,17 +148,15 @@ public class ConfigurationManager { return defaultValue; if (!this.properties.containsKey(key)) { - Emulator.getLogging().logErrorLine("[CONFIG] Key not found: " + key); + LOGGER.error("Config key not found {}", key); } return this.properties.getProperty(key, defaultValue); } - public boolean getBoolean(String key) { return this.getBoolean(key, false); } - public boolean getBoolean(String key, boolean defaultValue) { if (this.isLoading) return defaultValue; @@ -167,17 +164,15 @@ public class ConfigurationManager { try { return (this.getValue(key, "0").equals("1")) || (this.getValue(key, "false").equals("true")); } catch (Exception e) { - Emulator.getLogging().logErrorLine("Failed to parse key " + key + " with value " + this.getValue(key) + " to type boolean."); + LOGGER.error("Failed to parse key {} with value '{}' to type boolean.", key, this.getValue(key)); } return defaultValue; } - public int getInt(String key) { return this.getInt(key, 0); } - public int getInt(String key, Integer defaultValue) { if (this.isLoading) return defaultValue; @@ -185,17 +180,15 @@ public class ConfigurationManager { try { return Integer.parseInt(this.getValue(key, defaultValue.toString())); } catch (Exception e) { - Emulator.getLogging().logErrorLine("Failed to parse key " + key + " with value " + this.getValue(key) + " to type integer."); + LOGGER.error("Failed to parse key {} with value '{}' to type integer.", key, this.getValue(key)); } return defaultValue; } - public double getDouble(String key) { return this.getDouble(key, 0.0); } - public double getDouble(String key, Double defaultValue) { if (this.isLoading) return defaultValue; @@ -203,13 +196,12 @@ public class ConfigurationManager { try { return Double.parseDouble(this.getValue(key, defaultValue.toString())); } catch (Exception e) { - Emulator.getLogging().logErrorLine("Failed to parse key " + key + " with value " + this.getValue(key) + " to type double."); + LOGGER.error("Failed to parse key {} with value '{}' to type double.", key, this.getValue(key)); } return defaultValue; } - public void update(String key, String value) { this.properties.setProperty(key, value); } @@ -223,7 +215,7 @@ public class ConfigurationManager { statement.setString(2, value); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } this.update(key, value); diff --git a/src/main/java/com/eu/habbo/core/CreditsScheduler.java b/src/main/java/com/eu/habbo/core/CreditsScheduler.java index ce136ede..d5442bbf 100644 --- a/src/main/java/com/eu/habbo/core/CreditsScheduler.java +++ b/src/main/java/com/eu/habbo/core/CreditsScheduler.java @@ -2,11 +2,15 @@ package com.eu.habbo.core; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.Habbo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.Map; public class CreditsScheduler extends Scheduler { + private static final Logger LOGGER = LoggerFactory.getLogger(CreditsScheduler.class); + public static boolean IGNORE_HOTEL_VIEW; public static boolean IGNORE_IDLED; @@ -48,7 +52,7 @@ public class CreditsScheduler extends Scheduler { habbo.giveCredits(habbo.getHabboInfo().getRank().getCreditsTimerAmount()); } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/core/Loggable.java b/src/main/java/com/eu/habbo/core/DatabaseLoggable.java similarity index 71% rename from src/main/java/com/eu/habbo/core/Loggable.java rename to src/main/java/com/eu/habbo/core/DatabaseLoggable.java index 90826717..821ea7aa 100644 --- a/src/main/java/com/eu/habbo/core/Loggable.java +++ b/src/main/java/com/eu/habbo/core/DatabaseLoggable.java @@ -3,6 +3,10 @@ package com.eu.habbo.core; import java.sql.PreparedStatement; import java.sql.SQLException; -public interface Loggable { +public interface DatabaseLoggable { + + String getQuery(); + void log(PreparedStatement statement) throws SQLException; -} \ No newline at end of file + +} diff --git a/src/main/java/com/eu/habbo/core/DatabaseLogger.java b/src/main/java/com/eu/habbo/core/DatabaseLogger.java new file mode 100644 index 00000000..2f8806a9 --- /dev/null +++ b/src/main/java/com/eu/habbo/core/DatabaseLogger.java @@ -0,0 +1,46 @@ +package com.eu.habbo.core; + +import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.concurrent.ConcurrentLinkedQueue; + +public class DatabaseLogger { + + private static final Logger LOGGER = LoggerFactory.getLogger(DatabaseLogger.class); + + private final ConcurrentLinkedQueue loggables = new ConcurrentLinkedQueue<>(); + + public void store(DatabaseLoggable loggable) { + this.loggables.add(loggable); + } + + public void save() { + if (Emulator.getDatabase() == null || Emulator.getDatabase().getDataSource() == null) { + return; + } + + if (this.loggables.isEmpty()) { + return; + } + + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) { + while (!this.loggables.isEmpty()) { + DatabaseLoggable loggable = this.loggables.remove(); + + try (PreparedStatement statement = connection.prepareStatement(loggable.getQuery())) { + loggable.log(statement); + statement.executeBatch(); + } + + } + } catch (SQLException e) { + LOGGER.error("Exception caught while saving loggables to database.", e); + } + } + +} diff --git a/src/main/java/com/eu/habbo/core/ErrorLog.java b/src/main/java/com/eu/habbo/core/ErrorLog.java index 44d0176f..f0d62072 100644 --- a/src/main/java/com/eu/habbo/core/ErrorLog.java +++ b/src/main/java/com/eu/habbo/core/ErrorLog.java @@ -1,6 +1,8 @@ package com.eu.habbo.core; import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; import java.io.PrintWriter; @@ -8,9 +10,11 @@ import java.io.StringWriter; import java.sql.PreparedStatement; import java.sql.SQLException; +public class ErrorLog implements DatabaseLoggable { + + private static final Logger LOGGER = LoggerFactory.getLogger(ErrorLog.class); + private static final String QUERY = "INSERT INTO emulator_errors (timestamp, version, build_hash, type, stacktrace) VALUES (?, ?, ?, ?, ?)"; -public class ErrorLog implements Loggable { - public final static String insertQuery = "INSERT INTO emulator_errors (timestamp, version, build_hash, type, stacktrace) VALUES (?, ?, ?, ?, ?)"; public final String version; public final String buildHash; @@ -19,7 +23,6 @@ public class ErrorLog implements Loggable { public final String stackTrace; public ErrorLog(String type, Throwable e) { - this.version = Emulator.version; this.buildHash = Emulator.version; @@ -35,7 +38,7 @@ public class ErrorLog implements Loggable { pw.close(); sw.close(); } catch (IOException e1) { - Emulator.getLogging().logErrorLine(e1); + LOGGER.error("Exception caught", e1); } } @@ -48,6 +51,11 @@ public class ErrorLog implements Loggable { this.stackTrace = message; } + @Override + public String getQuery() { + return QUERY; + } + @Override public void log(PreparedStatement statement) throws SQLException { statement.setInt(1, this.timeStamp); diff --git a/src/main/java/com/eu/habbo/core/GotwPointsScheduler.java b/src/main/java/com/eu/habbo/core/GotwPointsScheduler.java index 4a85969e..58b3acc7 100644 --- a/src/main/java/com/eu/habbo/core/GotwPointsScheduler.java +++ b/src/main/java/com/eu/habbo/core/GotwPointsScheduler.java @@ -2,11 +2,15 @@ package com.eu.habbo.core; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.Habbo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.Map; public class GotwPointsScheduler extends Scheduler { + private static final Logger LOGGER = LoggerFactory.getLogger(GotwPointsScheduler.class); + public static boolean IGNORE_HOTEL_VIEW; public static boolean IGNORE_IDLED; public static String GOTW_POINTS_NAME; @@ -63,7 +67,7 @@ public class GotwPointsScheduler extends Scheduler { } } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/core/Logging.java b/src/main/java/com/eu/habbo/core/Logging.java deleted file mode 100644 index c364f2ec..00000000 --- a/src/main/java/com/eu/habbo/core/Logging.java +++ /dev/null @@ -1,338 +0,0 @@ -package com.eu.habbo.core; - -import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.rooms.RoomChatMessage; -import gnu.trove.set.hash.THashSet; -import io.netty.util.internal.ConcurrentSet; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -public class Logging { - - public static final String ANSI_BRIGHT = "\u001B[1m"; - public static final String ANSI_ITALICS = "\u001B[3m"; - public static final String ANSI_UNDERLINE = "\u001B[4m"; - public static final String ANSI_RESET = "\u001B[0m"; - public static final String ANSI_BLACK = "\u001B[30m"; - public static final String ANSI_RED = "\u001B[31m"; - public static final String ANSI_GREEN = "\u001B[32m"; - public static final String ANSI_YELLOW = "\u001B[33m"; - public static final String ANSI_BLUE = "\u001B[34m"; - public static final String ANSI_PURPLE = "\u001B[35m"; - public static final String ANSI_CYAN = "\u001B[36m"; - public static final String ANSI_WHITE = "\u001B[37m"; - private static PrintWriter packetsWriter; - private static PrintWriter packetsUndefinedWriter; - private static PrintWriter errorsPacketsWriter; - private static PrintWriter errorsSQLWriter; - private static PrintWriter errorsRuntimeWriter; - private static PrintWriter debugFileWriter; - private final THashSet errorLogs = new THashSet<>(100); - - - private final THashSet commandLogs = new THashSet<>(100); - - private ConcurrentSet chatLogs = new ConcurrentSet<>(); - - public Logging() { - - File packets = new File("logging//packets//defined.txt"); - - File packetsUndefined = new File("logging//packets//packets.txt"); - - File errorsPackets = new File("logging//errors//packets.txt"); - - File errorsSQL = new File("logging//errors//sql.txt"); - - File errorsRuntime = new File("logging//errors//runtime.txt"); - - File debugFile = new File("logging//debug.txt"); - - try { - if (!packets.exists()) { - if (!packets.getParentFile().exists()) { - packets.getParentFile().mkdirs(); - } - - packets.createNewFile(); - } - - if (!packetsUndefined.exists()) { - if (!packetsUndefined.getParentFile().exists()) { - packetsUndefined.getParentFile().mkdirs(); - } - - packetsUndefined.createNewFile(); - } - - if (!errorsPackets.exists()) { - if (!errorsPackets.getParentFile().exists()) { - errorsPackets.getParentFile().mkdirs(); - } - - errorsPackets.createNewFile(); - } - - if (!errorsSQL.exists()) { - if (!errorsSQL.getParentFile().exists()) { - errorsSQL.getParentFile().mkdirs(); - } - - errorsSQL.createNewFile(); - } - - if (!errorsRuntime.exists()) { - if (!errorsRuntime.getParentFile().exists()) { - errorsRuntime.getParentFile().mkdirs(); - } - - errorsRuntime.createNewFile(); - } - - if (!debugFile.exists()) { - if (!debugFile.getParentFile().exists()) { - debugFile.getParentFile().mkdirs(); - } - - debugFile.createNewFile(); - } - } catch (Exception e) { - e.printStackTrace(); - } - - try { - packetsWriter = new PrintWriter(new FileWriter(packets, true)); - packetsUndefinedWriter = new PrintWriter(new FileWriter(packetsUndefined, true)); - errorsPacketsWriter = new PrintWriter(new FileWriter(errorsPackets, true)); - errorsSQLWriter = new PrintWriter(new FileWriter(errorsSQL, true)); - errorsRuntimeWriter = new PrintWriter(new FileWriter(errorsRuntime, true)); - debugFileWriter = new PrintWriter(new FileWriter(debugFile, true)); - } catch (IOException e) { - System.out.println("[CRITICAL] FAILED TO LOAD LOGGING COMPONENT!"); - } - } - - public static PrintWriter getPacketsWriter() { - return packetsWriter; - } - - public static PrintWriter getPacketsUndefinedWriter() { - return packetsUndefinedWriter; - } - - public void logStart(Object line) { - System.out.println("[" + Logging.ANSI_BRIGHT + Logging.ANSI_GREEN + "LOADING" + Logging.ANSI_RESET + "] " + line.toString()); - } - - public void logShutdownLine(Object line) { - if (Emulator.getConfig().getBoolean("logging.debug")) { - this.write(debugFileWriter, line.toString()); - } - System.out.println("[" + Logging.ANSI_BRIGHT + Logging.ANSI_RED + "SHUTDOWN" + Logging.ANSI_RESET + "] " + line.toString()); - } - - public void logUserLine(Object line) { - if (Emulator.getConfig().getBoolean("logging.debug")) { - this.write(debugFileWriter, line.toString()); - } - - if (Emulator.getConfig().getBoolean("debug.show.users")) { - System.out.println("[USER] " + line.toString()); - } - } - - public synchronized void logDebugLine(Object line) { - if (line instanceof Throwable) { - this.logErrorLine(line); - return; - } - if (Emulator.getConfig().getBoolean("debug.mode")) { - System.out.println("[DEBUG] " + line.toString()); - } - - if (Emulator.getConfig().getBoolean("logging.debug")) { - this.write(debugFileWriter, line.toString()); - } - } - - public synchronized void logPacketLine(Object line) { - if (Emulator.getConfig().getBoolean("debug.show.packets")) { - System.out.println("[" + Logging.ANSI_BLUE + "PACKET" + Logging.ANSI_RESET + "]" + line.toString()); - } - - if (Emulator.getConfig().getBoolean("logging.packets")) { - this.write(packetsWriter, line.toString()); - } - } - - public synchronized void logUndefinedPacketLine(Object line) { - if (Emulator.getConfig().getBoolean("debug.show.packets.undefined")) { - System.out.println("[PACKET] [UNDEFINED] " + line.toString()); - } - - if (Emulator.getConfig().getBoolean("logging.packets.undefined")) { - this.write(packetsUndefinedWriter, line.toString()); - } - } - - public synchronized void logErrorLine(Object line) { - if (Emulator.isReady && Emulator.getConfig().getBoolean("debug.show.errors")) { - System.err.println("[ERROR] " + line.toString()); - } - - if (Emulator.getConfig().loaded && Emulator.getConfig().getBoolean("logging.errors.runtime")) { - this.write(errorsRuntimeWriter, line); - } - - if (line instanceof Throwable) { - ((Throwable) line).printStackTrace(); - if (line instanceof SQLException) { - this.logSQLException((SQLException) line); - return; - } - // Emulator.getThreading().run(new HTTPPostError((Throwable) line)); - - this.errorLogs.add(new ErrorLog("Exception", (Throwable) line)); - - return; - } - - this.errorLogs.add(new ErrorLog("Emulator", line.toString())); - } - - public void logSQLException(SQLException e) { - if (Emulator.getConfig().getBoolean("logging.errors.sql")) { - e.printStackTrace(); - this.write(errorsSQLWriter, e); - - //Emulator.getThreading().run(new HTTPPostError(e)); - } - } - - public void logPacketError(Object e) { - if (Emulator.getConfig().getBoolean("logging.errors.packets")) { - if (e instanceof Throwable) - ((Exception) e).printStackTrace(); - - this.write(errorsPacketsWriter, e); - } - - if (e instanceof Throwable) { - ((Throwable) e).printStackTrace(); - if (e instanceof SQLException) { - this.logSQLException((SQLException) e); - return; - } - - // Emulator.getThreading().run(new HTTPPostError((Throwable) e)); - } - } - - public void handleException(Exception e) { - e.printStackTrace(); - } - - private synchronized void write(PrintWriter printWriter, Object message) { - if (printWriter != null && message != null) { - if (message instanceof Throwable) { - ((Exception) message).printStackTrace(printWriter); - } else { - printWriter.write("MSG: " + message.toString() + "\r\n"); - } - - printWriter.flush(); - } - } - - public void addLog(Loggable log) { - if (log instanceof ErrorLog) { - synchronized (this.errorLogs) { - this.errorLogs.add(log); - } - } else if (log instanceof CommandLog) { - synchronized (this.commandLogs) { - this.commandLogs.add(log); - } - } - } - - public void addChatLog(Loggable chatLog) { - this.chatLogs.add(chatLog); - } - - public void saveLogs() { - if (Emulator.getDatabase() != null && Emulator.getDatabase().getDataSource() != null) { - if (!this.errorLogs.isEmpty() || !this.commandLogs.isEmpty() || !this.chatLogs.isEmpty()) { - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) { - if (!this.errorLogs.isEmpty()) { - synchronized (this.errorLogs) { - try (PreparedStatement statement = connection.prepareStatement(ErrorLog.insertQuery)) { - for (Loggable log : this.errorLogs) { - log.log(statement); - } - statement.executeBatch(); - } - this.errorLogs.clear(); - } - } - - if (!this.commandLogs.isEmpty()) { - synchronized (this.commandLogs) { - try (PreparedStatement statement = connection.prepareStatement(CommandLog.insertQuery)) { - for (Loggable log : this.commandLogs) { - log.log(statement); - } - - statement.executeBatch(); - } - this.commandLogs.clear(); - } - } - - if (!this.chatLogs.isEmpty()) { - ConcurrentSet chatLogs = this.chatLogs; - this.chatLogs = new ConcurrentSet<>(); - - try (PreparedStatement statement = connection.prepareStatement(RoomChatMessage.insertQuery)) { - for (Loggable log : chatLogs) { - log.log(statement); - } - - statement.executeBatch(); - } - chatLogs.clear(); - } - } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); - } - } - } - } - /* - public static PrintWriter getErrorsPacketsWriter() - { - return errorsPacketsWriter; - } - - public static PrintWriter getErrorsSQLWriter() - { - return errorsSQLWriter; - } - - public static PrintWriter getErrorsRuntimeWriter() - { - return errorsRuntimeWriter; - } - - public static PrintWriter getDebugFileWriter() - { - return debugFileWriter; - } - */ -} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/core/PixelScheduler.java b/src/main/java/com/eu/habbo/core/PixelScheduler.java index 13a0cf3d..cadf07ea 100644 --- a/src/main/java/com/eu/habbo/core/PixelScheduler.java +++ b/src/main/java/com/eu/habbo/core/PixelScheduler.java @@ -2,11 +2,15 @@ package com.eu.habbo.core; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.Habbo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.Map; public class PixelScheduler extends Scheduler { + private static final Logger LOGGER = LoggerFactory.getLogger(PixelScheduler.class); + public static boolean IGNORE_HOTEL_VIEW; public static boolean IGNORE_IDLED; @@ -46,7 +50,7 @@ public class PixelScheduler extends Scheduler { habbo.givePixels(habbo.getHabboInfo().getRank().getPixelsTimerAmount()); } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/core/PointsScheduler.java b/src/main/java/com/eu/habbo/core/PointsScheduler.java index f5c8042d..d30abc6a 100644 --- a/src/main/java/com/eu/habbo/core/PointsScheduler.java +++ b/src/main/java/com/eu/habbo/core/PointsScheduler.java @@ -2,11 +2,15 @@ package com.eu.habbo.core; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.Habbo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.Map; public class PointsScheduler extends Scheduler { + private static final Logger LOGGER = LoggerFactory.getLogger(PointsScheduler.class); + public static boolean IGNORE_HOTEL_VIEW; public static boolean IGNORE_IDLED; @@ -49,7 +53,7 @@ public class PointsScheduler extends Scheduler { habbo.givePoints(habbo.getHabboInfo().getRank().getDiamondsTimerAmount()); } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/core/TextsManager.java b/src/main/java/com/eu/habbo/core/TextsManager.java index 7b28651c..90c6520a 100644 --- a/src/main/java/com/eu/habbo/core/TextsManager.java +++ b/src/main/java/com/eu/habbo/core/TextsManager.java @@ -1,12 +1,16 @@ package com.eu.habbo.core; import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.*; import java.util.Properties; public class TextsManager { + private static final Logger LOGGER = LoggerFactory.getLogger(TextsManager.class); + private final Properties texts; public TextsManager() { @@ -15,16 +19,14 @@ public class TextsManager { this.texts = new Properties(); try { - this.reload(); - Emulator.getLogging().logStart("Texts Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); + LOGGER.info("Texts Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); } catch (Exception e) { e.printStackTrace(); } } - public void reload() throws Exception { try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM emulator_texts")) { while (set.next()) { @@ -35,54 +37,47 @@ public class TextsManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } - public String getValue(String key) { return this.getValue(key, ""); } - public String getValue(String key, String defaultValue) { if (!this.texts.containsKey(key)) { - Emulator.getLogging().logErrorLine("[TEXTS] Text key not found: " + key); + LOGGER.error("Text key not found: {}", key); } return this.texts.getProperty(key, defaultValue); } - public boolean getBoolean(String key) { return this.getBoolean(key, false); } - public boolean getBoolean(String key, Boolean defaultValue) { try { return (this.getValue(key, "0").equals("1")) || (this.getValue(key, "false").equals("true")); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } return defaultValue; } - public int getInt(String key) { return this.getInt(key, 0); } - public int getInt(String key, Integer defaultValue) { try { return Integer.parseInt(this.getValue(key, defaultValue.toString())); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } return defaultValue; } - public void update(String key, String value) { this.texts.setProperty(key, value); } @@ -96,7 +91,7 @@ public class TextsManager { statement.setString(2, value); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } this.update(key, value); diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java index 25e523a9..43aa98d0 100644 --- a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java +++ b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java @@ -1,25 +1,22 @@ package com.eu.habbo.core.consolecommands; -import com.eu.habbo.Emulator; import gnu.trove.map.hash.THashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public abstract class ConsoleCommand { + private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleCommand.class); private static final THashMap commands = new THashMap<>(); - public final String key; - - public final String usage; - public ConsoleCommand(String key, String usage) { this.key = key; this.usage = usage; } - public static void load() { addCommand(new ConsoleShutdownCommand()); addCommand(new ConsoleInfoCommand()); @@ -48,7 +45,7 @@ public abstract class ConsoleCommand { command.handle(message); return true; } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } } else { System.out.println("Unknown Console Command " + message[0]); @@ -64,4 +61,5 @@ public abstract class ConsoleCommand { } public abstract void handle(String[] args) throws Exception; + } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/crypto/HabboDiffieHellman.java b/src/main/java/com/eu/habbo/crypto/HabboDiffieHellman.java index bf5f0ccc..f9db196d 100644 --- a/src/main/java/com/eu/habbo/crypto/HabboDiffieHellman.java +++ b/src/main/java/com/eu/habbo/crypto/HabboDiffieHellman.java @@ -2,7 +2,7 @@ package com.eu.habbo.crypto; import com.eu.habbo.crypto.exceptions.HabboCryptoException; import com.eu.habbo.crypto.utils.BigIntegerUtils; -import com.eu.habbo.crypto.utils.HexUtils; +import com.eu.habbo.util.HexUtils; import java.math.BigInteger; import java.nio.charset.StandardCharsets; diff --git a/src/main/java/com/eu/habbo/crypto/utils/HexUtils.java b/src/main/java/com/eu/habbo/crypto/utils/HexUtils.java deleted file mode 100644 index ae935ed0..00000000 --- a/src/main/java/com/eu/habbo/crypto/utils/HexUtils.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.eu.habbo.crypto.utils; - -public class HexUtils { - - private static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray(); - - public static String toHex(byte[] bytes) { - char[] hexChars = new char[bytes.length * 2]; - for (int j = 0; j < bytes.length; j++) { - int v = bytes[j] & 0xFF; - hexChars[j * 2] = HEX_ARRAY[v >>> 4]; - hexChars[j * 2 + 1] = HEX_ARRAY[v & 0x0F]; - } - return new String(hexChars); - } - - public static byte[] toBytes(String hexString) { - int len = hexString.length(); - byte[] data = new byte[len / 2]; - for (int i = 0; i < len; i += 2) { - data[i / 2] = (byte) ((Character.digit(hexString.charAt(i), 16) << 4) - + Character.digit(hexString.charAt(i+1), 16)); - } - return data; - } - -} diff --git a/src/main/java/com/eu/habbo/database/Database.java b/src/main/java/com/eu/habbo/database/Database.java index 81f7c508..c37a524a 100644 --- a/src/main/java/com/eu/habbo/database/Database.java +++ b/src/main/java/com/eu/habbo/database/Database.java @@ -3,16 +3,17 @@ package com.eu.habbo.database; import com.eu.habbo.Emulator; import com.eu.habbo.core.ConfigurationManager; import com.zaxxer.hikari.HikariDataSource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class Database { + private static final Logger LOGGER = LoggerFactory.getLogger(Database.class); + private HikariDataSource dataSource; - - private DatabasePool databasePool; public Database(ConfigurationManager config) { - long millis = System.currentTimeMillis(); boolean SQLException = false; @@ -20,25 +21,23 @@ public class Database { try { this.databasePool = new DatabasePool(); if (!this.databasePool.getStoragePooling(config)) { - Emulator.getLogging().logStart("Failed to connect to the database. Please check config.ini and make sure the MySQL process is running. Shutting down..."); + LOGGER.info("Failed to connect to the database. Please check config.ini and make sure the MySQL process is running. Shutting down..."); SQLException = true; return; } this.dataSource = this.databasePool.getDatabase(); } catch (Exception e) { SQLException = true; - e.printStackTrace(); - Emulator.getLogging().logStart("Failed to connect to your database."); - Emulator.getLogging().logStart(e.getMessage()); + LOGGER.error("Failed to connect to your database.", e); } finally { - if (SQLException) + if (SQLException) { Emulator.prepareShutdown(); + } } - Emulator.getLogging().logStart("Database -> Connected! (" + (System.currentTimeMillis() - millis) + " MS)"); + LOGGER.info("Database -> Connected! ({} MS)", System.currentTimeMillis() - millis); } - public void dispose() { if (this.databasePool != null) { this.databasePool.getDatabase().close(); @@ -55,4 +54,3 @@ public class Database { return this.databasePool; } } - diff --git a/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java b/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java index 93312b2c..63a956bb 100644 --- a/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java +++ b/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java @@ -1,10 +1,7 @@ package com.eu.habbo.habbohotel; import com.eu.habbo.Emulator; -import com.eu.habbo.core.CreditsScheduler; -import com.eu.habbo.core.GotwPointsScheduler; -import com.eu.habbo.core.PixelScheduler; -import com.eu.habbo.core.PointsScheduler; +import com.eu.habbo.core.*; import com.eu.habbo.habbohotel.achievements.AchievementManager; import com.eu.habbo.habbohotel.bots.BotManager; import com.eu.habbo.habbohotel.catalog.CatalogManager; @@ -23,8 +20,13 @@ import com.eu.habbo.habbohotel.pets.PetManager; import com.eu.habbo.habbohotel.polls.PollManager; import com.eu.habbo.habbohotel.rooms.RoomManager; import com.eu.habbo.habbohotel.users.HabboManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class GameEnvironment { + + private static final Logger LOGGER = LoggerFactory.getLogger(GameEnvironment.class); + public CreditsScheduler creditsScheduler; public PixelScheduler pixelScheduler; public PointsScheduler pointsScheduler; @@ -49,7 +51,7 @@ public class GameEnvironment { private PollManager pollManager; public void load() throws Exception { - Emulator.getLogging().logStart("GameEnvironment -> Loading..."); + LOGGER.info("GameEnvironment -> Loading..."); this.permissionsManager = new PermissionsManager(); this.habboManager = new HabboManager(); @@ -85,7 +87,7 @@ public class GameEnvironment { Emulator.getThreading().run(this.gotwPointsScheduler); - Emulator.getLogging().logStart("GameEnvironment -> Loaded!"); + LOGGER.info("GameEnvironment -> Loaded!"); } public void dispose() { @@ -101,7 +103,7 @@ public class GameEnvironment { this.roomManager.dispose(); this.itemManager.dispose(); this.hotelViewManager.dispose(); - Emulator.getLogging().logShutdownLine("GameEnvironment -> Disposed!"); + LOGGER.info("GameEnvironment -> Disposed!"); } public HabboManager getHabboManager() { diff --git a/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java b/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java index c6a865e5..a00a79cf 100644 --- a/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java @@ -58,7 +58,7 @@ public class AchievementManager { statement.setInt(4, amount); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } @@ -140,7 +140,7 @@ public class AchievementManager { try { badge = habbo.getInventory().getBadgesComponent().getBadge(("ACH_" + achievement.name + oldLevel.level).toLowerCase()); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); return; } } @@ -203,7 +203,7 @@ public class AchievementManager { statement.setInt(3, 1); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -217,7 +217,7 @@ public class AchievementManager { } statement.executeBatch(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -231,7 +231,7 @@ public class AchievementManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return 0; @@ -254,9 +254,9 @@ public class AchievementManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } @@ -276,13 +276,13 @@ public class AchievementManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); Emulator.getLogging().logErrorLine("Achievement Manager -> Failed to load!"); return; } } - Emulator.getLogging().logStart("Achievement Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); + logger.info("Achievement Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); } public Achievement getAchievement(String name) { diff --git a/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java b/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java index 31e5d861..e104c4fa 100644 --- a/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java +++ b/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java @@ -57,7 +57,7 @@ public class TalentTrackLevel { if (item != null) { this.items.add(item); } else { - Emulator.getLogging().logStart("Incorrect reward furni (ID: " + s + ") for talent track level " + this.level); + logger.info("Incorrect reward furni (ID: " + s + ") for talent track level " + this.level); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java b/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java index d10ed613..197ecd4c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java @@ -155,7 +155,7 @@ public class Bot implements Runnable { statement.execute(); this.needsUpdate = false; } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java index 3afd12e0..3d5754dc 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java @@ -38,7 +38,7 @@ public class BotManager { this.reload(); - Emulator.getLogging().logStart("Bot Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); + logger.info("Bot Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); } public static void addBotDefinition(String type, Class botClazz) throws Exception { @@ -58,10 +58,10 @@ public class BotManager { m.setAccessible(true); m.invoke(null); } catch (NoSuchMethodException e) { - Emulator.getLogging().logStart("Bot Manager -> Failed to execute initialise method upon bot type '" + set.getKey() + "'. No Such Method!"); + logger.info("Bot Manager -> Failed to execute initialise method upon bot type '" + set.getKey() + "'. No Such Method!"); return false; } catch (Exception e) { - Emulator.getLogging().logStart("Bot Manager -> Failed to execute initialise method upon bot type '" + set.getKey() + "'. Error: " + e.getMessage()); + logger.info("Bot Manager -> Failed to execute initialise method upon bot type '" + set.getKey() + "'. Error: " + e.getMessage()); return false; } } @@ -88,12 +88,12 @@ public class BotManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return bot; @@ -143,7 +143,7 @@ public class BotManager { try { topItem.onWalkOn(bot.getRoomUnit(), room, null); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } bot.cycle(false); @@ -195,9 +195,9 @@ public class BotManager { else Emulator.getLogging().logErrorLine("Unknown Bot Type: " + type); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } return null; @@ -208,7 +208,7 @@ public class BotManager { statement.setInt(1, bot.getId()); return statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return false; @@ -221,9 +221,9 @@ public class BotManager { m.setAccessible(true); m.invoke(null); } catch (NoSuchMethodException e) { - Emulator.getLogging().logStart("Bot Manager -> Failed to execute dispose method upon bot type '" + set.getKey() + "'. No Such Method!"); + logger.info("Bot Manager -> Failed to execute dispose method upon bot type '" + set.getKey() + "'. No Such Method!"); } catch (Exception e) { - Emulator.getLogging().logStart("Bot Manager -> Failed to execute dispose method upon bot type '" + set.getKey() + "'. Error: " + e.getMessage()); + logger.info("Bot Manager -> Failed to execute dispose method upon bot type '" + set.getKey() + "'. Error: " + e.getMessage()); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/ButlerBot.java b/src/main/java/com/eu/habbo/habbohotel/bots/ButlerBot.java index 3f169e7c..11c82cc3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/ButlerBot.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/ButlerBot.java @@ -43,7 +43,7 @@ public class ButlerBot extends Bot { serveItems.put(ks, set.getInt("item")); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java index 9abeae91..21e02620 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java @@ -211,7 +211,7 @@ public class CatalogItem implements ISerialize, Runnable, Comparable 0) { @@ -259,7 +259,7 @@ public class CatalogItem implements ISerialize, Runnable, Comparable> pageDefinitions = new THashMap>(CatalogPageLayouts.values().length) { { for (CatalogPageLayouts layout : CatalogPageLayouts.values()) { @@ -209,7 +214,7 @@ public class CatalogManager { this.ecotronItem = Emulator.getGameEnvironment().getItemManager().getItem("ecotron_box"); - Emulator.getLogging().logStart("Catalog Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); + LOGGER.info("Catalog Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); } @@ -249,7 +254,7 @@ public class CatalogManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } for (Map.Entry> set : limiteds.entrySet()) { @@ -269,7 +274,7 @@ public class CatalogManager { Class pageClazz = pageDefinitions.get(set.getString("page_layout")); if (pageClazz == null) { - Emulator.getLogging().logStart("Unknown Page Layout: " + set.getString("page_layout")); + LOGGER.info("Unknown Page Layout: " + set.getString("page_layout")); continue; } @@ -277,12 +282,12 @@ public class CatalogManager { CatalogPage page = pageClazz.getConstructor(ResultSet.class).newInstance(set); pages.put(page.getId(), page); } catch (Exception e) { - Emulator.getLogging().logErrorLine("Failed to load layout: " + set.getString("page_layout")); + LOGGER.error("Failed to load layout: {}", set.getString("page_layout")); } } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } pages.forEachValue((object) -> { @@ -294,7 +299,7 @@ public class CatalogManager { } } else { if (object.parentId != -2) { - Emulator.getLogging().logStart("Parent Page not found for " + object.getPageName() + " (ID: " + object.id + ", parent_id: " + object.parentId + ")"); + LOGGER.info("Parent Page not found for " + object.getPageName() + " (ID: " + object.id + ", parent_id: " + object.parentId + ")"); } } return true; @@ -302,7 +307,7 @@ public class CatalogManager { this.catalogPages.putAll(pages); - Emulator.getLogging().logStart("Loaded " + this.catalogPages.size() + " Catalog Pages!"); + LOGGER.info("Loaded " + this.catalogPages.size() + " Catalog Pages!"); } @@ -323,7 +328,7 @@ public class CatalogManager { )); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -367,7 +372,7 @@ public class CatalogManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } for (CatalogPage page : this.catalogPages.valueCollection()) { @@ -392,7 +397,7 @@ public class CatalogManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -408,7 +413,7 @@ public class CatalogManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } } @@ -423,7 +428,7 @@ public class CatalogManager { this.vouchers.add(new Voucher(set)); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } } @@ -443,11 +448,11 @@ public class CatalogManager { this.prizes.get(set.getInt("rarity")).add(item); } else { - Emulator.getLogging().logErrorLine("Cannot load item with ID:" + set.getInt("item_id") + " as recycler reward!"); + LOGGER.error("Cannot load item with ID: {} as recycler reward!", set.getInt("item_id")); } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } } @@ -472,7 +477,7 @@ public class CatalogManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } } @@ -489,7 +494,7 @@ public class CatalogManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } } @@ -504,7 +509,7 @@ public class CatalogManager { this.clothing.put(set.getInt("id"), new ClothItem(set)); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } } @@ -594,7 +599,7 @@ public class CatalogManager { return statement.executeUpdate() >= 1; } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return false; @@ -699,7 +704,7 @@ public class CatalogManager { if (this.prizes.containsKey(level) && !this.prizes.get(level).isEmpty()) { return (Item) this.prizes.get(level).toArray()[Emulator.getRandom().nextInt(this.prizes.get(level).size())]; } else { - Emulator.getLogging().logErrorLine("[Recycler] No rewards specified for rarity level " + level); + LOGGER.error("No rewards specified for rarity level {}", level); } return null; @@ -730,13 +735,11 @@ public class CatalogManager { if (pageClazz != null) { try { catalogPage = pageClazz.getConstructor(ResultSet.class).newInstance(page); - } catch (InvocationTargetException e) { - Emulator.getLogging().logErrorLine(e.getCause()); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } } else { - Emulator.getLogging().logErrorLine("Unknown Page Layout: " + page.getString("page_layout")); + LOGGER.error("Unknown page layout: {}", page.getString("page_layout")); } } } @@ -744,7 +747,7 @@ public class CatalogManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } if (catalogPage != null) { @@ -803,7 +806,7 @@ public class CatalogManager { } } - Emulator.getLogging().logShutdownLine("Catalog Manager -> Disposed!"); + LOGGER.info("Catalog Manager -> Disposed!"); } @@ -872,7 +875,7 @@ public class CatalogManager { if (amount > 1 && !CatalogItem.haveOffer(item)) { String message = Emulator.getTexts().getValue("scripter.warning.catalog.amount").replace("%username%", habbo.getHabboInfo().getUsername()).replace("%itemname%", item.getName()).replace("%pagename%", page.getCaption()); ScripterManager.scripterDetected(habbo.getClient(), message); - Emulator.getLogging().logUserLine(message); + LOGGER.info(message); habbo.getClient().sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.ILLEGAL)); return; } @@ -957,7 +960,7 @@ public class CatalogManager { try { pet = Emulator.getGameEnvironment().getPetManager().createPet(baseItem, data[0], data[1], data[2], habbo.getClient()); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); } @@ -1012,7 +1015,7 @@ public class CatalogManager { try { guildId = Integer.parseInt(extradata); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); return; } @@ -1120,7 +1123,7 @@ public class CatalogManager { habbo.getClient().sendResponse(new InventoryRefreshComposer()); } catch (Exception e) { - Emulator.getLogging().logPacketError(e); + LOGGER.error("Exception caught", e); habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); } } finally { @@ -1158,7 +1161,7 @@ public class CatalogManager { statement.setInt(3, Emulator.getIntUnixTimestamp()); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPage.java b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPage.java index 4c7562ee..53fab1c3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPage.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPage.java @@ -70,7 +70,7 @@ public abstract class CatalogPage implements Comparable, ISerialize try { this.included.add(Integer.valueOf(id)); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); Emulator.getLogging().logErrorLine("Failed to parse includes column value of (" + id + ") for catalog page (" + this.id + ")"); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/Voucher.java b/src/main/java/com/eu/habbo/habbohotel/catalog/Voucher.java index 7291e193..cf37a8e2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/Voucher.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/Voucher.java @@ -41,7 +41,7 @@ public class Voucher { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -64,7 +64,7 @@ public class Voucher { statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/RoomBundleLayout.java b/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/RoomBundleLayout.java index e05ccb84..e2bb6ed4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/RoomBundleLayout.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/RoomBundleLayout.java @@ -185,7 +185,7 @@ public class RoomBundleLayout extends SingleBundle { statement.setInt(3, this.room.getId()); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -219,7 +219,7 @@ public class RoomBundleLayout extends SingleBundle { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } Room r = Emulator.getGameEnvironment().getRoomManager().loadRoom(roomId); diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java index 2e978403..ca7ba320 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java @@ -43,7 +43,7 @@ public class MarketPlace { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return offers; @@ -101,7 +101,7 @@ public class MarketPlace { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); habbo.getClient().sendResponse(new MarketplaceCancelSaleComposer(offer, false)); } } @@ -163,7 +163,7 @@ public class MarketPlace { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return offers; @@ -193,7 +193,7 @@ public class MarketPlace { message.appendInt(1); message.appendInt(itemId); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -208,7 +208,7 @@ public class MarketPlace { number = set.getInt("number"); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return number; @@ -226,7 +226,7 @@ public class MarketPlace { avg = set.getInt("avg"); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return calculateCommision(avg); @@ -294,7 +294,7 @@ public class MarketPlace { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -321,7 +321,7 @@ public class MarketPlace { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -388,7 +388,7 @@ public class MarketPlace { statement.setInt(2, offer.getOfferId()); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlaceOffer.java b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlaceOffer.java index f8b68e5a..4bfb6307 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlaceOffer.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlaceOffer.java @@ -66,7 +66,7 @@ public class MarketPlaceOffer implements Runnable { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -86,7 +86,7 @@ public class MarketPlaceOffer implements Runnable { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -160,7 +160,7 @@ public class MarketPlaceOffer implements Runnable { statement.setInt(3, this.offerId); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/AddYoutubePlaylistCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/AddYoutubePlaylistCommand.java index 5318102b..28fe8339 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/AddYoutubePlaylistCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/AddYoutubePlaylistCommand.java @@ -49,7 +49,7 @@ public class AddYoutubePlaylistCommand extends Command { statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_add_youtube_playlist")); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/BadgeCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/BadgeCommand.java index eac670e7..31f54aac 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/BadgeCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/BadgeCommand.java @@ -72,7 +72,7 @@ public class BadgeCommand extends Command { return true; } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/CommandHandler.java b/src/main/java/com/eu/habbo/habbohotel/commands/CommandHandler.java index dbf2fa6a..a8e550a1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/CommandHandler.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/CommandHandler.java @@ -15,6 +15,8 @@ import com.eu.habbo.plugin.events.users.UserCommandEvent; import com.eu.habbo.plugin.events.users.UserExecuteCommandEvent; import gnu.trove.iterator.TIntObjectIterator; import gnu.trove.map.hash.THashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.Comparator; @@ -22,6 +24,9 @@ import java.util.List; import java.util.NoSuchElementException; public class CommandHandler { + + private static final Logger LOGGER = LoggerFactory.getLogger(CommandHandler.class); + private final static THashMap commands = new THashMap<>(5); private static final Comparator ALPHABETICAL_ORDER = new Comparator() { public int compare(Command c1, Command c2) { @@ -33,7 +38,7 @@ public class CommandHandler { public CommandHandler() { long millis = System.currentTimeMillis(); this.reloadCommands(); - Emulator.getLogging().logStart("Command Handler -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); + LOGGER.info("Command Handler -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); } public static void addCommand(Command command) { @@ -48,9 +53,9 @@ public class CommandHandler { try { //command.getConstructor().setAccessible(true); addCommand(command.newInstance()); - Emulator.getLogging().logDebugLine("Added command: " + command.getName()); + LOGGER.debug("Added command: {}", command.getName()); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } } @@ -79,11 +84,11 @@ public class CommandHandler { succes = event.succes; } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } if (gameClient.getHabbo().getHabboInfo().getRank().isLogCommands()) { - Emulator.getLogging().addLog(new CommandLog(gameClient.getHabbo().getHabboInfo().getId(), command, commandLine, succes)); + Emulator.getDatabaseLogger().store(new CommandLog(gameClient.getHabbo().getHabboInfo().getId(), command, commandLine, succes)); } } @@ -305,7 +310,6 @@ public class CommandHandler { public void dispose() { commands.clear(); - - Emulator.getLogging().logShutdownLine("Command Handler -> Disposed!"); + LOGGER.info("Command Handler -> Disposed!"); } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/EnableCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/EnableCommand.java index 3b459feb..b2a9cef6 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/EnableCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/EnableCommand.java @@ -38,7 +38,7 @@ public class EnableCommand extends Command { } } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/FilterWordCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/FilterWordCommand.java index 148fa4c8..73cfb7e5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/FilterWordCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/FilterWordCommand.java @@ -35,7 +35,7 @@ public class FilterWordCommand extends Command { statement.setString(2, replacement); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_filterword.error")); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/RoomBundleCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/RoomBundleCommand.java index 8affbd20..2fd4031e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/RoomBundleCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/RoomBundleCommand.java @@ -62,7 +62,7 @@ public class RoomBundleCommand extends Command { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } ((RoomBundleLayout) page).loadItems(gameClient.getHabbo().getHabboInfo().getCurrentRoom()); diff --git a/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingManager.java b/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingManager.java index cdaded07..abdbf28e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingManager.java @@ -60,7 +60,7 @@ public class CraftingManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -114,7 +114,7 @@ public class CraftingManager { } statement.executeBatch(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } this.altars.clear(); diff --git a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java index eb9e6a8f..b9b81e4d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java +++ b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java @@ -1,16 +1,14 @@ package com.eu.habbo.habbohotel.gameclients; import com.eu.habbo.Emulator; -import com.eu.habbo.core.Logging; import com.eu.habbo.crypto.HabboEncryption; import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.messages.PacketManager; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.MessageComposer; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import io.netty.channel.Channel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -20,6 +18,8 @@ import java.util.concurrent.ConcurrentHashMap; public class GameClient { + private static final Logger LOGGER = LoggerFactory.getLogger(GameClient.class); + private final Channel channel; private final HabboEncryption encryption; @@ -81,7 +81,7 @@ public class GameClient { statement.setInt(2, this.habbo.getHabboInfo().getId()); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } } @@ -92,7 +92,7 @@ public class GameClient { this.channel.write(composer.compose().retain(), this.channel.voidPromise()); this.channel.flush(); } catch (Exception e) { - Emulator.getLogging().logPacketError(e); + LOGGER.error("Caught exception", e); } } } @@ -135,7 +135,7 @@ public class GameClient { this.habbo = null; } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/games/Game.java b/src/main/java/com/eu/habbo/habbohotel/games/Game.java index b64d8292..619423e3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/Game.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/Game.java @@ -73,7 +73,7 @@ public abstract class Game implements Runnable { return true; } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } return false; diff --git a/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java b/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java index 074d494a..094ee146 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java @@ -149,7 +149,7 @@ public class BattleBanzaiGame extends Game { } } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java b/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java index 24b0a64c..c44a7fa0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java @@ -261,7 +261,7 @@ public class FreezeGame extends Game { } } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/Guild.java b/src/main/java/com/eu/habbo/habbohotel/guilds/Guild.java index 075b31a7..f43e52b0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/guilds/Guild.java +++ b/src/main/java/com/eu/habbo/habbohotel/guilds/Guild.java @@ -91,7 +91,7 @@ public class Guild implements Runnable { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -116,7 +116,7 @@ public class Guild implements Runnable { this.needsUpdate = false; } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/GuildManager.java b/src/main/java/com/eu/habbo/habbohotel/guilds/GuildManager.java index 71a017aa..2f84660d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/guilds/GuildManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/guilds/GuildManager.java @@ -13,6 +13,8 @@ import gnu.trove.map.TIntObjectMap; import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.*; import java.util.*; @@ -20,6 +22,8 @@ import java.util.stream.Collectors; public class GuildManager { + private static final Logger LOGGER = LoggerFactory.getLogger(GuildManager.class); + private final THashMap> guildParts; private final TIntObjectMap guilds; @@ -34,7 +38,7 @@ public class GuildManager { this.loadGuildParts(); this.loadGuildViews(); - Emulator.getLogging().logStart("Guild Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); + LOGGER.info("Guild Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); } @@ -52,7 +56,7 @@ public class GuildManager { this.guildParts.get(GuildPartType.valueOf(set.getString("type").toUpperCase())).put(set.getInt("id"), new GuildPart(set)); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -66,7 +70,7 @@ public class GuildManager { this.views.add(new ForumView(set)); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -107,7 +111,7 @@ public class GuildManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } habbo.getHabboStats().addGuild(guild.getId()); @@ -155,7 +159,7 @@ public class GuildManager { room.setGuild(0); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -276,7 +280,7 @@ public class GuildManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -288,7 +292,7 @@ public class GuildManager { statement.setInt(3, guild.getId()); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -303,7 +307,7 @@ public class GuildManager { statement.setInt(3, guild.getId()); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -325,7 +329,7 @@ public class GuildManager { statement.setInt(2, guild.getId()); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -352,7 +356,7 @@ public class GuildManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return member; @@ -375,7 +379,7 @@ public class GuildManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return guildMembers; @@ -397,7 +401,7 @@ public class GuildManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return guildMembers; @@ -416,7 +420,7 @@ public class GuildManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return 0; @@ -434,7 +438,7 @@ public class GuildManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return guildAdmins; @@ -466,7 +470,7 @@ public class GuildManager { if (g != null) g.loadMemberCount(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -494,7 +498,7 @@ public class GuildManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return guilds; @@ -514,7 +518,7 @@ public class GuildManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return guilds; @@ -593,7 +597,7 @@ public class GuildManager { statement.setInt(2, furni.getId()); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -608,7 +612,7 @@ public class GuildManager { guildIterator.remove(); } - Emulator.getLogging().logShutdownLine("Guild Manager -> Disposed!"); + LOGGER.info("Guild Manager -> Disposed!"); } public boolean hasViewedForum(int userId, int guildId) { @@ -628,7 +632,7 @@ public class GuildManager { statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java index 5d432c79..a1c7227a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java +++ b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java @@ -108,7 +108,7 @@ public class ForumThread implements Runnable, ISerialize { Emulator.getPluginManager().fireEvent(new GuildForumThreadCreated(createdThread)); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return createdThread; @@ -156,7 +156,7 @@ public class ForumThread implements Runnable, ISerialize { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return threads; @@ -195,7 +195,7 @@ public class ForumThread implements Runnable, ISerialize { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return foundThread; @@ -337,7 +337,7 @@ public class ForumThread implements Runnable, ISerialize { addComment(comment); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } @@ -461,7 +461,7 @@ public class ForumThread implements Runnable, ISerialize { this.needsUpdate = false; } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThreadComment.java b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThreadComment.java index 01f6792c..9ff93d55 100644 --- a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThreadComment.java +++ b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThreadComment.java @@ -64,7 +64,7 @@ public class ForumThreadComment implements Runnable, ISerialize { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return foundComment; @@ -103,7 +103,7 @@ public class ForumThreadComment implements Runnable, ISerialize { Emulator.getPluginManager().fireEvent(new GuildForumThreadCommentCreated(createdComment)); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return createdComment; @@ -200,7 +200,7 @@ public class ForumThreadComment implements Runnable, ISerialize { this.needsUpdate = false; } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFame.java b/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFame.java index 1593623b..ef7f1986 100644 --- a/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFame.java +++ b/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFame.java @@ -32,7 +32,7 @@ public class HallOfFame { this.winners.put(winner.getId(), winner); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/hotelview/HotelViewManager.java b/src/main/java/com/eu/habbo/habbohotel/hotelview/HotelViewManager.java index b097edcd..81048f3b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/hotelview/HotelViewManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/hotelview/HotelViewManager.java @@ -1,8 +1,12 @@ package com.eu.habbo.habbohotel.hotelview; -import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class HotelViewManager { + + private static final Logger LOGGER = LoggerFactory.getLogger(HotelViewManager.class); + private final HallOfFame hallOfFame; private final NewsList newsList; @@ -11,7 +15,7 @@ public class HotelViewManager { this.hallOfFame = new HallOfFame(); this.newsList = new NewsList(); - Emulator.getLogging().logStart("Hotelview Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); + LOGGER.info("Hotelview Manager -> Loaded! ({} MS)", System.currentTimeMillis() - millis); } public HallOfFame getHallOfFame() { @@ -23,6 +27,7 @@ public class HotelViewManager { } public void dispose() { - Emulator.getLogging().logShutdownLine("HotelView Manager -> Disposed!"); + LOGGER.info("HotelView Manager -> Disposed!"); } + } diff --git a/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsList.java b/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsList.java index 8be6fd7c..623cb2c5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsList.java +++ b/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsList.java @@ -25,7 +25,7 @@ public class NewsList { this.newsWidgets.add(new NewsWidget(set)); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/CrackableReward.java b/src/main/java/com/eu/habbo/habbohotel/items/CrackableReward.java index 87e1caf6..727fb47a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/CrackableReward.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/CrackableReward.java @@ -52,7 +52,7 @@ public class CrackableReward { this.prizes.put(itemId, new AbstractMap.SimpleEntry<>(this.totalChance, this.totalChance + chance)); this.totalChance += chance; } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java b/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java index 7eff22c4..7fdc0202 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java @@ -60,12 +60,17 @@ import gnu.trove.map.TIntObjectMap; import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.lang.reflect.Constructor; import java.sql.*; import java.util.*; public class ItemManager { + + private static final Logger LOGGER = LoggerFactory.getLogger(ItemManager.class); + //Configuration. Loaded from database & updated accordingly. public static boolean RECYCLER_ENABLED = true; @@ -100,7 +105,7 @@ public class ItemManager { this.highscoreManager.load(); this.loadNewUserGifts(); - Emulator.getLogging().logStart("Item Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); + LOGGER.info("Item Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); } protected void loadItemInteractions() { @@ -354,7 +359,7 @@ public class ItemManager { return interaction; } - Emulator.getLogging().logDebugLine("Can't find interaction class:" + type.getName()); + LOGGER.debug("Can't find interaction class: {}", type.getName()); return this.getItemInteraction(InteractionDefault.class); } @@ -384,12 +389,12 @@ public class ItemManager { else this.items.get(id).update(set); } catch (Exception e) { - Emulator.getLogging().logErrorLine("Failed to load Item (" + set.getInt("id") + ")"); - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Failed to load Item ({})", set.getInt("id")); + LOGGER.error("Caught exception", e); } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -402,16 +407,16 @@ public class ItemManager { try { reward = new CrackableReward(set); } catch (Exception e) { - Emulator.getLogging().logErrorLine("Failed to load items_crackable item_id = " + set.getInt("item_id")); - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Failed to load items_crackable item_id = {}", set.getInt("item_id")); + LOGGER.error("Caught exception", e); continue; } this.crackableRewards.put(set.getInt("item_id"), reward); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } } @@ -445,7 +450,7 @@ public class ItemManager { this.soundTracks.put(set.getString("code"), new SoundTrack(set)); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -478,16 +483,16 @@ public class ItemManager { try { return itemClass.getDeclaredConstructor(int.class, int.class, Item.class, String.class, int.class, int.class).newInstance(set.getInt(1), habboId, item, extraData, limitedStack, limitedSells); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); return new InteractionDefault(set.getInt(1), habboId, item, extraData, limitedStack, limitedSells); } } } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } return null; } @@ -502,7 +507,7 @@ public class ItemManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -527,7 +532,7 @@ public class ItemManager { statement.setInt(1, item.getId()); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -554,7 +559,7 @@ public class ItemManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return item; @@ -594,9 +599,9 @@ public class ItemManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } return item; @@ -608,7 +613,7 @@ public class ItemManager { statement.setInt(2, itemTwoId); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -618,7 +623,7 @@ public class ItemManager { statement.setInt(2, hopper.getBaseItem().getId()); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -633,7 +638,7 @@ public class ItemManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return a; @@ -649,9 +654,9 @@ public class ItemManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } return item; @@ -672,7 +677,7 @@ public class ItemManager { return (HabboItem) c.newInstance(set, baseItem); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } } @@ -695,7 +700,7 @@ public class ItemManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -703,7 +708,7 @@ public class ItemManager { return null; if (extraData.length() > 1000) { - Emulator.getLogging().logErrorLine("Extradata exceeds maximum length of 1000 characters:" + extraData); + LOGGER.error("Extradata exceeds maximum length of 1000 characters: {}", extraData); extraData = extraData.substring(0, 1000); } @@ -720,7 +725,7 @@ public class ItemManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } if (gift != null) { @@ -774,7 +779,7 @@ public class ItemManager { this.items.clear(); this.highscoreManager.dispose(); - Emulator.getLogging().logShutdownLine("Item Manager -> Disposed!"); + LOGGER.info("Item Manager -> Disposed!"); } public List getInteractionList() { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/YoutubeManager.java b/src/main/java/com/eu/habbo/habbohotel/items/YoutubeManager.java index 4e9ce06d..e3b680cd 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/YoutubeManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/YoutubeManager.java @@ -80,7 +80,7 @@ public class YoutubeManager { Emulator.getThreading().run(() -> { ExecutorService youtubeDataLoaderPool = Executors.newFixedThreadPool(10); - Emulator.getLogging().logStart("YouTube Manager -> Loading..."); + logger.info("YouTube Manager -> Loading..."); try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM youtube_playlists")) { try (ResultSet set = statement.executeQuery()) { @@ -103,7 +103,7 @@ public class YoutubeManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } youtubeDataLoaderPool.shutdown(); @@ -113,7 +113,7 @@ public class YoutubeManager { e.printStackTrace(); } - Emulator.getLogging().logStart("YouTube Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); + logger.info("YouTube Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); }); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorPlate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorPlate.java index a16115cb..cd089ec3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorPlate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorPlate.java @@ -41,7 +41,7 @@ public class InteractionColorPlate extends InteractionDefault { try { state = Integer.valueOf(this.getExtradata()); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } state += amount; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRentableSpace.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRentableSpace.java index 4635c63f..d1ee8065 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRentableSpace.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRentableSpace.java @@ -50,7 +50,7 @@ public class InteractionRentableSpace extends HabboItem { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } else { @@ -180,7 +180,7 @@ public class InteractionRentableSpace extends HabboItem { statement.setInt(1, zero); statement.setInt(2, zero); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java index cede4c8d..e3c9c702 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java @@ -71,7 +71,7 @@ public abstract class InteractionWired extends HabboItem { statement.setInt(2, this.getId()); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } super.run(); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredHighscore.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredHighscore.java index 054ce7d8..88a196ac 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredHighscore.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredHighscore.java @@ -33,7 +33,7 @@ public class InteractionWiredHighscore extends HabboItem { this.scoreType = WiredHighscoreScoreType.valueOf(name); this.clearType = WiredHighscoreClearType.values()[ctype]; } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } this.reloadData(); @@ -51,7 +51,7 @@ public class InteractionWiredHighscore extends HabboItem { this.scoreType = WiredHighscoreScoreType.valueOf(name); this.clearType = WiredHighscoreClearType.values()[ctype]; } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } this.reloadData(); @@ -83,7 +83,7 @@ public class InteractionWiredHighscore extends HabboItem { this.setExtradata(Math.abs(state - 1) + ""); room.updateItem(this); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java index 6c0ff65e..3b064dfa 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java @@ -89,7 +89,7 @@ public class InteractionGameTimer extends HabboItem implements Runnable { } }).toArray(); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } @@ -117,7 +117,7 @@ public class InteractionGameTimer extends HabboItem implements Runnable { room.addGame(game); game.initialise(); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java index ecaf88c1..079ac0e0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java @@ -71,7 +71,7 @@ public class WiredConditionHabboHasHandItem extends InteractionWiredCondition { try { this.handItem = Integer.valueOf(set.getString("wired_data")); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java index b318a033..b379fe9c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java @@ -189,7 +189,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect { } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java index 0e3232ed..2605a4f8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java @@ -136,7 +136,7 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect { item.onClick(habbo != null && !(item instanceof InteractionGameTimer) ? habbo.getClient() : null, room, new Object[]{state, this.getType()}); } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java index c570f378..0caf0ef3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java @@ -120,7 +120,7 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect { item.setExtradata(Emulator.getRandom().nextInt(item.getBaseItem().getStateCount() + 1) + ""); room.updateItem(item); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } return true; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java index a40dd95a..56b98ebd 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java @@ -157,7 +157,7 @@ public class WiredTriggerBotReachedFurni extends InteractionWiredTrigger { if (item != null) this.items.add(item); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/messenger/Message.java b/src/main/java/com/eu/habbo/habbohotel/messenger/Message.java index 8953c439..5949ae4b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/messenger/Message.java +++ b/src/main/java/com/eu/habbo/habbohotel/messenger/Message.java @@ -31,7 +31,7 @@ public class Message implements Runnable { statement.setInt(4, this.timestamp); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java b/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java index 06d4e37d..250a7a52 100644 --- a/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java +++ b/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java @@ -41,7 +41,7 @@ public class Messenger { statement.setInt(4, userOne); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -55,7 +55,7 @@ public class Messenger { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return users; } @@ -85,7 +85,7 @@ public class Messenger { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return false; @@ -102,7 +102,7 @@ public class Messenger { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return false; @@ -114,7 +114,7 @@ public class Messenger { statement.setInt(2, userFrom); statement.executeUpdate(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -133,7 +133,7 @@ public class Messenger { count = set.getInt("count"); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return count; @@ -157,7 +157,7 @@ public class Messenger { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return map; } @@ -213,7 +213,7 @@ public class Messenger { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -237,7 +237,7 @@ public class Messenger { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return buddy; @@ -252,7 +252,7 @@ public class Messenger { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -311,7 +311,7 @@ public class Messenger { statement.setInt(1, userTo); statement.executeUpdate(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -323,7 +323,7 @@ public class Messenger { statement.setInt(3, userFrom); return statement.executeUpdate(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return 0; @@ -345,7 +345,7 @@ public class Messenger { statement.setInt(3, Emulator.getIntUnixTimestamp()); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } Habbo habboTo = Emulator.getGameServer().getGameClientManager().getHabbo(userTo); diff --git a/src/main/java/com/eu/habbo/habbohotel/messenger/MessengerBuddy.java b/src/main/java/com/eu/habbo/habbohotel/messenger/MessengerBuddy.java index 62d7a862..2ce143bf 100644 --- a/src/main/java/com/eu/habbo/habbohotel/messenger/MessengerBuddy.java +++ b/src/main/java/com/eu/habbo/habbohotel/messenger/MessengerBuddy.java @@ -44,7 +44,7 @@ public class MessengerBuddy implements Runnable, ISerialize { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -56,7 +56,7 @@ public class MessengerBuddy implements Runnable, ISerialize { this.relation = 0; this.userOne = 0; } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -149,7 +149,7 @@ public class MessengerBuddy implements Runnable, ISerialize { statement.setInt(3, this.id); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolBan.java b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolBan.java index 1fc72341..e79c9ad3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolBan.java +++ b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolBan.java @@ -63,7 +63,7 @@ public class ModToolBan implements Runnable { statement.setInt(9, this.cfhTopic); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java index 8a10edbb..de887280 100644 --- a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java @@ -41,7 +41,7 @@ public class ModToolManager { this.tickets = new THashMap<>(); this.cfhCategories = new TIntObjectHashMap<>(); this.loadModTool(); - Emulator.getLogging().logStart("ModTool Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); + logger.info("ModTool Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); } public static void requestUserInfo(GameClient client, ClientMessage packet) { @@ -58,9 +58,9 @@ public class ModToolManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } @@ -78,7 +78,7 @@ public class ModToolManager { this.loadTickets(connection); this.loadCfhCategories(connection); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -97,7 +97,7 @@ public class ModToolManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -108,7 +108,7 @@ public class ModToolManager { this.presets.get(set.getString("type")).add(set.getString("preset")); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } @@ -120,7 +120,7 @@ public class ModToolManager { this.tickets.put(set.getInt("id"), new ModToolIssue(set)); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } @@ -146,7 +146,7 @@ public class ModToolManager { this.cfhCategories.get(set.getInt("support_cfh_category_id")).addTopic(new CfhTopic(set, this.getIssuePreset(set.getInt("default_sanction")))); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -198,7 +198,7 @@ public class ModToolManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return chatlogs; @@ -215,7 +215,7 @@ public class ModToolManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return chatlogs; @@ -235,7 +235,7 @@ public class ModToolManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return chatLogs; @@ -272,7 +272,7 @@ public class ModToolManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return chatlogs; @@ -290,7 +290,7 @@ public class ModToolManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return roomVisits; @@ -348,7 +348,7 @@ public class ModToolManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return roomVisits; @@ -378,7 +378,7 @@ public class ModToolManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return null; @@ -495,7 +495,7 @@ public class ModToolManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return ban; @@ -519,7 +519,7 @@ public class ModToolManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return banned; @@ -543,7 +543,7 @@ public class ModToolManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return false; @@ -557,7 +557,7 @@ public class ModToolManager { statement.execute(); return statement.getUpdateCount() > 0; } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return false; @@ -662,7 +662,7 @@ public class ModToolManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return total; diff --git a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolSanctions.java b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolSanctions.java index ea72d8bb..e909120a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolSanctions.java +++ b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolSanctions.java @@ -22,7 +22,7 @@ public class ModToolSanctions { this.sanctionHashmap = new THashMap<>(); this.sanctionLevelsHashmap = new THashMap<>(); this.loadModSanctions(); - Emulator.getLogging().logStart("Sanctions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); + logger.info("Sanctions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); } @@ -41,7 +41,7 @@ public class ModToolSanctions { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -68,7 +68,7 @@ public class ModToolSanctions { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return this.sanctionHashmap; @@ -87,7 +87,7 @@ public class ModToolSanctions { statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -98,7 +98,7 @@ public class ModToolSanctions { statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -109,7 +109,7 @@ public class ModToolSanctions { statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -120,7 +120,7 @@ public class ModToolSanctions { statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java b/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java index 123a47c4..f13e95fc 100644 --- a/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java +++ b/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java @@ -29,7 +29,7 @@ public class WordFilter { public WordFilter() { long start = System.currentTimeMillis(); this.reload(); - Emulator.getLogging().logStart("WordFilter -> Loaded! (" + (System.currentTimeMillis() - start) + " MS)"); + logger.info("WordFilter -> Loaded! (" + (System.currentTimeMillis() - start) + " MS)"); } private static String stripDiacritics(String str) { @@ -54,7 +54,7 @@ public class WordFilter { try { word = new WordFilterWord(set); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); continue; } @@ -67,7 +67,7 @@ public class WordFilter { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorManager.java b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorManager.java index e4fea5b7..929456b9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorManager.java @@ -4,6 +4,8 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.Habbo; import gnu.trove.map.hash.THashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.lang.reflect.Method; import java.sql.Connection; @@ -18,9 +20,9 @@ import java.util.concurrent.ConcurrentHashMap; public class NavigatorManager { + private static final Logger LOGGER = LoggerFactory.getLogger(NavigatorManager.class); + public static int MAXIMUM_RESULTS_PER_PAGE = 10; - - public static boolean CATEGORY_SORT_USING_ORDER_NUM = false; public final THashMap publicCategories = new THashMap<>(); @@ -36,7 +38,7 @@ public class NavigatorManager { this.filters.put(NavigatorUserFilter.name, new NavigatorUserFilter()); this.filters.put(NavigatorFavoriteFilter.name, new NavigatorFavoriteFilter()); - Emulator.getLogging().logStart("Navigator Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); + LOGGER.info("Navigator Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); } public void loadNavigator() { @@ -49,7 +51,7 @@ public class NavigatorManager { this.publicCategories.put(set.getInt("id"), new NavigatorPublicCategory(set)); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } try (Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM navigator_publics WHERE visible = '1'")) { @@ -62,12 +64,12 @@ public class NavigatorManager { if (room != null) { category.addRoom(room); } else { - Emulator.getLogging().logErrorLine("Public room (ID: " + set.getInt("room_id") + " defined in navigator_publics does not exist!"); + LOGGER.error("Public room (ID: {} defined in navigator_publics does not exist!", set.getInt("room_id")); } } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -83,7 +85,7 @@ public class NavigatorManager { field = clazz.getDeclaredMethod(s); clazz = field.getReturnType(); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); break; } } @@ -91,7 +93,7 @@ public class NavigatorManager { try { field = clazz.getDeclaredMethod(set.getString("field")); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); continue; } } @@ -101,11 +103,11 @@ public class NavigatorManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } List staffPromotedRooms = Emulator.getGameEnvironment().getRoomManager().getRoomsStaffPromoted(); diff --git a/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java b/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java index cfd1620e..7051d864 100644 --- a/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java @@ -25,7 +25,7 @@ public class PermissionsManager { this.reload(); - Emulator.getLogging().logStart("Permissions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); + logger.info("Permissions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); } public void reload() { @@ -58,7 +58,7 @@ public class PermissionsManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -71,7 +71,7 @@ public class PermissionsManager { this.enables.put(set.getInt("effect_id"), set.getInt("min_rank")); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/GnomePet.java b/src/main/java/com/eu/habbo/habbohotel/pets/GnomePet.java index be2a9e63..de49ac85 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/GnomePet.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/GnomePet.java @@ -47,7 +47,7 @@ public class GnomePet extends Pet implements IPetLook { statement.setInt(2, this.id); statement.executeUpdate(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/HorsePet.java b/src/main/java/com/eu/habbo/habbohotel/pets/HorsePet.java index 46704168..c4cbc233 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/HorsePet.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/HorsePet.java @@ -40,7 +40,7 @@ public class HorsePet extends RideablePet { statement.setInt(6, super.getId()); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } super.run(); diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java b/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java index 88b98991..3f242328 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java @@ -138,7 +138,7 @@ public class MonsterplantPet extends Pet implements IPetLook { statement.setInt(13, this.id); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/Pet.java b/src/main/java/com/eu/habbo/habbohotel/pets/Pet.java index 965584c4..143f7962 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/Pet.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/Pet.java @@ -205,7 +205,7 @@ public class Pet implements ISerialize, Runnable { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } this.needsUpdate = false; diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java b/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java index 981dfffd..dce3d5f4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java @@ -80,7 +80,7 @@ public class PetManager { reloadPetData(); - Emulator.getLogging().logStart("Pet Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); + logger.info("Pet Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); } public static int getLevel(int experience) { @@ -151,7 +151,7 @@ public class PetManager { this.loadPetCommands(connection); this.loadPetBreeding(connection); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); Emulator.getLogging().logErrorLine("Pet Manager -> Failed to load!"); } } @@ -167,7 +167,7 @@ public class PetManager { this.petRaces.get(set.getInt("race")).add(new PetRace(set)); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -177,7 +177,7 @@ public class PetManager { this.petData.put(set.getInt("pet_type"), new PetData(set)); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } this.loadPetItems(connection); @@ -217,7 +217,7 @@ public class PetManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -244,7 +244,7 @@ public class PetManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -255,7 +255,7 @@ public class PetManager { commandsList.put(set.getInt("command_id"), new PetCommand(set, this.petActions.get(set.getInt("command_id")))); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } try (Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM pet_commands ORDER BY pet_id ASC")) { @@ -267,7 +267,7 @@ public class PetManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -277,7 +277,7 @@ public class PetManager { this.breedingPetType.put(set.getInt("pet_id"), set.getInt("offspring_id")); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } try (Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM pet_breeding_races")) { @@ -294,7 +294,7 @@ public class PetManager { this.breedingReward.get(reward.petType).get(reward.rarityLevel).add(reward); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -308,7 +308,7 @@ public class PetManager { int petId = Integer.valueOf(petName.split("t")[1]); return this.petRaces.get(petId); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } return null; @@ -364,7 +364,7 @@ public class PetManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } @@ -511,7 +511,7 @@ public class PetManager { statement.setInt(1, pet.getId()); return statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return false; diff --git a/src/main/java/com/eu/habbo/habbohotel/polls/PollManager.java b/src/main/java/com/eu/habbo/habbohotel/polls/PollManager.java index e7edc7ae..2841e741 100644 --- a/src/main/java/com/eu/habbo/habbohotel/polls/PollManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/polls/PollManager.java @@ -23,7 +23,7 @@ public class PollManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return false; } @@ -63,7 +63,7 @@ public class PollManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/CustomRoomLayout.java b/src/main/java/com/eu/habbo/habbohotel/rooms/CustomRoomLayout.java index 23db2026..4a30e521 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/CustomRoomLayout.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/CustomRoomLayout.java @@ -30,7 +30,7 @@ public class CustomRoomLayout extends RoomLayout implements Runnable { statement.setInt(5, this.roomId); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index c8de883e..a5d3975c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -265,7 +265,7 @@ public class Room implements Comparable, ISerialize, Runnable { this.loadBans(connection); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } this.tradeMode = set.getInt("trade_mode"); @@ -313,49 +313,49 @@ public class Room implements Comparable, ISerialize, Runnable { try { this.loadLayout(); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } try { this.loadRights(connection); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } try { this.loadItems(connection); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } try { this.loadHeightmap(); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } try { this.loadBots(connection); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } try { this.loadPets(connection); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } try { this.loadWordFilter(connection); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } try { this.loadWiredData(connection); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } this.idleCycles = 0; @@ -363,7 +363,7 @@ public class Room implements Comparable, ISerialize, Runnable { this.roomCycleTask = Emulator.getThreading().getService().scheduleAtFixedRate(this, 500, 500, TimeUnit.MILLISECONDS); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } this.traxManager = new TraxManager(this); @@ -416,7 +416,7 @@ public class Room implements Comparable, ISerialize, Runnable { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } if (this.itemCount() > Room.MAXIMUM_FURNI) { @@ -438,14 +438,14 @@ public class Room implements Comparable, ISerialize, Runnable { ((InteractionWired) item).loadWiredData(set, this); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } @@ -481,7 +481,7 @@ public class Room implements Comparable, ISerialize, Runnable { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -511,12 +511,12 @@ public class Room implements Comparable, ISerialize, Runnable { this.getFurniOwnerNames().put(pet.getUserId(), set.getString("pet_owner_name")); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -531,7 +531,7 @@ public class Room implements Comparable, ISerialize, Runnable { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -921,7 +921,7 @@ public class Room implements Comparable, ISerialize, Runnable { botIterator.value().needsUpdate(true); Emulator.getThreading().run(botIterator.value()); } catch (NoSuchElementException e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); break; } } @@ -929,7 +929,7 @@ public class Room implements Comparable, ISerialize, Runnable { this.currentBots.clear(); this.currentPets.clear(); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } @@ -941,7 +941,7 @@ public class Room implements Comparable, ISerialize, Runnable { this.preLoaded = true; this.layout = null; } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } @@ -1033,7 +1033,7 @@ public class Room implements Comparable, ISerialize, Runnable { Emulator.getThreading().run( Room.this::cycle); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } } @@ -1096,7 +1096,7 @@ public class Room implements Comparable, ISerialize, Runnable { statement.executeUpdate(); this.needsUpdate = false; } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } @@ -1107,7 +1107,7 @@ public class Room implements Comparable, ISerialize, Runnable { statement.setInt(2, this.id); statement.executeUpdate(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -1250,7 +1250,7 @@ public class Room implements Comparable, ISerialize, Runnable { } catch (NoSuchElementException e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); break; } } @@ -1263,7 +1263,7 @@ public class Room implements Comparable, ISerialize, Runnable { try { petIterator.advance(); } catch (NoSuchElementException e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); break; } @@ -1458,7 +1458,7 @@ public class Room implements Comparable, ISerialize, Runnable { try { item.onWalkOn(unit, room, null); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } }, this.getRollerSpeed() == 0 ? 250 : InteractionRoller.DELAY); @@ -2010,7 +2010,7 @@ public class Room implements Comparable, ISerialize, Runnable { pet.needsUpdate = true; pet.run(); } catch (NoSuchElementException e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); break; } } @@ -2123,7 +2123,7 @@ public class Room implements Comparable, ISerialize, Runnable { statement.setInt(10, this.promotion.getCategory()); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } this.needsUpdate = true; @@ -2215,7 +2215,7 @@ public class Room implements Comparable, ISerialize, Runnable { return this.habboQueue.remove(habbo.getHabboInfo().getId()) != null; } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } return true; @@ -2613,7 +2613,7 @@ public class Room implements Comparable, ISerialize, Runnable { try { item.onWalkOff(habbo.getRoomUnit(), this, new Object[]{}); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } } @@ -2674,7 +2674,7 @@ public class Room implements Comparable, ISerialize, Runnable { try { iterator.advance(); } catch (NoSuchElementException e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); break; } @@ -2694,7 +2694,7 @@ public class Room implements Comparable, ISerialize, Runnable { try { iterator.advance(); } catch (NoSuchElementException e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); break; } @@ -2716,7 +2716,7 @@ public class Room implements Comparable, ISerialize, Runnable { try { iterator.advance(); } catch (NoSuchElementException e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); break; } @@ -2759,7 +2759,7 @@ public class Room implements Comparable, ISerialize, Runnable { try { petIterator.advance(); } catch (NoSuchElementException e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); break; } @@ -2838,7 +2838,7 @@ public class Room implements Comparable, ISerialize, Runnable { try { petIterator.advance(); } catch (NoSuchElementException e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); break; } @@ -2993,7 +2993,7 @@ public class Room implements Comparable, ISerialize, Runnable { try { doorTileTopItem.onWalkOn(habbo.getRoomUnit(), this, new Object[]{}); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } } @@ -3180,7 +3180,7 @@ public class Room implements Comparable, ISerialize, Runnable { bot.onUserSay(roomChatMessage); } catch (NoSuchElementException e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); break; } } @@ -3204,7 +3204,7 @@ public class Room implements Comparable, ISerialize, Runnable { item.onClick(habbo.getClient(), this, new Object[0]); break; } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } } @@ -3757,7 +3757,7 @@ public class Room implements Comparable, ISerialize, Runnable { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -3776,7 +3776,7 @@ public class Room implements Comparable, ISerialize, Runnable { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -3820,7 +3820,7 @@ public class Room implements Comparable, ISerialize, Runnable { statement.setInt(2, userId); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -3857,7 +3857,7 @@ public class Room implements Comparable, ISerialize, Runnable { statement.setInt(2, userId); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -3875,7 +3875,7 @@ public class Room implements Comparable, ISerialize, Runnable { statement.setInt(1, this.id); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } this.refreshRightsInRoom(); @@ -3942,7 +3942,7 @@ public class Room implements Comparable, ISerialize, Runnable { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -4246,7 +4246,7 @@ public class Room implements Comparable, ISerialize, Runnable { statement.setString(2, word); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); return; } @@ -4263,7 +4263,7 @@ public class Room implements Comparable, ISerialize, Runnable { statement.setString(2, word); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomBan.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomBan.java index 806b5c23..d22adb0d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomBan.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomBan.java @@ -42,7 +42,7 @@ public class RoomBan { statement.setInt(3, this.endTimestamp); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -53,7 +53,7 @@ public class RoomBan { statement.setInt(2, this.userId); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java index 8322d624..0063a0d5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java @@ -1,21 +1,26 @@ package com.eu.habbo.habbohotel.rooms; import com.eu.habbo.Emulator; -import com.eu.habbo.core.Loggable; +import com.eu.habbo.core.DatabaseLoggable; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.ISerialize; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.incoming.Incoming; import com.eu.habbo.messages.incoming.MessageHandler; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.Arrays; import java.util.List; -public class RoomChatMessage implements Runnable, ISerialize, Loggable { +public class RoomChatMessage implements Runnable, ISerialize, DatabaseLoggable { + + private static final Logger LOGGER = LoggerFactory.getLogger(RoomChatMessage.class); + private static final String QUERY = "INSERT INTO chatlogs_room (user_from_id, user_to_id, message, timestamp, room_id) VALUES (?, ?, ?, ?, ?)"; + private static final List chatColors = Arrays.asList("@red@", "@cyan@", "@blue@", "@green@", "@purple@"); - public static String insertQuery = "INSERT INTO chatlogs_room (user_from_id, user_to_id, message, timestamp, room_id) VALUES (?, ?, ?, ?, ?)"; public static int MAXIMUM_LENGTH = 100; //Configuration. Loaded from database & updated accordingly. public static boolean SAVE_ROOM_CHATS = false; @@ -130,10 +135,11 @@ public class RoomChatMessage implements Runnable, ISerialize, Loggable { try { this.message = this.message.substring(0, RoomChatMessage.MAXIMUM_LENGTH - 1); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } } - Emulator.getLogging().addChatLog(this); + + Emulator.getDatabaseLogger().store(this); } public String getMessage() { @@ -191,7 +197,7 @@ public class RoomChatMessage implements Runnable, ISerialize, Loggable { message.appendInt(0); message.appendInt(this.getMessage().length()); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } } @@ -218,6 +224,11 @@ public class RoomChatMessage implements Runnable, ISerialize, Loggable { } } + @Override + public String getQuery() { + return QUERY; + } + @Override public void log(PreparedStatement statement) throws SQLException { statement.setInt(1, this.habbo.getHabboInfo().getId()); diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java index 2ffe4bbd..7eb6dbb0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java @@ -42,7 +42,7 @@ public class RoomLayout { this.parse(); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java index 2faa824c..75249798 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java @@ -41,7 +41,6 @@ import com.eu.habbo.messages.outgoing.rooms.pets.RoomPetComposer; import com.eu.habbo.messages.outgoing.rooms.promotions.RoomPromotionMessageComposer; import com.eu.habbo.messages.outgoing.rooms.users.*; import com.eu.habbo.messages.outgoing.users.MutedWhisperComposer; -import com.eu.habbo.plugin.Event; import com.eu.habbo.plugin.events.navigator.NavigatorRoomCreatedEvent; import com.eu.habbo.plugin.events.rooms.RoomUncachedEvent; import com.eu.habbo.plugin.events.rooms.UserVoteRoomEvent; @@ -53,13 +52,17 @@ import gnu.trove.map.hash.THashMap; import gnu.trove.procedure.TIntProcedure; import gnu.trove.procedure.TObjectProcedure; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.*; import java.util.*; import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Collectors; public class RoomManager { + + private static final Logger LOGGER = LoggerFactory.getLogger(RoomManager.class); + private static final int page = 0; //Configuration. Loaded from database & updated accordingly. public static int MAXIMUM_ROOMS_USER = 25; @@ -89,7 +92,7 @@ public class RoomManager { registerGameType(IceTagGame.class); registerGameType(RollerskateGame.class); - Emulator.getLogging().logStart("Room Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); + LOGGER.info("Room Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); } public void loadRoomModels() { @@ -99,7 +102,7 @@ public class RoomManager { this.mapNames.add(set.getString("name")); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -113,7 +116,7 @@ public class RoomManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return layout; @@ -127,7 +130,7 @@ public class RoomManager { this.roomCategories.put(set.getInt("id"), new RoomCategory(set)); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -143,7 +146,7 @@ public class RoomManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -169,7 +172,7 @@ public class RoomManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return rooms; @@ -276,7 +279,7 @@ public class RoomManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return rooms; @@ -317,7 +320,7 @@ public class RoomManager { this.activeRooms.put(room.getId(), room); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return room; @@ -341,7 +344,7 @@ public class RoomManager { room = this.loadRoom(set.getInt(1)); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return room; @@ -366,7 +369,7 @@ public class RoomManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -416,7 +419,7 @@ public class RoomManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return layout; @@ -450,7 +453,7 @@ public class RoomManager { statement.setInt(2, room.getId()); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } } @@ -910,7 +913,7 @@ public class RoomManager { statement.setInt(3, (int) (habbo.getHabboStats().roomEnterTimestamp)); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -961,7 +964,7 @@ public class RoomManager { statement.setInt(3, room.getId()); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } } @@ -1090,7 +1093,7 @@ public class RoomManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return rooms; @@ -1150,7 +1153,7 @@ public class RoomManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return rooms; @@ -1217,7 +1220,7 @@ public class RoomManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } Collections.sort(rooms); @@ -1263,7 +1266,7 @@ public class RoomManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } Collections.sort(rooms); @@ -1286,7 +1289,7 @@ public class RoomManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return rooms; @@ -1328,7 +1331,7 @@ public class RoomManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return rooms; @@ -1350,7 +1353,7 @@ public class RoomManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return rooms; @@ -1454,7 +1457,7 @@ public class RoomManager { this.activeRooms.clear(); - Emulator.getLogging().logShutdownLine("Room Manager -> Disposed!"); + LOGGER.info("Room Manager -> Disposed!"); } public CustomRoomLayout insertCustomLayout(Room room, String map, int doorX, int doorY, int doorDirection) { @@ -1471,7 +1474,7 @@ public class RoomManager { statement.setString(10, map); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return this.loadCustomLayout(room); diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomPromotion.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomPromotion.java index fa43278b..853a452d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomPromotion.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomPromotion.java @@ -43,7 +43,7 @@ public class RoomPromotion { statement.setInt(4, this.room.getId()); statement.executeUpdate(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } this.needsUpdate = false; diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java index eb6ac5cd..86fd5922 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java @@ -206,7 +206,7 @@ public class RoomTrade { statement.executeBatch(); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } THashSet itemsUserOne = new THashSet<>(userOne.getItems()); diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java index 0c5582ee..07c2a093 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java @@ -361,7 +361,7 @@ public class RoomUnit { return false; } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); return false; } } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/TraxManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/TraxManager.java index 3f478feb..a4656a57 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/TraxManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/TraxManager.java @@ -51,7 +51,7 @@ public class TraxManager implements Disposable { stmt.setInt(2, musicDisc.getId()); stmt.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); return; } } else { @@ -67,7 +67,7 @@ public class TraxManager implements Disposable { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -157,7 +157,7 @@ public class TraxManager implements Disposable { statement.setInt(2, musicDisc.getId()); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); return; } @@ -184,7 +184,7 @@ public class TraxManager implements Disposable { statement.setInt(2, itemId); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); return; } @@ -277,7 +277,7 @@ public class TraxManager implements Disposable { statement.setInt(1, this.room.getId()); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java b/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java index b3fb1399..120d59bf 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java @@ -148,7 +148,7 @@ public class Habbo implements Runnable { } } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } try { @@ -164,7 +164,7 @@ public class Habbo implements Runnable { this.habboStats.dispose(); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); return; } finally { Emulator.getGameEnvironment().getRoomManager().unloadRoomsForHabbo(this); diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboBadge.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboBadge.java index 197f535e..59afdfc3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboBadge.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboBadge.java @@ -77,7 +77,7 @@ public class HabboBadge implements Runnable { this.needsUpdate = false; } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java index 0632c0b8..a5a0768f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java @@ -79,7 +79,7 @@ public class HabboInfo implements Runnable { this.online = false; this.currentRoom = null; } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } this.loadCurrencies(); @@ -97,7 +97,7 @@ public class HabboInfo implements Runnable { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -113,14 +113,14 @@ public class HabboInfo implements Runnable { statement.setInt(4, b); statement.addBatch(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return true; } }); statement.executeBatch(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -135,7 +135,7 @@ public class HabboInfo implements Runnable { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -160,7 +160,7 @@ public class HabboInfo implements Runnable { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -171,7 +171,7 @@ public class HabboInfo implements Runnable { statement.setInt(1, search.getId()); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -494,7 +494,7 @@ public class HabboInfo implements Runnable { statement.setInt(13, this.id); statement.executeUpdate(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboInventory.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboInventory.java index 52db8cf6..340819e5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboInventory.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboInventory.java @@ -24,37 +24,37 @@ public class HabboInventory { try { this.badgesComponent = new BadgesComponent(this.habbo); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } try { this.botsComponent = new BotsComponent(this.habbo); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } try { this.effectsComponent = new EffectsComponent(this.habbo); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } try { this.itemsComponent = new ItemsComponent(this, this.habbo); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } try { this.petsComponent = new PetsComponent(this.habbo); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } try { this.wardrobeComponent = new WardrobeComponent(this.habbo); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } this.items = MarketPlace.getOwnOffers(this.habbo); diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java index f689c504..e5e05f68 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java @@ -107,7 +107,7 @@ public abstract class HabboItem implements Runnable, IEventTriggers { //serverMessage.appendString( ? "1.0" : ((this.getBaseItem().allowWalk() || this.getBaseItem().allowSit() && this.roomId != 0) ? Item.getCurrentHeight(this) : "")); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } @@ -264,7 +264,7 @@ public abstract class HabboItem implements Runnable, IEventTriggers { statement.setInt(10, this.id); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); Emulator.getLogging().logErrorLine("SQLException trying to save HabboItem: " + this.toString()); } @@ -272,7 +272,7 @@ public abstract class HabboItem implements Runnable, IEventTriggers { } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java index 27adcc59..8975b888 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java @@ -4,7 +4,6 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.modtool.ModToolBan; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.permissions.Rank; -import com.eu.habbo.habbohotel.users.inventory.EffectsComponent; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.catalog.*; import com.eu.habbo.messages.outgoing.catalog.marketplace.MarketplaceConfigComposer; @@ -14,6 +13,8 @@ import com.eu.habbo.messages.outgoing.users.UserPerksComposer; import com.eu.habbo.messages.outgoing.users.UserPermissionsComposer; import com.eu.habbo.plugin.events.users.UserRankChangedEvent; import com.eu.habbo.plugin.events.users.UserRegisteredEvent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -26,6 +27,9 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class HabboManager { + + private static final Logger LOGGER = LoggerFactory.getLogger(HabboManager.class); + //Configuration. Loaded from database & updated accordingly. public static String WELCOME_MESSAGE = ""; public static boolean NAMECHANGE_ENABLED = false; @@ -37,7 +41,7 @@ public class HabboManager { this.onlineHabbos = new ConcurrentHashMap<>(); - Emulator.getLogging().logStart("Habbo Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); + LOGGER.info("Habbo Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); } public static HabboInfo getOfflineHabboInfo(int id) { @@ -50,7 +54,7 @@ public class HabboManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return info; @@ -68,7 +72,7 @@ public class HabboManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return info; @@ -111,7 +115,7 @@ public class HabboManager { } statement.close(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } habbo = this.cloneCheck(userId); @@ -144,15 +148,15 @@ public class HabboManager { stmt.setInt(2, habbo.getHabboInfo().getId()); stmt.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } catch (Exception ex) { - Emulator.getLogging().logErrorLine(ex); + LOGGER.error("Caught exception", ex); } return habbo; @@ -193,7 +197,7 @@ public class HabboManager { // - Emulator.getLogging().logShutdownLine("Habbo Manager -> Disposed!"); + LOGGER.info("Habbo Manager -> Disposed!"); } public ArrayList getCloneAccounts(Habbo habbo, int limit) { @@ -211,7 +215,7 @@ public class HabboManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return habboInfo; @@ -229,7 +233,7 @@ public class HabboManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } return nameChanges; @@ -283,7 +287,7 @@ public class HabboManager { statement.setInt(2, userId); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } @@ -300,7 +304,7 @@ public class HabboManager { statement.setInt(2, userId); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboNavigatorWindowSettings.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboNavigatorWindowSettings.java index caaaf4b8..0b2051f3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboNavigatorWindowSettings.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboNavigatorWindowSettings.java @@ -53,7 +53,7 @@ public class HabboNavigatorWindowSettings { statement.setString(4, displayMode.name().toLowerCase()); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } this.displayModes.put(category, new HabboNavigatorPersonalDisplayMode(listMode, displayMode)); @@ -114,7 +114,7 @@ public class HabboNavigatorWindowSettings { statement.execute(); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java index 5e84e5cb..0069d965 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java @@ -228,7 +228,7 @@ public class HabboStats implements Runnable { statement.setInt(1, habboInfo.getId()); statement.executeUpdate(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return load(habboInfo); @@ -287,7 +287,7 @@ public class HabboStats implements Runnable { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return stats; @@ -365,7 +365,7 @@ public class HabboStats implements Runnable { this.navigatorWindowSettings.save(connection); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -479,7 +479,7 @@ public class HabboStats implements Runnable { statement.setInt(2, roomId); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } this.favoriteRooms.add(roomId); @@ -493,7 +493,7 @@ public class HabboStats implements Runnable { statement.setInt(2, roomId); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } @@ -519,7 +519,7 @@ public class HabboStats implements Runnable { statement.setInt(2, id); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } this.secretRecipes.add(id); @@ -605,7 +605,7 @@ public class HabboStats implements Runnable { statement.setInt(2, userId); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } @@ -620,7 +620,7 @@ public class HabboStats implements Runnable { statement.setInt(2, userId); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/cache/HabboOfferPurchase.java b/src/main/java/com/eu/habbo/habbohotel/users/cache/HabboOfferPurchase.java index 93b8e309..01307acf 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/cache/HabboOfferPurchase.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/cache/HabboOfferPurchase.java @@ -38,7 +38,7 @@ public class HabboOfferPurchase { statement.setInt(2, offerId); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); return null; } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java b/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java index 748ff259..1340f8d2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java @@ -51,7 +51,7 @@ public class BadgesComponent { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return badgesList; @@ -78,7 +78,7 @@ public class BadgesComponent { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return badgesList; } @@ -102,7 +102,7 @@ public class BadgesComponent { statement.setString(2, badge); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -112,7 +112,7 @@ public class BadgesComponent { statement.setString(2, badge); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/inventory/BotsComponent.java b/src/main/java/com/eu/habbo/habbohotel/users/inventory/BotsComponent.java index c919d56e..3db630c3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/inventory/BotsComponent.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/inventory/BotsComponent.java @@ -32,7 +32,7 @@ public class BotsComponent { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/inventory/EffectsComponent.java b/src/main/java/com/eu/habbo/habbohotel/users/inventory/EffectsComponent.java index 591ab435..e80f876e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/inventory/EffectsComponent.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/inventory/EffectsComponent.java @@ -28,7 +28,7 @@ public class EffectsComponent { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } if(habbo.getHabboInfo().getRank().getRoomEffect() > 0) this.createRankEffect(habbo.getHabboInfo().getRank().getRoomEffect()); @@ -89,7 +89,7 @@ public class EffectsComponent { statement.setInt(5, effect.effect); statement.addBatch(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } return true; @@ -97,7 +97,7 @@ public class EffectsComponent { statement.executeBatch(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } this.effects.clear(); @@ -205,7 +205,7 @@ public class EffectsComponent { statement.setInt(4, this.duration); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -215,7 +215,7 @@ public class EffectsComponent { statement.setInt(2, this.effect); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/inventory/ItemsComponent.java b/src/main/java/com/eu/habbo/habbohotel/users/inventory/ItemsComponent.java index 46f14581..e751ad66 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/inventory/ItemsComponent.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/inventory/ItemsComponent.java @@ -49,12 +49,12 @@ public class ItemsComponent { Emulator.getLogging().logErrorLine("Failed to load HabboItem: " + set.getInt("id")); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return itemsList; diff --git a/src/main/java/com/eu/habbo/habbohotel/users/inventory/PetsComponent.java b/src/main/java/com/eu/habbo/habbohotel/users/inventory/PetsComponent.java index a402f786..4d2e20a4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/inventory/PetsComponent.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/inventory/PetsComponent.java @@ -34,7 +34,7 @@ public class PetsComponent { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/inventory/WardrobeComponent.java b/src/main/java/com/eu/habbo/habbohotel/users/inventory/WardrobeComponent.java index 19bfdf4c..1e68dacf 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/inventory/WardrobeComponent.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/inventory/WardrobeComponent.java @@ -42,7 +42,7 @@ public class WardrobeComponent { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -149,7 +149,7 @@ public class WardrobeComponent { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/wired/WiredHandler.java b/src/main/java/com/eu/habbo/habbohotel/wired/WiredHandler.java index ce4b7361..935b740f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/wired/WiredHandler.java +++ b/src/main/java/com/eu/habbo/habbohotel/wired/WiredHandler.java @@ -199,7 +199,7 @@ public class WiredHandler { if (!effect.execute(roomUnit, room, stuff)) return; effect.setCooldown(millis); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } effect.activateBox(room); @@ -235,7 +235,7 @@ public class WiredHandler { statement.setInt(1, wiredId); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -250,7 +250,7 @@ public class WiredHandler { statement.setInt(4, Emulator.getIntUnixTimestamp()); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } if (reward.badge) { @@ -404,7 +404,7 @@ public class WiredHandler { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return false; diff --git a/src/main/java/com/eu/habbo/habbohotel/wired/highscores/WiredHighscoreManager.java b/src/main/java/com/eu/habbo/habbohotel/wired/highscores/WiredHighscoreManager.java index 5e797bec..42a6b353 100644 --- a/src/main/java/com/eu/habbo/habbohotel/wired/highscores/WiredHighscoreManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/wired/highscores/WiredHighscoreManager.java @@ -31,7 +31,7 @@ public class WiredHighscoreManager { this.data.clear(); this.loadHighscoreData(); - Emulator.getLogging().logStart("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 @@ -65,7 +65,7 @@ public class WiredHighscoreManager { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } @@ -85,7 +85,7 @@ public class WiredHighscoreManager { statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/messages/PacketManager.java b/src/main/java/com/eu/habbo/messages/PacketManager.java index 37635461..d7657c25 100644 --- a/src/main/java/com/eu/habbo/messages/PacketManager.java +++ b/src/main/java/com/eu/habbo/messages/PacketManager.java @@ -1,7 +1,7 @@ package com.eu.habbo.messages; import com.eu.habbo.Emulator; -import com.eu.habbo.core.Logging; +import com.eu.habbo.core.CreditsScheduler; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.messages.incoming.Incoming; import com.eu.habbo.messages.incoming.MessageHandler; @@ -71,18 +71,22 @@ import com.eu.habbo.messages.incoming.wired.WiredTriggerSaveDataEvent; import com.eu.habbo.plugin.EventHandler; import com.eu.habbo.plugin.events.emulator.EmulatorConfigUpdatedEvent; import gnu.trove.map.hash.THashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.List; public class PacketManager { + + private static final Logger LOGGER = LoggerFactory.getLogger(PacketManager.class); + private static final List logList = new ArrayList<>(); public static boolean DEBUG_SHOW_PACKETS = false; public static boolean MULTI_THREADED_PACKET_HANDLING = false; private final THashMap> incoming; private final THashMap> callables; - public PacketManager() throws Exception { this.incoming = new THashMap<>(); this.callables = new THashMap<>(); @@ -165,7 +169,7 @@ public class PacketManager { if (client.getHabbo() == null && !handlerClass.isAnnotationPresent(NoAuthMessage.class)) { if (DEBUG_SHOW_PACKETS) { - Emulator.getLogging().logPacketLine("[" + Logging.ANSI_CYAN + "CLIENT" + Logging.ANSI_RESET + "][" + Logging.ANSI_RED + "NOT LOGGED IN" + Logging.ANSI_RESET + "][" + packet.getMessageId() + "] => " + packet.getMessageBody()); + LOGGER.debug("[CLIENT][NOT LOGGED IN][{}] => {}", packet.getMessageId(), packet.getMessageBody()); } return; @@ -176,7 +180,7 @@ public class PacketManager { if (handler.getRatelimit() > 0) { if (client.messageTimestamps.containsKey(handlerClass) && System.currentTimeMillis() - client.messageTimestamps.get(handlerClass) < handler.getRatelimit()) { if (PacketManager.DEBUG_SHOW_PACKETS) { - Emulator.getLogging().logPacketLine("[" + Logging.ANSI_CYAN + "CLIENT" + Logging.ANSI_RESET + "][" + packet.getMessageId() + "][" + Logging.ANSI_RED + "RATELIMITED" + Logging.ANSI_RESET + "] => " + packet.getMessageBody()); + LOGGER.debug("[CLIENT][{}][RATELIMITED] => {}", packet.getMessageId(), packet.getMessageBody()); } return; @@ -185,11 +189,12 @@ public class PacketManager { } } - if (PacketManager.DEBUG_SHOW_PACKETS) - Emulator.getLogging().logPacketLine("[" + Logging.ANSI_CYAN + "CLIENT" + Logging.ANSI_RESET + "][" + packet.getMessageId() + "] => " + packet.getMessageBody()); + if (PacketManager.DEBUG_SHOW_PACKETS) { + LOGGER.debug("[CLIENT][{}] => {}", packet.getMessageId(), packet.getMessageBody()); + } if (logList.contains(packet.getMessageId()) && client.getHabbo() != null) { - System.out.println(("[" + Logging.ANSI_CYAN + "CLIENT" + Logging.ANSI_RESET + "][" + client.getHabbo().getHabboInfo().getUsername() + "][" + packet.getMessageId() + "] => " + packet.getMessageBody())); + LOGGER.debug("[CLIENT][{}][{}] => {}", client.getHabbo().getHabboInfo().getUsername(), packet.getMessageId(), packet.getMessageBody()); } handler.client = client; @@ -205,11 +210,12 @@ public class PacketManager { handler.handle(); } } else { - if (PacketManager.DEBUG_SHOW_PACKETS) - Emulator.getLogging().logPacketLine("[" + Logging.ANSI_CYAN + "CLIENT" + Logging.ANSI_RESET + "][" + Logging.ANSI_YELLOW + "UNDEFINED" + Logging.ANSI_RESET + "][" + packet.getMessageId() + "] => " + packet.getMessageBody()); + if (PacketManager.DEBUG_SHOW_PACKETS) { + LOGGER.debug("[CLIENT][UNDEFINED][{}] => {}", packet.getMessageId(), packet.getMessageBody()); + } } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } } diff --git a/src/main/java/com/eu/habbo/messages/ServerMessage.java b/src/main/java/com/eu/habbo/messages/ServerMessage.java index ee84e2f9..e5cf3204 100644 --- a/src/main/java/com/eu/habbo/messages/ServerMessage.java +++ b/src/main/java/com/eu/habbo/messages/ServerMessage.java @@ -1,17 +1,20 @@ package com.eu.habbo.messages; -import com.eu.habbo.Emulator; +import com.eu.habbo.util.HexUtils; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufOutputStream; import io.netty.buffer.Unpooled; import io.netty.util.IllegalReferenceCountException; import io.netty.util.ReferenceCounted; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; -import java.nio.charset.Charset; public class ServerMessage implements ReferenceCounted { + private static final Logger LOGGER = LoggerFactory.getLogger(ServerMessage.class); + private int header; private ByteBufOutputStream stream; private ByteBuf channelBuffer; @@ -29,7 +32,7 @@ public class ServerMessage implements ReferenceCounted { this.stream.writeInt(0); this.stream.writeShort(header); } catch (Exception e) { - Emulator.getLogging().handleException(e); + LOGGER.error("ServerMessage exception", e); } } @@ -42,7 +45,7 @@ public class ServerMessage implements ReferenceCounted { this.stream.writeInt(0); this.stream.writeShort(id); } catch (Exception e) { - Emulator.getLogging().handleException(e); + LOGGER.error("ServerMessage exception", e); } return this; } @@ -51,7 +54,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.write(bytes); } catch (IOException e) { - Emulator.getLogging().logPacketError(e); + LOGGER.error("ServerMessage exception", e); } } @@ -66,7 +69,7 @@ public class ServerMessage implements ReferenceCounted { this.stream.writeShort(data.length); this.stream.write(data); } catch (IOException e) { - Emulator.getLogging().logPacketError(e); + LOGGER.error("ServerMessage exception", e); } } @@ -74,7 +77,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.writeChar(obj); } catch (IOException e) { - Emulator.getLogging().logPacketError(e); + LOGGER.error("ServerMessage exception", e); } } @@ -82,7 +85,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.writeChars(obj.toString()); } catch (IOException e) { - Emulator.getLogging().logPacketError(e); + LOGGER.error("ServerMessage exception", e); } } @@ -90,7 +93,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.writeInt(obj); } catch (IOException e) { - Emulator.getLogging().logPacketError(e); + LOGGER.error("ServerMessage exception", e); } } @@ -103,7 +106,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.writeInt((int) obj); } catch (IOException e) { - Emulator.getLogging().logPacketError(e); + LOGGER.error("ServerMessage exception", e); } } @@ -111,7 +114,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.writeInt(obj ? 1 : 0); } catch (IOException e) { - Emulator.getLogging().logPacketError(e); + LOGGER.error("ServerMessage exception", e); } } @@ -119,7 +122,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.writeShort((short) obj); } catch (IOException e) { - Emulator.getLogging().logPacketError(e); + LOGGER.error("ServerMessage exception", e); } } @@ -127,7 +130,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.writeByte(b); } catch (IOException e) { - Emulator.getLogging().logPacketError(e); + LOGGER.error("ServerMessage exception", e); } } @@ -135,7 +138,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.writeBoolean(obj); } catch (IOException e) { - Emulator.getLogging().logPacketError(e); + LOGGER.error("ServerMessage exception", e); } } @@ -143,7 +146,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.writeDouble(d); } catch (IOException e) { - Emulator.getLogging().logPacketError(e); + LOGGER.error("ServerMessage exception", e); } } @@ -151,7 +154,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.writeDouble(obj); } catch (IOException e) { - Emulator.getLogging().logPacketError(e); + LOGGER.error("ServerMessage exception", e); } } @@ -159,7 +162,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.write(obj.get().array()); } catch (IOException e) { - Emulator.getLogging().logPacketError(e); + LOGGER.error("ServerMessage exception", e); } return this; @@ -170,19 +173,13 @@ public class ServerMessage implements ReferenceCounted { } public String getBodyString() { - ByteBuf buffer = this.stream.buffer().duplicate(); + byte[] data = this.get().array(); - buffer.setInt(0, buffer.writerIndex() - 4); - - String consoleText = buffer.toString(Charset.forName("UTF-8")); - - for (int i = 0; i < 14; i++) { - consoleText = consoleText.replace(Character.toString((char) i), "[" + i + "]"); + if (data.length == 0) { + return ""; } - buffer.discardSomeReadBytes(); - - return consoleText; + return HexUtils.pretty(data); } public int getHeader() { diff --git a/src/main/java/com/eu/habbo/messages/incoming/camera/CameraPublishToWebEvent.java b/src/main/java/com/eu/habbo/messages/incoming/camera/CameraPublishToWebEvent.java index 5b16fead..30eef4b9 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/camera/CameraPublishToWebEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/camera/CameraPublishToWebEvent.java @@ -50,7 +50,7 @@ public class CameraPublishToWebEvent extends MessageHandler { isOk = true; } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemAsGiftEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemAsGiftEvent.java index 5703549d..e7077d1c 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemAsGiftEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemAsGiftEvent.java @@ -104,7 +104,7 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } else { userId = habbo.getHabboInfo().getId(); @@ -287,7 +287,7 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler { try { guildId = Integer.parseInt(extraData); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java b/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java index a13616ee..5d618d19 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java @@ -50,7 +50,7 @@ public class FriendRequestEvent extends MessageHandler { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); return; } } else { diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumListEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumListEvent.java index 9dc377e3..cd1307a2 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumListEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumListEvent.java @@ -60,7 +60,7 @@ public class GuildForumListEvent extends MessageHandler { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); this.client.sendResponse(new ConnectionErrorComposer(500)); } @@ -84,7 +84,7 @@ public class GuildForumListEvent extends MessageHandler { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); this.client.sendResponse(new ConnectionErrorComposer(500)); } diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java index 13d1ee87..0923ac86 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java @@ -97,7 +97,7 @@ public class SecureLoginEvent extends MessageHandler { Emulator.getThreading().run(habbo); Emulator.getGameEnvironment().getHabboManager().addHabbo(habbo); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); Emulator.getGameServer().getGameClientManager().disposeClient(this.client); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/hotelview/HotelViewDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/hotelview/HotelViewDataEvent.java index f6db73b1..e554ceab 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/hotelview/HotelViewDataEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/hotelview/HotelViewDataEvent.java @@ -30,7 +30,7 @@ public class HotelViewDataEvent extends MessageHandler { this.client.sendResponse(new HotelViewDataComposer(data, data.split(",")[data.split(",").length - 1])); } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/inventory/RequestInventoryItemsEvent.java b/src/main/java/com/eu/habbo/messages/incoming/inventory/RequestInventoryItemsEvent.java index 11b6f3f3..ad9a7140 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/inventory/RequestInventoryItemsEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/inventory/RequestInventoryItemsEvent.java @@ -35,7 +35,7 @@ public class RequestInventoryItemsEvent extends MessageHandler { items.put(iterator.key(), iterator.value()); count++; } catch (NoSuchElementException e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); break; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestDeleteRoomEvent.java b/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestDeleteRoomEvent.java index ffd2565a..75a7909d 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestDeleteRoomEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestDeleteRoomEvent.java @@ -69,7 +69,7 @@ public class RequestDeleteRoomEvent extends MessageHandler { filter.execute(); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } 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()); diff --git a/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestNewNavigatorRoomsEvent.java b/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestNewNavigatorRoomsEvent.java index 872db874..c5f71d4e 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestNewNavigatorRoomsEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestNewNavigatorRoomsEvent.java @@ -89,7 +89,7 @@ public class RequestNewNavigatorRoomsEvent extends MessageHandler { resultLists = toQueryResults(resultLists); this.client.sendResponse(new NewNavigatorSearchResultsComposer(view, query, resultLists)); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } /* @@ -104,7 +104,7 @@ public class RequestNewNavigatorRoomsEvent extends MessageHandler { } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } */ } diff --git a/src/main/java/com/eu/habbo/messages/incoming/polls/AnswerPollEvent.java b/src/main/java/com/eu/habbo/messages/incoming/polls/AnswerPollEvent.java index c9f0168c..3abc1a7a 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/polls/AnswerPollEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/polls/AnswerPollEvent.java @@ -40,7 +40,7 @@ public class AnswerPollEvent extends MessageHandler { statement.setString(4, answer.toString()); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } if (poll.lastQuestionId == questionId) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/polls/CancelPollEvent.java b/src/main/java/com/eu/habbo/messages/incoming/polls/CancelPollEvent.java index ef0c8ae5..02284cbe 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/polls/CancelPollEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/polls/CancelPollEvent.java @@ -24,7 +24,7 @@ public class CancelPollEvent extends MessageHandler { statement.setString(4, ""); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RedeemClothingEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RedeemClothingEvent.java index 28fe03b3..048a772e 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RedeemClothingEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RedeemClothingEvent.java @@ -45,7 +45,7 @@ public class RedeemClothingEvent extends MessageHandler { statement.setInt(2, clothing.id); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } this.client.getHabbo().getInventory().getWardrobeComponent().getClothing().add(clothing.id); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/ToggleFloorItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/ToggleFloorItemEvent.java index 0ad6804a..2bc02132 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/ToggleFloorItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/ToggleFloorItemEvent.java @@ -120,7 +120,7 @@ public class ToggleFloorItemEvent extends MessageHandler { this.client.getHabbo().getRoomUnit().setGoalLocation(this.client.getHabbo().getRoomUnit().getCurrentLocation()); } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/UseRandomStateItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/UseRandomStateItemEvent.java index 0b2e6ba9..f8fbcba2 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/UseRandomStateItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/UseRandomStateItemEvent.java @@ -23,7 +23,7 @@ public class UseRandomStateItemEvent extends MessageHandler { InteractionRandomState randomStateItem = (InteractionRandomState)item; randomStateItem.onRandomStateClick(this.client, room); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/CompostMonsterplantEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/CompostMonsterplantEvent.java index 7a285f5d..333e86bc 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/CompostMonsterplantEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/CompostMonsterplantEvent.java @@ -42,7 +42,7 @@ public class CompostMonsterplantEvent extends MessageHandler { statement.setInt(1, pet.getId()); statement.executeUpdate(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/HorseRemoveSaddleEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/HorseRemoveSaddleEvent.java index 5f89d1fd..3b73995d 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/HorseRemoveSaddleEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/HorseRemoveSaddleEvent.java @@ -41,7 +41,7 @@ public class HorseRemoveSaddleEvent extends MessageHandler { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserWalkEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserWalkEvent.java index 22c0d5cc..1cd43572 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserWalkEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserWalkEvent.java @@ -154,7 +154,7 @@ public class RoomUserWalkEvent extends MessageHandler { } } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/users/ConfirmChangeNameEvent.java b/src/main/java/com/eu/habbo/messages/incoming/users/ConfirmChangeNameEvent.java index dc75d455..8d8004b6 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/users/ConfirmChangeNameEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/users/ConfirmChangeNameEvent.java @@ -80,7 +80,7 @@ public class ConfirmChangeNameEvent extends MessageHandler { statement.setInt(4, Emulator.getIntUnixTimestamp()); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } else { this.client.sendResponse(new ChangeNameCheckResultComposer(ChangeNameCheckResultComposer.TAKEN_WITH_SUGGESTIONS, name, new ArrayList<>())); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/achievements/AchievementListComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/achievements/AchievementListComposer.java index 026b0261..580ab0da 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/achievements/AchievementListComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/achievements/AchievementListComposer.java @@ -49,7 +49,7 @@ public class AchievementListComposer extends MessageComposer { this.response.appendString(""); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPagesListComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPagesListComposer.java index 36c84966..d7c340be 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPagesListComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPagesListComposer.java @@ -44,7 +44,7 @@ public class CatalogPagesListComposer extends MessageComposer { return this.response; } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } return null; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceOwnItemsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceOwnItemsComposer.java index 04a0f26f..8507f9a6 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceOwnItemsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceOwnItemsComposer.java @@ -54,7 +54,7 @@ public class MarketplaceOwnItemsComposer extends MessageComposer { this.response.appendInt(0); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendsComposer.java index 46caa6b9..4d829ac5 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendsComposer.java @@ -67,7 +67,7 @@ public class FriendsComposer extends MessageComposer { return this.response; } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } return null; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumDataComposer.java index 19f05af4..588a974a 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumDataComposer.java @@ -73,7 +73,7 @@ public class GuildForumDataComposer extends MessageComposer { newComments = set.getInt(1); } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } response.appendInt(guild.getId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryItemsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryItemsComposer.java index 6115ef3b..3a7dae3f 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryItemsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryItemsComposer.java @@ -32,7 +32,7 @@ public class InventoryItemsComposer extends MessageComposer implements TIntObjec this.items.forEachEntry(this); return this.response; } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } return null; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java index 59723fdb..da10c277 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java @@ -61,7 +61,7 @@ public class ModToolUserInfoComposer extends MessageComposer { return this.response; } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } return null; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/navigator/PrivateRoomsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/navigator/PrivateRoomsComposer.java index e811962b..8628a1d2 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/navigator/PrivateRoomsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/navigator/PrivateRoomsComposer.java @@ -42,7 +42,7 @@ public class PrivateRoomsComposer extends MessageComposer { this.response.appendString("E"); return this.response; } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } return null; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/ProfileFriendsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/ProfileFriendsComposer.java index cd4dab5a..4bf9a48e 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/ProfileFriendsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/ProfileFriendsComposer.java @@ -47,7 +47,7 @@ public class ProfileFriendsComposer extends MessageComposer { } } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } this.userId = habbo.getHabboInfo().getId(); @@ -101,7 +101,7 @@ public class ProfileFriendsComposer extends MessageComposer { this.response.appendString(this.haters.get(hatersIndex).getLook()); } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UserCurrencyComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UserCurrencyComposer.java index c91a83fe..d4e4df03 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UserCurrencyComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UserCurrencyComposer.java @@ -23,7 +23,7 @@ public class UserCurrencyComposer extends MessageComposer { try { type = Integer.valueOf(s); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); return null; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UserProfileComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UserProfileComposer.java index eecb7858..75895e72 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UserProfileComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UserProfileComposer.java @@ -60,7 +60,7 @@ public class UserProfileComposer extends MessageComposer { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } this.response.appendInt(achievementScore); diff --git a/src/main/java/com/eu/habbo/messages/rcon/ExecuteCommand.java b/src/main/java/com/eu/habbo/messages/rcon/ExecuteCommand.java index 4ac524fc..ca772404 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/ExecuteCommand.java +++ b/src/main/java/com/eu/habbo/messages/rcon/ExecuteCommand.java @@ -25,7 +25,7 @@ public class ExecuteCommand extends RCONMessage { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); this.status = RCONMessage.STATUS_ERROR; this.message = e.getMessage(); } diff --git a/src/main/java/com/eu/habbo/messages/rcon/GiveCredits.java b/src/main/java/com/eu/habbo/messages/rcon/GiveCredits.java index 2bebfc21..6c566e1d 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/GiveCredits.java +++ b/src/main/java/com/eu/habbo/messages/rcon/GiveCredits.java @@ -27,7 +27,7 @@ public class GiveCredits extends RCONMessage { statement.execute(); } catch (SQLException e) { this.status = RCONMessage.SYSTEM_ERROR; - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } this.message = "offline"; diff --git a/src/main/java/com/eu/habbo/messages/rcon/GivePixels.java b/src/main/java/com/eu/habbo/messages/rcon/GivePixels.java index 9c291db1..82b492c1 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/GivePixels.java +++ b/src/main/java/com/eu/habbo/messages/rcon/GivePixels.java @@ -27,7 +27,7 @@ public class GivePixels extends RCONMessage { statement.execute(); } catch (SQLException e) { this.status = RCONMessage.SYSTEM_ERROR; - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } this.message = "offline"; diff --git a/src/main/java/com/eu/habbo/messages/rcon/GivePoints.java b/src/main/java/com/eu/habbo/messages/rcon/GivePoints.java index 870f5677..072389b6 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/GivePoints.java +++ b/src/main/java/com/eu/habbo/messages/rcon/GivePoints.java @@ -29,7 +29,7 @@ public class GivePoints extends RCONMessage { statement.execute(); } catch (SQLException e) { this.status = RCONMessage.SYSTEM_ERROR; - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } this.message = "offline"; diff --git a/src/main/java/com/eu/habbo/messages/rcon/GiveRespect.java b/src/main/java/com/eu/habbo/messages/rcon/GiveRespect.java index d10fc328..ee01e139 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/GiveRespect.java +++ b/src/main/java/com/eu/habbo/messages/rcon/GiveRespect.java @@ -31,7 +31,7 @@ public class GiveRespect extends RCONMessage { statement.execute(); } catch (SQLException e) { this.status = RCONMessage.SYSTEM_ERROR; - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } this.message = "offline"; diff --git a/src/main/java/com/eu/habbo/messages/rcon/GiveUserClothing.java b/src/main/java/com/eu/habbo/messages/rcon/GiveUserClothing.java index e601268a..94c27399 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/GiveUserClothing.java +++ b/src/main/java/com/eu/habbo/messages/rcon/GiveUserClothing.java @@ -26,7 +26,7 @@ public class GiveUserClothing extends RCONMessage { statement.setInt(2, object.target_id); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } this.message = "offline"; diff --git a/src/main/java/com/eu/habbo/messages/rcon/MuteUser.java b/src/main/java/com/eu/habbo/messages/rcon/MuteUser.java index b86893d1..abacad3e 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/MuteUser.java +++ b/src/main/java/com/eu/habbo/messages/rcon/MuteUser.java @@ -31,7 +31,7 @@ public class MuteUser extends RCONMessage { this.status = HABBO_NOT_FOUND; } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/messages/rcon/SendGift.java b/src/main/java/com/eu/habbo/messages/rcon/SendGift.java index 0af46298..33a2cf46 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/SendGift.java +++ b/src/main/java/com/eu/habbo/messages/rcon/SendGift.java @@ -56,7 +56,7 @@ public class SendGift extends RCONMessage { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } else { username = habbo.getHabboInfo().getUsername(); diff --git a/src/main/java/com/eu/habbo/messages/rcon/SetMotto.java b/src/main/java/com/eu/habbo/messages/rcon/SetMotto.java index ae8f4d66..fc3546d5 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/SetMotto.java +++ b/src/main/java/com/eu/habbo/messages/rcon/SetMotto.java @@ -29,7 +29,7 @@ public class SetMotto extends RCONMessage { statement.execute(); } } catch (SQLException e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/messages/rcon/UpdateUser.java b/src/main/java/com/eu/habbo/messages/rcon/UpdateUser.java index 0a8859fe..1e1a6bf2 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/UpdateUser.java +++ b/src/main/java/com/eu/habbo/messages/rcon/UpdateUser.java @@ -105,7 +105,7 @@ public class UpdateUser extends RCONMessage { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/networking/Server.java b/src/main/java/com/eu/habbo/networking/Server.java index 76b45b61..f59a6d5a 100644 --- a/src/main/java/com/eu/habbo/networking/Server.java +++ b/src/main/java/com/eu/habbo/networking/Server.java @@ -1,6 +1,5 @@ package com.eu.habbo.networking; -import com.eu.habbo.Emulator; import io.netty.bootstrap.ServerBootstrap; import io.netty.buffer.UnpooledByteBufAllocator; import io.netty.channel.ChannelFuture; @@ -9,10 +8,15 @@ import io.netty.channel.EventLoopGroup; import io.netty.channel.FixedRecvByteBufAllocator; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.nio.NioServerSocketChannel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.concurrent.TimeUnit; public abstract class Server { + + private static final Logger LOGGER = LoggerFactory.getLogger(Server.class); + protected final ServerBootstrap serverBootstrap; protected final EventLoopGroup bossGroup; protected final EventLoopGroup workerGroup; @@ -48,22 +52,22 @@ public abstract class Server { } if (!channelFuture.isSuccess()) { - Emulator.getLogging().logShutdownLine("Failed to connect to the host (" + this.host + ":" + this.port + ")@" + this.name); + LOGGER.info("Failed to connect to the host (" + this.host + ":" + this.port + ")@" + this.name); System.exit(0); } else { - Emulator.getLogging().logStart("Started GameServer on " + this.host + ":" + this.port + "@" + this.name); + LOGGER.info("Started GameServer on " + this.host + ":" + this.port + "@" + this.name); } } public void stop() { - Emulator.getLogging().logShutdownLine("Stopping " + this.name); + LOGGER.info("Stopping " + this.name); try { this.workerGroup.shutdownGracefully(0, 0, TimeUnit.MILLISECONDS).sync(); this.bossGroup.shutdownGracefully(0, 0, TimeUnit.MILLISECONDS).sync(); } catch (Exception e) { - Emulator.getLogging().logErrorLine("Exception during " + this.name + " shutdown... HARD STOP"); + LOGGER.error("Exception during {} shutdown... HARD STOP", this.name, e); } - Emulator.getLogging().logShutdownLine("GameServer Stopped!"); + LOGGER.info("GameServer Stopped!"); } public ServerBootstrap getServerBootstrap() { diff --git a/src/main/java/com/eu/habbo/networking/camera/CameraClient.java b/src/main/java/com/eu/habbo/networking/camera/CameraClient.java index 7bcba9ba..5635d9c9 100644 --- a/src/main/java/com/eu/habbo/networking/camera/CameraClient.java +++ b/src/main/java/com/eu/habbo/networking/camera/CameraClient.java @@ -1,6 +1,5 @@ package com.eu.habbo.networking.camera; -import com.eu.habbo.core.Logging; import com.eu.habbo.networking.camera.messages.outgoing.CameraLoginComposer; import io.netty.bootstrap.Bootstrap; import io.netty.buffer.UnpooledByteBufAllocator; @@ -8,8 +7,13 @@ import io.netty.channel.*; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class CameraClient { + + private static final Logger LOGGER = LoggerFactory.getLogger(CameraClient.class); + private static final String host = "google.com"; private static final int port = 1232; public static ChannelFuture channelFuture; @@ -47,10 +51,10 @@ public class CameraClient { if (CameraClient.channelFuture.isSuccess()) { CameraClient.attemptReconnect = false; CameraClient.channel = channelFuture.channel(); - System.out.println("[" + Logging.ANSI_GREEN + "CAMERA" + Logging.ANSI_RESET + "] Connected to the Camera Server. Attempting to login..."); + LOGGER.info("Connected to the Camera Server. Attempting to login."); this.sendMessage(new CameraLoginComposer()); } else { - System.out.println("[" + Logging.ANSI_RED + "CAMERA" + Logging.ANSI_RESET + "] Failed to connect to the Camera Server. Server unreachable."); + LOGGER.error("Failed to connect to the Camera Server. Server unreachable."); CameraClient.channel = null; CameraClient.channelFuture.channel().close(); CameraClient.channelFuture = null; @@ -71,7 +75,7 @@ public class CameraClient { channel = null; isLoggedIn = false; - System.out.println("[" + Logging.ANSI_GREEN + "CAMERA" + Logging.ANSI_RESET + "] Disconnected from the camera server."); + LOGGER.info("Disconnected from the camera server."); } public void sendMessage(CameraOutgoingMessage outgoingMessage) { diff --git a/src/main/java/com/eu/habbo/networking/camera/CameraPacketHandler.java b/src/main/java/com/eu/habbo/networking/camera/CameraPacketHandler.java index 72dc7c1a..8d52ee08 100644 --- a/src/main/java/com/eu/habbo/networking/camera/CameraPacketHandler.java +++ b/src/main/java/com/eu/habbo/networking/camera/CameraPacketHandler.java @@ -38,7 +38,7 @@ public class CameraPacketHandler { message.handle(channel); message.buffer.release(); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/networking/camera/messages/incoming/CameraLoginStatusEvent.java b/src/main/java/com/eu/habbo/networking/camera/messages/incoming/CameraLoginStatusEvent.java index 467e9014..a13a5092 100644 --- a/src/main/java/com/eu/habbo/networking/camera/messages/incoming/CameraLoginStatusEvent.java +++ b/src/main/java/com/eu/habbo/networking/camera/messages/incoming/CameraLoginStatusEvent.java @@ -1,12 +1,16 @@ package com.eu.habbo.networking.camera.messages.incoming; -import com.eu.habbo.core.Logging; import com.eu.habbo.networking.camera.CameraClient; import com.eu.habbo.networking.camera.CameraIncomingMessage; import io.netty.buffer.ByteBuf; import io.netty.channel.Channel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class CameraLoginStatusEvent extends CameraIncomingMessage { + + private static final Logger LOGGER = LoggerFactory.getLogger(CameraLoginStatusEvent.class); + public final static int LOGIN_OK = 0; public final static int LOGIN_ERROR = 1; public final static int NO_ACCOUNT = 2; @@ -24,28 +28,27 @@ public class CameraLoginStatusEvent extends CameraIncomingMessage { int status = this.readInt(); if (status == LOGIN_ERROR) { - System.out.println("[" + Logging.ANSI_RED + "CAMERA" + Logging.ANSI_RESET + "] Failed to login to Camera Server: Incorrect Details"); + LOGGER.error("Failed to login to Camera Server: Incorrect Details"); } else if (status == NO_ACCOUNT) { - System.out.println("[" + Logging.ANSI_RED + "CAMERA" + Logging.ANSI_RESET + "] Failed to login to Camera Server: No Account Found. Register for free on the Arcturus Forums! Visit http://arcturus.pw/"); + LOGGER.error("Failed to login to Camera Server: No Account Found. Register for free on the Arcturus Forums! Visit http://arcturus.pw/"); } else if (status == BANNED) { - System.out.println("[" + Logging.ANSI_RED + "CAMERA" + Logging.ANSI_RESET + "] Sorry but you seem to be banned from the Arcturus forums and therefor cant use the Camera Server :'("); + LOGGER.error("Sorry but you seem to be banned from the Arcturus forums and therefor cant use the Camera Server :'("); } else if (status == ALREADY_LOGGED_IN) { - System.out.println("[" + Logging.ANSI_RED + "CAMERA" + Logging.ANSI_RESET + "] You seem to be already connected to the Camera Server"); + LOGGER.error("You seem to be already connected to the Camera Server"); } else if (status == OLD_BUILD) { - System.out.println("[" + Logging.ANSI_RED + "CAMERA" + Logging.ANSI_RESET + "] This version of Arcturus Emulator is no longer supported by the Camera Server. Upgrade your emulator."); + LOGGER.error("This version of Arcturus Emulator is no longer supported by the Camera Server. Upgrade your emulator."); } else if (status == NO_CAMERA_SUBSCRIPTION) { - System.out.println("[" + Logging.ANSI_RED + "CAMERA" + Logging.ANSI_RESET + "] You don't have a Camera Subscription and therefor cannot use the camera!"); - System.out.println("[" + Logging.ANSI_RED + "CAMERA" + Logging.ANSI_RESET + "] Please consider making a donation to keep this project going. The emulator can be used free of charge!"); - System.out.println("[" + Logging.ANSI_RED + "CAMERA" + Logging.ANSI_RESET + "] A trial version is available for $2.5. A year subscription is only $10 and a permanent subscription is $25."); - System.out.println("[" + Logging.ANSI_RED + "CAMERA" + Logging.ANSI_RESET + "] By donating this subscription you support the development of the emulator you are using :)"); - System.out.println("[" + Logging.ANSI_RED + "CAMERA" + Logging.ANSI_RESET + "] Visit http://arcturus.pw/mysubscriptions.php to buy your subscription!"); - System.out.println(""); - System.out.println("\t\t\t\t Please Consider getting a subscription. Regards: The General"); + LOGGER.error("You don't have a Camera Subscription and therefor cannot use the camera!"); + LOGGER.error("Please consider making a donation to keep this project going. The emulator can be used free of charge!"); + LOGGER.error("A trial version is available for $2.5. A year subscription is only $10 and a permanent subscription is $25."); + LOGGER.error("By donating this subscription you support the development of the emulator you are using :)"); + LOGGER.error("Visit http://arcturus.pw/mysubscriptions.php to buy your subscription!"); + LOGGER.error("Please Consider getting a subscription. Regards: The General"); } if (status == LOGIN_OK) { CameraClient.isLoggedIn = true; - System.out.println("[" + Logging.ANSI_GREEN + "CAMERA" + Logging.ANSI_RESET + "] Succesfully connected to the Arcturus Camera Server!"); + LOGGER.info("Succesfully connected to the Arcturus Camera Server!"); } else { CameraClient.attemptReconnect = false; } diff --git a/src/main/java/com/eu/habbo/networking/camera/messages/incoming/CameraUpdateNotification.java b/src/main/java/com/eu/habbo/networking/camera/messages/incoming/CameraUpdateNotification.java index d0d0504c..358e8e1c 100644 --- a/src/main/java/com/eu/habbo/networking/camera/messages/incoming/CameraUpdateNotification.java +++ b/src/main/java/com/eu/habbo/networking/camera/messages/incoming/CameraUpdateNotification.java @@ -1,13 +1,17 @@ package com.eu.habbo.networking.camera.messages.incoming; import com.eu.habbo.Emulator; -import com.eu.habbo.core.Logging; import com.eu.habbo.messages.outgoing.generic.alerts.GenericAlertComposer; import com.eu.habbo.networking.camera.CameraIncomingMessage; import io.netty.buffer.ByteBuf; import io.netty.channel.Channel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class CameraUpdateNotification extends CameraIncomingMessage { + + private static final Logger LOGGER = LoggerFactory.getLogger(CameraUpdateNotification.class); + public CameraUpdateNotification(Short header, ByteBuf body) { super(header, body); } @@ -19,11 +23,11 @@ public class CameraUpdateNotification extends CameraIncomingMessage { int type = this.readInt(); if (type == 0) { - System.out.println("[" + Logging.ANSI_GREEN + "CAMERA" + Logging.ANSI_RESET + "] " + message); + LOGGER.info("Camera update: {}", message); } else if (type == 1) { - System.out.println("[" + Logging.ANSI_YELLOW + "CAMERA" + Logging.ANSI_RESET + "] " + message); + LOGGER.warn("Camera update: {}", message); } else if (type == 2) { - System.out.println("[" + Logging.ANSI_RED + "CAMERA" + Logging.ANSI_RESET + "] " + message); + LOGGER.error("Camera update: {}", message); } if (alert) { diff --git a/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageHandler.java b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageHandler.java index 9674c707..022d5f16 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageHandler.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageHandler.java @@ -40,7 +40,7 @@ public class GameMessageHandler extends ChannelInboundHandlerAdapter { handler.run(); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } diff --git a/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java b/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java index 264a7837..b6ac3cf3 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java @@ -1,18 +1,25 @@ package com.eu.habbo.networking.gameserver.encoders; -import com.eu.habbo.Emulator; -import com.eu.habbo.core.Logging; import com.eu.habbo.messages.ServerMessage; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToMessageEncoder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.List; public class GameServerMessageLogger extends MessageToMessageEncoder { + private static final Logger LOGGER = LoggerFactory.getLogger(GameServerMessageLogger.class); + @Override protected void encode(ChannelHandlerContext ctx, ServerMessage message, List out) throws Exception { - Emulator.getLogging().logPacketLine("[" + Logging.ANSI_PURPLE + "SERVER" + Logging.ANSI_RESET + "] => [" + message.getHeader() + "] -> " + message.getBodyString()); + LOGGER.debug("[SERVER][{}]", message.getHeader()); + + String body = message.getBodyString(); + if (body == null || body.length() == 0) { + LOGGER.debug("\n" + message.getBodyString()); + } out.add(message.retain()); } diff --git a/src/main/java/com/eu/habbo/networking/rconserver/RCONServer.java b/src/main/java/com/eu/habbo/networking/rconserver/RCONServer.java index ea65161a..ebc225f5 100644 --- a/src/main/java/com/eu/habbo/networking/rconserver/RCONServer.java +++ b/src/main/java/com/eu/habbo/networking/rconserver/RCONServer.java @@ -1,7 +1,6 @@ package com.eu.habbo.networking.rconserver; import com.eu.habbo.Emulator; -import com.eu.habbo.core.Logging; import com.eu.habbo.messages.rcon.*; import com.eu.habbo.networking.Server; import com.google.gson.Gson; @@ -10,12 +9,17 @@ import gnu.trove.map.hash.THashMap; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInitializer; import io.netty.channel.socket.SocketChannel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class RCONServer extends Server { + + private static final Logger LOGGER = LoggerFactory.getLogger(RCONServer.class); + private final THashMap> messages; private final GsonBuilder gsonBuilder; List allowedAdresses = new ArrayList<>(); @@ -87,21 +91,19 @@ public class RCONServer extends Server { RCONMessage rcon = message.getDeclaredConstructor().newInstance(); Gson gson = this.gsonBuilder.create(); rcon.handle(gson, gson.fromJson(body, rcon.type)); - System.out.print("[" + Logging.ANSI_BLUE + "RCON" + Logging.ANSI_RESET + "] Handled RCON Message: " + message.getSimpleName()); + LOGGER.info("Handled RCON Message: {}", message.getSimpleName()); result = gson.toJson(rcon, RCONMessage.class); if (Emulator.debugging) { - System.out.print(" [" + Logging.ANSI_BLUE + "DATA" + Logging.ANSI_RESET + "]" + body + "[" + Logging.ANSI_BLUE + "RESULT" + Logging.ANSI_RESET + "]" + result); + LOGGER.debug("RCON Data {} RCON Result {}", body, result); } - System.out.println(""); return result; } catch (Exception ex) { - Emulator.getLogging().logErrorLine(ex); - Emulator.getLogging().logPacketError("[RCON] Failed to handle RCONMessage: " + message.getName() + ex.getMessage() + " by: " + ctx.channel().remoteAddress()); + LOGGER.error("Failed to handle RCONMessage", ex); } } else { - Emulator.getLogging().logPacketError("[RCON] Couldn't find: " + key); + LOGGER.error("Couldn't find: {}", key); } throw new ArrayIndexOutOfBoundsException("Unhandled RCON Message"); diff --git a/src/main/java/com/eu/habbo/networking/rconserver/RCONServerHandler.java b/src/main/java/com/eu/habbo/networking/rconserver/RCONServerHandler.java index f790cc7a..0563fe0e 100644 --- a/src/main/java/com/eu/habbo/networking/rconserver/RCONServerHandler.java +++ b/src/main/java/com/eu/habbo/networking/rconserver/RCONServerHandler.java @@ -2,7 +2,6 @@ package com.eu.habbo.networking.rconserver; import com.eu.habbo.Emulator; -import com.eu.habbo.core.Logging; import com.google.gson.Gson; import com.google.gson.JsonObject; import io.netty.buffer.ByteBuf; @@ -10,8 +9,13 @@ import io.netty.buffer.Unpooled; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class RCONServerHandler extends ChannelInboundHandlerAdapter { + + private static final Logger LOGGER = LoggerFactory.getLogger(RCONServerHandler.class); + @Override public void channelRegistered(ChannelHandlerContext ctx) throws Exception { String adress = ctx.channel().remoteAddress().toString().split(":")[0].replace("/", ""); @@ -23,7 +27,8 @@ public class RCONServerHandler extends ChannelInboundHandlerAdapter { } ctx.channel().close(); - Emulator.getLogging().logDebugLine("Remote connection closed: " + adress + ". IP not allowed!"); + + LOGGER.warn("RCON Remote connection closed: {}. IP not allowed!", adress); } @Override @@ -41,9 +46,9 @@ public class RCONServerHandler extends ChannelInboundHandlerAdapter { key = object.get("key").getAsString(); response = Emulator.getRconServer().handle(ctx, key, object.get("data").toString()); } catch (ArrayIndexOutOfBoundsException e) { - System.out.println("[" + Logging.ANSI_RED + "RCON" + Logging.ANSI_RESET + "] Unknown RCON Message: " + key); + LOGGER.error("Unknown RCON Message: {}", key); } catch (Exception e) { - Emulator.getLogging().logDebugLine("[RCON] Not JSON: " + message); + LOGGER.error("Invalid RCON Message: {}", message); e.printStackTrace(); } diff --git a/src/main/java/com/eu/habbo/plugin/PluginManager.java b/src/main/java/com/eu/habbo/plugin/PluginManager.java index de5d991b..d2d7c730 100644 --- a/src/main/java/com/eu/habbo/plugin/PluginManager.java +++ b/src/main/java/com/eu/habbo/plugin/PluginManager.java @@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.bots.BotManager; import com.eu.habbo.habbohotel.catalog.CatalogManager; import com.eu.habbo.habbohotel.catalog.TargetOffer; import com.eu.habbo.habbohotel.catalog.marketplace.MarketPlace; +import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.games.freeze.FreezeGame; import com.eu.habbo.habbohotel.games.tag.TagGame; import com.eu.habbo.habbohotel.items.ItemManager; @@ -43,6 +44,8 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import gnu.trove.iterator.hash.TObjectHashIterator; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; @@ -56,6 +59,9 @@ import java.util.NoSuchElementException; import java.util.Objects; public class PluginManager { + + private static final Logger LOGGER = LoggerFactory.getLogger(GameClient.class); + private final THashSet plugins = new THashSet<>(); private final THashSet methods = new THashSet<>(); @@ -169,7 +175,7 @@ public class PluginManager { if (!loc.exists()) { if (loc.mkdirs()) { - Emulator.getLogging().logStart("Created plugins directory!"); + LOGGER.info("Created plugins directory!"); } } @@ -203,12 +209,12 @@ public class PluginManager { this.plugins.add(plugin); plugin.onEnable(); } catch (Exception e) { - Emulator.getLogging().logErrorLine("Could not load plugin " + pluginConfigurtion.name + "!"); - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Could not load plugin {}!", pluginConfigurtion.name); + LOGGER.error("Caught exception", e); } } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } } } @@ -241,8 +247,8 @@ public class PluginManager { try { method.invoke(null, event); } catch (Exception e) { - Emulator.getLogging().logErrorLine("Could not pass default event " + event.getClass().getName() + " to " + method.getClass().getName() + ":" + method.getName()); - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Could not pass default event {} to {}: {}!", event.getClass().getName(), method.getClass().getName(), method.getName()); + LOGGER.error("Caught exception", e); } } } @@ -260,8 +266,8 @@ public class PluginManager { try { method.invoke(plugin, event); } catch (Exception e) { - Emulator.getLogging().logErrorLine("Could not pass event " + event.getClass().getName() + " to " + plugin.configuration.name); - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Could not pass event {} to {}", event.getClass().getName(), plugin.configuration.name); + LOGGER.error("Caught exception", e); } } } @@ -300,7 +306,7 @@ public class PluginManager { public void dispose() { this.disposePlugins(); - Emulator.getLogging().logShutdownLine("Disposed Plugin Manager!"); + LOGGER.info("Disposed Plugin Manager!"); } private void disposePlugins() { @@ -316,10 +322,9 @@ public class PluginManager { p.stream.close(); p.classLoader.close(); } catch (IOException e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } catch (Exception ex) { - Emulator.getLogging().logErrorLine("[CRITICAL][PLUGIN] Failed to disable " + p.configuration.name + " caused by: " + ex.getLocalizedMessage()); - Emulator.getLogging().logErrorLine(ex); + LOGGER.error("Failed to disable {} because of an exception.", p.configuration.name, ex); } } } catch (NoSuchElementException e) { @@ -336,7 +341,7 @@ public class PluginManager { this.loadPlugins(); - Emulator.getLogging().logStart("Plugin Manager -> Loaded! " + this.plugins.size() + " plugins! (" + (System.currentTimeMillis() - millis) + " MS)"); + LOGGER.info("Plugin Manager -> Loaded! " + this.plugins.size() + " plugins! (" + (System.currentTimeMillis() - millis) + " MS)"); this.registerDefaultEvents(); } @@ -355,8 +360,8 @@ public class PluginManager { this.methods.add(PluginManager.class.getMethod("globalOnConfigurationUpdated", EmulatorConfigUpdatedEvent.class)); this.methods.add(WiredHighscoreManager.class.getMethod("onEmulatorLoaded", EmulatorLoadedEvent.class)); } catch (NoSuchMethodException e) { - Emulator.getLogging().logStart("Failed to define default events!"); - Emulator.getLogging().logErrorLine(e); + LOGGER.info("Failed to define default events!"); + LOGGER.error("Caught exception", e); } } diff --git a/src/main/java/com/eu/habbo/threading/ThreadPooling.java b/src/main/java/com/eu/habbo/threading/ThreadPooling.java index 62178767..160ca121 100644 --- a/src/main/java/com/eu/habbo/threading/ThreadPooling.java +++ b/src/main/java/com/eu/habbo/threading/ThreadPooling.java @@ -1,13 +1,19 @@ package com.eu.habbo.threading; import com.eu.habbo.Emulator; +import com.eu.habbo.util.imager.badges.BadgeImager; import io.netty.util.concurrent.DefaultThreadFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; public class ThreadPooling { + + private static final Logger LOGGER = LoggerFactory.getLogger(ThreadPooling.class); + public final int threads; private final ScheduledExecutorService scheduledPool; private volatile boolean canAdd; @@ -16,7 +22,7 @@ public class ThreadPooling { this.threads = threads; this.scheduledPool = new HabboExecutorService(this.threads, new DefaultThreadFactory("ArcturusThreadFactory")); this.canAdd = true; - Emulator.getLogging().logStart("Thread Pool -> Loaded!"); + LOGGER.info("Thread Pool -> Loaded!"); } public ScheduledFuture run(Runnable run) { @@ -29,7 +35,7 @@ public class ThreadPooling { } } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } return null; @@ -42,12 +48,12 @@ public class ThreadPooling { try { run.run(); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } }, delay, TimeUnit.MILLISECONDS); } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); } return null; @@ -57,7 +63,7 @@ public class ThreadPooling { this.canAdd = false; this.scheduledPool.shutdownNow(); - Emulator.getLogging().logShutdownLine("Threading -> Disposed!"); + LOGGER.info("Threading -> Disposed!"); } public void setCanAdd(boolean canAdd) { diff --git a/src/main/java/com/eu/habbo/threading/runnables/CameraClientAutoReconnect.java b/src/main/java/com/eu/habbo/threading/runnables/CameraClientAutoReconnect.java index 507330f1..a3b31144 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/CameraClientAutoReconnect.java +++ b/src/main/java/com/eu/habbo/threading/runnables/CameraClientAutoReconnect.java @@ -1,15 +1,19 @@ package com.eu.habbo.threading.runnables; import com.eu.habbo.Emulator; -import com.eu.habbo.core.Logging; import com.eu.habbo.networking.camera.CameraClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class CameraClientAutoReconnect implements Runnable { + + private static final Logger LOGGER = LoggerFactory.getLogger(CameraClientAutoReconnect.class); + @Override public void run() { if (CameraClient.attemptReconnect && !Emulator.isShuttingDown) { if (!(CameraClient.channelFuture != null && CameraClient.channelFuture.channel().isRegistered())) { - System.out.println("[" + Logging.ANSI_YELLOW + "CAMERA" + Logging.ANSI_RESET + "] Attempting to connect to the Camera server."); + LOGGER.info("Attempting to connect to the Camera server."); if (Emulator.getCameraClient() != null) { Emulator.getCameraClient().disconnect(); } else { @@ -19,11 +23,11 @@ public class CameraClientAutoReconnect implements Runnable { try { Emulator.getCameraClient().connect(); } catch (Exception e) { - System.out.println("[" + Logging.ANSI_RED + "CAMERA" + Logging.ANSI_RESET + "] Failed to start the camera client."); + LOGGER.error("Failed to start the camera client.", e); } } else { CameraClient.attemptReconnect = false; - System.out.println("[" + Logging.ANSI_RED + "CAMERA" + Logging.ANSI_RESET + "] Already connected to the camera. Reconnecting not needed!"); + LOGGER.info("Already connected to the camera. Reconnecting not needed!"); } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/InsertModToolIssue.java b/src/main/java/com/eu/habbo/threading/runnables/InsertModToolIssue.java index b1af7db2..9c7e8624 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/InsertModToolIssue.java +++ b/src/main/java/com/eu/habbo/threading/runnables/InsertModToolIssue.java @@ -2,10 +2,15 @@ package com.eu.habbo.threading.runnables; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.modtool.ModToolIssue; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.*; public class InsertModToolIssue implements Runnable { + + private static final Logger LOGGER = LoggerFactory.getLogger(InsertModToolIssue.class); + private final ModToolIssue issue; public InsertModToolIssue(ModToolIssue issue) { @@ -36,7 +41,7 @@ public class InsertModToolIssue implements Runnable { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/OpenGift.java b/src/main/java/com/eu/habbo/threading/runnables/OpenGift.java index 07d84aae..23f72bba 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/OpenGift.java +++ b/src/main/java/com/eu/habbo/threading/runnables/OpenGift.java @@ -100,7 +100,7 @@ public class OpenGift implements Runnable { this.habbo.getClient().sendResponse(new PresentItemOpenedComposer(inside, "", false)); } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboBadge.java b/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboBadge.java index 7cef3cff..b13decab 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboBadge.java +++ b/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboBadge.java @@ -23,7 +23,7 @@ class QueryDeleteHabboBadge implements Runnable { statement.setString(2, this.name); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboItem.java b/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboItem.java index b8fb5746..d12d16de 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboItem.java +++ b/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboItem.java @@ -24,7 +24,7 @@ public class QueryDeleteHabboItem implements Runnable { statement.setInt(1, this.itemId); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboItems.java b/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboItems.java index 0b6b0647..20340ee1 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboItems.java +++ b/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboItems.java @@ -28,7 +28,7 @@ public class QueryDeleteHabboItems implements Runnable { statement.executeBatch(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } this.items.clear(); diff --git a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleport.java b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleport.java index 18489aec..399e683f 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleport.java +++ b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleport.java @@ -42,7 +42,7 @@ public class RoomUnitTeleport implements Runnable { try { topItem.onWalkOff(this.roomUnit, this.room, new Object[]{this}); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } this.roomUnit.setPath(new LinkedList<>()); diff --git a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleportWalkToAction.java b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleportWalkToAction.java index 4403235a..f3ab7254 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleportWalkToAction.java +++ b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleportWalkToAction.java @@ -29,7 +29,7 @@ public class RoomUnitTeleportWalkToAction implements Runnable { try { this.habboItem.onClick(this.habbo.getClient(), this.room, new Object[]{0}); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } else { if (tile.isWalkable()) { diff --git a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitVendingMachineAction.java b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitVendingMachineAction.java index 10e13ce8..fde3f333 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitVendingMachineAction.java +++ b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitVendingMachineAction.java @@ -28,7 +28,7 @@ public class RoomUnitVendingMachineAction implements Runnable { try { this.habboItem.onClick(this.habbo.getClient(), this.room, new Object[]{0}); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } else { if (this.room.getLayout().getTile(tile.x, tile.y).isWalkable()) { diff --git a/src/main/java/com/eu/habbo/threading/runnables/SaveScoreForTeam.java b/src/main/java/com/eu/habbo/threading/runnables/SaveScoreForTeam.java index 6007f83a..d046b669 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/SaveScoreForTeam.java +++ b/src/main/java/com/eu/habbo/threading/runnables/SaveScoreForTeam.java @@ -34,7 +34,7 @@ public class SaveScoreForTeam implements Runnable { statement.executeBatch(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/TeleportInteraction.java b/src/main/java/com/eu/habbo/threading/runnables/TeleportInteraction.java index b1a73ad7..3513b8f6 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/TeleportInteraction.java +++ b/src/main/java/com/eu/habbo/threading/runnables/TeleportInteraction.java @@ -112,7 +112,7 @@ class TeleportInteraction extends Thread { } } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java b/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java index 03df0f4d..b79c87ec 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java +++ b/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java @@ -24,7 +24,7 @@ public class UpdateModToolIssue implements Runnable { statement.setInt(5, this.issue.id); statement.execute(); } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/freeze/FreezeHandleSnowballExplosion.java b/src/main/java/com/eu/habbo/threading/runnables/freeze/FreezeHandleSnowballExplosion.java index 6826af2e..c7b923a6 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/freeze/FreezeHandleSnowballExplosion.java +++ b/src/main/java/com/eu/habbo/threading/runnables/freeze/FreezeHandleSnowballExplosion.java @@ -100,7 +100,7 @@ class FreezeHandleSnowballExplosion implements Runnable { Emulator.getThreading().run(new FreezeResetExplosionTiles(freezeTiles, this.thrownData.room), 1000); } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + logger.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionTwo.java b/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionTwo.java index 5be506d3..cdefe057 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionTwo.java +++ b/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionTwo.java @@ -39,7 +39,7 @@ class HopperActionTwo implements Runnable { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } if (targetRoomId != 0 && targetItemId != 0) { diff --git a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionTwo.java b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionTwo.java index 5509f726..3e362919 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionTwo.java +++ b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionTwo.java @@ -72,7 +72,7 @@ class TeleportActionTwo implements Runnable { } } } catch (SQLException e) { - Emulator.getLogging().logSQLException(e); + logger.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/util/HexUtils.java b/src/main/java/com/eu/habbo/util/HexUtils.java new file mode 100644 index 00000000..63846653 --- /dev/null +++ b/src/main/java/com/eu/habbo/util/HexUtils.java @@ -0,0 +1,57 @@ +package com.eu.habbo.util; + +import java.nio.charset.StandardCharsets; + +public class HexUtils { + + private static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray(); + + public static String toHex(byte[] bytes) { + char[] hexChars = new char[bytes.length * 2]; + for (int j = 0; j < bytes.length; j++) { + int v = bytes[j] & 0xFF; + hexChars[j * 2] = HEX_ARRAY[v >>> 4]; + hexChars[j * 2 + 1] = HEX_ARRAY[v & 0x0F]; + } + return new String(hexChars); + } + + public static byte[] toBytes(String hexString) { + int len = hexString.length(); + byte[] data = new byte[len / 2]; + for (int i = 0; i < len; i += 2) { + data[i / 2] = (byte) ((Character.digit(hexString.charAt(i), 16) << 4) + + Character.digit(hexString.charAt(i+1), 16)); + } + return data; + } + + public static String pretty(byte[] array) { + final int width = 32; + + StringBuilder builder = new StringBuilder(); + + for (int rowOffset = 0; rowOffset < array.length; rowOffset += width) { + builder.append(String.format("%06d: ", rowOffset)); + + for (int index = 0; index < width; index++) { + if (rowOffset + index < array.length) { + builder.append(String.format("%02x ", array[rowOffset + index])); + } else { + builder.append(" "); + } + } + + int asciiWidth = Math.min(width, array.length - rowOffset); + builder.append(" | "); + builder.append(new String(array, rowOffset, asciiWidth, StandardCharsets.UTF_8).replaceAll("\r\n", " ").replaceAll("\n", " ")); + + if (rowOffset + width < array.length) { + builder.append(String.format("%n")); + } + } + + return builder.toString(); + } + +} diff --git a/src/main/java/com/eu/habbo/util/callback/HTTPVersionCheck.java b/src/main/java/com/eu/habbo/util/callback/HTTPVersionCheck.java index 01fac236..8ac8ef34 100644 --- a/src/main/java/com/eu/habbo/util/callback/HTTPVersionCheck.java +++ b/src/main/java/com/eu/habbo/util/callback/HTTPVersionCheck.java @@ -38,7 +38,7 @@ package com.eu.habbo.util.callback; buff.close(); in.close(); - Emulator.getLogging().logStart(text.toString()); + logger.info(text.toString()); Emulator.getGameServer().getGameClientManager().sendBroadcastResponse(new GenericAlertComposer(text.toString())); } wr.close(); diff --git a/src/main/java/com/eu/habbo/util/imager/badges/BadgeImager.java b/src/main/java/com/eu/habbo/util/imager/badges/BadgeImager.java index 2872cad8..616f6978 100644 --- a/src/main/java/com/eu/habbo/util/imager/badges/BadgeImager.java +++ b/src/main/java/com/eu/habbo/util/imager/badges/BadgeImager.java @@ -5,6 +5,8 @@ import com.eu.habbo.habbohotel.guilds.Guild; import com.eu.habbo.habbohotel.guilds.GuildPart; import com.eu.habbo.habbohotel.guilds.GuildPartType; import gnu.trove.map.hash.THashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.imageio.ImageIO; import java.awt.*; @@ -16,15 +18,17 @@ import java.io.File; import java.util.Map; public class BadgeImager { + + private static final Logger LOGGER = LoggerFactory.getLogger(BadgeImager.class); + final THashMap cachedImages = new THashMap<>(); public BadgeImager() { if (Emulator.getConfig().getBoolean("imager.internal.enabled")) { if (this.reload()) { - Emulator.getLogging().logStart("Badge Imager -> Loaded!"); - + LOGGER.info("Badge Imager -> Loaded!"); } else { - Emulator.getLogging().logStart("Badge Imager -> Disabled! Please check your configuration!"); + LOGGER.warn("Badge Imager -> Disabled! Please check your configuration!"); } } } @@ -113,7 +117,7 @@ public class BadgeImager { public synchronized boolean reload() { File file = new File(Emulator.getConfig().getValue("imager.location.badgeparts")); if (!file.exists()) { - Emulator.getLogging().logErrorLine("[BadgeImager] Output folder: " + Emulator.getConfig().getValue("imager.location.badgeparts") + " does not exist!"); + LOGGER.error("BadgeImager output folder: {} does not exist!", Emulator.getConfig().getValue("imager.location.badgeparts")); return false; } @@ -126,7 +130,7 @@ public class BadgeImager { try { this.cachedImages.put(map.getValue().valueA, ImageIO.read(new File(Emulator.getConfig().getValue("imager.location.badgeparts"), "badgepart_" + map.getValue().valueA.replace(".gif", ".png")))); } catch (Exception e) { - Emulator.getLogging().logStart(("[Badge Imager] Missing Badge Part: " + Emulator.getConfig().getValue("imager.location.badgeparts") + "/badgepart_" + map.getValue().valueA.replace(".gif", ".png"))); + LOGGER.info(("[Badge Imager] Missing Badge Part: " + Emulator.getConfig().getValue("imager.location.badgeparts") + "/badgepart_" + map.getValue().valueA.replace(".gif", ".png"))); } } @@ -134,14 +138,14 @@ public class BadgeImager { try { this.cachedImages.put(map.getValue().valueB, ImageIO.read(new File(Emulator.getConfig().getValue("imager.location.badgeparts"), "badgepart_" + map.getValue().valueB.replace(".gif", ".png")))); } catch (Exception e) { - Emulator.getLogging().logStart(("[Badge Imager] Missing Badge Part: " + Emulator.getConfig().getValue("imager.location.badgeparts") + "/badgepart_" + map.getValue().valueB.replace(".gif", ".png"))); + LOGGER.info(("[Badge Imager] Missing Badge Part: " + Emulator.getConfig().getValue("imager.location.badgeparts") + "/badgepart_" + map.getValue().valueB.replace(".gif", ".png"))); } } } } } } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); return false; } @@ -157,7 +161,7 @@ public class BadgeImager { if (outputFile.exists()) return; } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); + LOGGER.error("Caught exception", e); return; } @@ -235,7 +239,7 @@ public class BadgeImager { try { ImageIO.write(image, "PNG", outputFile); } catch (Exception e) { - Emulator.getLogging().logErrorLine("Failed to generate guild badge: " + outputFile + ".png Make sure the output folder exists and is writable!"); + LOGGER.error("Failed to generate guild badge: {}.png Make sure the output folder exists and is writable!", outputFile); } graphics.dispose(); From 89ff26f21b45154a8d562b608dcbf905717c795e Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Mon, 4 May 2020 22:24:09 +0200 Subject: [PATCH 053/215] More logging progress --- .../achievements/AchievementManager.java | 27 ++--- .../achievements/TalentTrackLevel.java | 17 +-- .../com/eu/habbo/habbohotel/bots/Bot.java | 6 +- .../eu/habbo/habbohotel/bots/BotManager.java | 28 +++-- .../eu/habbo/habbohotel/bots/ButlerBot.java | 5 +- .../habbo/habbohotel/catalog/CatalogItem.java | 13 ++- .../catalog/CatalogLimitedConfiguration.java | 10 +- .../habbo/habbohotel/catalog/CatalogPage.java | 9 +- .../eu/habbo/habbohotel/catalog/Voucher.java | 8 +- .../catalog/layouts/RoomBundleLayout.java | 10 +- .../catalog/marketplace/MarketPlace.java | 22 ++-- .../catalog/marketplace/MarketPlaceOffer.java | 10 +- .../commands/AddYoutubePlaylistCommand.java | 6 +- .../habbohotel/commands/BadgeCommand.java | 6 +- .../habbohotel/commands/EnableCommand.java | 6 +- .../commands/FilterWordCommand.java | 6 +- .../commands/RoomBundleCommand.java | 6 +- .../habbohotel/crafting/CraftingManager.java | 9 +- .../com/eu/habbo/habbohotel/games/Game.java | 6 +- .../games/battlebanzai/BattleBanzaiGame.java | 6 +- .../habbohotel/games/freeze/FreezeGame.java | 6 +- .../com/eu/habbo/habbohotel/guilds/Guild.java | 7 +- .../habbohotel/guilds/forums/ForumThread.java | 14 ++- .../guilds/forums/ForumThreadComment.java | 9 +- .../habbohotel/hotelview/HallOfFame.java | 5 +- .../habbo/habbohotel/hotelview/NewsList.java | 6 +- .../habbohotel/items/CrackableReward.java | 8 +- .../habbohotel/items/RandomStateParams.java | 7 +- .../habbohotel/items/YoutubeManager.java | 13 ++- .../interactions/InteractionColorPlate.java | 7 +- .../interactions/InteractionDefault.java | 7 +- .../items/interactions/InteractionGift.java | 8 +- .../interactions/InteractionMusicDisc.java | 10 +- .../InteractionRentableSpace.java | 8 +- .../items/interactions/InteractionWired.java | 5 +- .../InteractionWiredHighscore.java | 12 +- .../games/InteractionGameTimer.java | 8 +- .../WiredConditionHabboHasHandItem.java | 7 +- .../wired/effects/WiredEffectMatchFurni.java | 6 +- .../wired/effects/WiredEffectToggleFurni.java | 6 +- .../effects/WiredEffectToggleRandom.java | 6 +- .../interactions/wired/extra/WiredBlob.java | 10 +- .../triggers/WiredTriggerBotReachedFurni.java | 6 +- .../habbo/habbohotel/messenger/Message.java | 6 +- .../habbo/habbohotel/messenger/Messenger.java | 31 +++--- .../habbohotel/messenger/MessengerBuddy.java | 9 +- .../habbo/habbohotel/modtool/ModToolBan.java | 6 +- .../habbohotel/modtool/ModToolManager.java | 45 ++++---- .../habbohotel/modtool/ModToolSanctions.java | 17 +-- .../habbo/habbohotel/modtool/WordFilter.java | 10 +- .../permissions/PermissionsManager.java | 10 +- .../eu/habbo/habbohotel/pets/GnomePet.java | 6 +- .../eu/habbo/habbohotel/pets/HorsePet.java | 6 +- .../habbohotel/pets/MonsterplantPet.java | 6 +- .../com/eu/habbo/habbohotel/pets/Pet.java | 9 +- .../eu/habbo/habbohotel/pets/PetManager.java | 42 +++---- .../habbo/habbohotel/polls/PollManager.java | 8 +- .../habbohotel/rooms/CustomRoomLayout.java | 6 +- .../com/eu/habbo/habbohotel/rooms/Room.java | 105 +++++++++--------- .../eu/habbo/habbohotel/rooms/RoomBan.java | 14 +-- .../eu/habbo/habbohotel/rooms/RoomLayout.java | 5 +- .../habbo/habbohotel/rooms/RoomPromotion.java | 5 +- .../eu/habbo/habbohotel/rooms/RoomTrade.java | 5 +- .../eu/habbo/habbohotel/rooms/RoomUnit.java | 7 +- .../habbo/habbohotel/rooms/TraxManager.java | 13 ++- .../com/eu/habbo/habbohotel/users/Habbo.java | 13 ++- .../eu/habbo/habbohotel/users/HabboBadge.java | 5 +- .../eu/habbo/habbohotel/users/HabboInfo.java | 26 +++-- .../habbohotel/users/HabboInventory.java | 18 +-- .../eu/habbo/habbohotel/users/HabboItem.java | 14 ++- .../users/HabboNavigatorWindowSettings.java | 7 +- .../eu/habbo/habbohotel/users/HabboStats.java | 21 ++-- .../users/cache/HabboOfferPurchase.java | 5 +- .../users/inventory/BadgesComponent.java | 12 +- .../users/inventory/BotsComponent.java | 5 +- .../users/inventory/EffectsComponent.java | 15 ++- .../users/inventory/ItemsComponent.java | 12 +- .../users/inventory/PetsComponent.java | 5 +- .../users/inventory/WardrobeComponent.java | 7 +- .../habbo/habbohotel/wired/WiredHandler.java | 12 +- .../highscores/WiredHighscoreManager.java | 10 +- .../camera/CameraPublishToWebEvent.java | 6 +- .../catalog/CatalogBuyItemAsGiftEvent.java | 10 +- .../catalog/marketplace/SellItemEvent.java | 8 +- .../incoming/friends/FriendRequestEvent.java | 6 +- .../incoming/guardians/GuardianVoteEvent.java | 6 +- .../incoming/guilds/RequestGuildBuyEvent.java | 6 +- .../guilds/forums/GuildForumListEvent.java | 8 +- .../incoming/handshake/SecureLoginEvent.java | 6 +- .../hotelview/HotelViewDataEvent.java | 7 +- .../inventory/RequestInventoryItemsEvent.java | 7 +- .../navigator/RequestCreateRoomEvent.java | 8 +- .../navigator/RequestDeleteRoomEvent.java | 8 +- .../RequestNewNavigatorRoomsEvent.java | 8 +- .../incoming/polls/AnswerPollEvent.java | 6 +- .../incoming/polls/CancelPollEvent.java | 6 +- .../incoming/rooms/RoomSettingsSaveEvent.java | 6 +- .../rooms/items/RedeemClothingEvent.java | 8 +- .../incoming/rooms/items/RedeemItemEvent.java | 14 ++- .../items/SavePostItStickyPoleEvent.java | 6 +- .../rooms/items/ToggleFloorItemEvent.java | 8 +- .../rooms/items/UseRandomStateItemEvent.java | 7 +- .../youtube/YoutubeRequestPlaylists.java | 6 +- .../rooms/pets/CompostMonsterplantEvent.java | 6 +- .../rooms/pets/HorseRemoveSaddleEvent.java | 8 +- .../rooms/users/RoomUserShoutEvent.java | 6 +- .../rooms/users/RoomUserTalkEvent.java | 6 +- .../rooms/users/RoomUserWalkEvent.java | 6 +- .../rooms/users/RoomUserWhisperEvent.java | 6 +- .../users/ConfirmChangeNameEvent.java | 6 +- .../incoming/users/RequestUserDataEvent.java | 6 +- .../incoming/users/UserSaveLookEvent.java | 6 +- .../achievements/AchievementListComposer.java | 6 +- .../catalog/CatalogPagesListComposer.java | 6 +- .../MarketplaceOwnItemsComposer.java | 6 +- .../outgoing/friends/FriendsComposer.java | 7 +- .../guilds/forums/GuildForumDataComposer.java | 6 +- .../inventory/InventoryItemsComposer.java | 7 +- .../modtool/ModToolUserInfoComposer.java | 6 +- .../navigator/PrivateRoomsComposer.java | 7 +- .../users/ProfileFriendsComposer.java | 9 +- .../outgoing/users/UserCurrencyComposer.java | 6 +- .../outgoing/users/UserProfileComposer.java | 6 +- .../habbo/messages/rcon/ExecuteCommand.java | 6 +- .../com/eu/habbo/messages/rcon/GiveBadge.java | 6 +- .../eu/habbo/messages/rcon/GiveCredits.java | 6 +- .../eu/habbo/messages/rcon/GivePixels.java | 6 +- .../eu/habbo/messages/rcon/GivePoints.java | 6 +- .../eu/habbo/messages/rcon/GiveRespect.java | 6 +- .../habbo/messages/rcon/GiveUserClothing.java | 6 +- .../eu/habbo/messages/rcon/IgnoreUser.java | 6 +- .../com/eu/habbo/messages/rcon/MuteUser.java | 6 +- .../com/eu/habbo/messages/rcon/SendGift.java | 5 +- .../com/eu/habbo/messages/rcon/SetMotto.java | 6 +- .../eu/habbo/messages/rcon/UpdateUser.java | 5 +- .../camera/CameraPacketHandler.java | 7 +- .../decoders/GameMessageHandler.java | 16 +-- .../habbo/threading/HabboExecutorService.java | 10 +- .../RejectedExecutionHandlerImpl.java | 6 +- .../com/eu/habbo/threading/ThreadPooling.java | 3 +- .../habbo/threading/runnables/OpenGift.java | 6 +- .../runnables/QueryDeleteHabboBadge.java | 6 +- .../runnables/QueryDeleteHabboItem.java | 6 +- .../runnables/QueryDeleteHabboItems.java | 6 +- .../threading/runnables/RoomUnitTeleport.java | 7 +- .../RoomUnitTeleportWalkToAction.java | 6 +- .../RoomUnitVendingMachineAction.java | 6 +- .../threading/runnables/SaveScoreForTeam.java | 6 +- .../runnables/TeleportInteraction.java | 6 +- .../runnables/UpdateModToolIssue.java | 6 +- .../freeze/FreezeHandleSnowballExplosion.java | 6 +- .../runnables/hopper/HopperActionTwo.java | 6 +- .../runnables/teleport/TeleportActionTwo.java | 6 +- 153 files changed, 987 insertions(+), 448 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java b/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java index a00a79cf..9de60de5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java @@ -18,20 +18,21 @@ import com.eu.habbo.plugin.events.users.achievements.UserAchievementLeveledEvent import com.eu.habbo.plugin.events.users.achievements.UserAchievementProgressEvent; import gnu.trove.map.hash.THashMap; import gnu.trove.procedure.TObjectIntProcedure; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.*; import java.util.LinkedHashMap; import java.util.Map; public class AchievementManager { + private static final Logger LOGGER = LoggerFactory.getLogger(AchievementManager.class); + public static boolean TALENTTRACK_ENABLED = false; - private final THashMap achievements; - private final THashMap> talentTrackLevels; - public AchievementManager() { this.achievements = new THashMap<>(); this.talentTrackLevels = new THashMap<>(); @@ -58,7 +59,7 @@ public class AchievementManager { statement.setInt(4, amount); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } @@ -140,7 +141,7 @@ public class AchievementManager { try { badge = habbo.getInventory().getBadgesComponent().getBadge(("ACH_" + achievement.name + oldLevel.level).toLowerCase()); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); return; } } @@ -203,7 +204,7 @@ public class AchievementManager { statement.setInt(3, 1); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } @@ -217,7 +218,7 @@ public class AchievementManager { } statement.executeBatch(); } 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) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return 0; @@ -254,9 +255,9 @@ public class AchievementManager { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL 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) { - logger.error("Caught SQL exception", e); - Emulator.getLogging().logErrorLine("Achievement Manager -> Failed to load!"); + LOGGER.error("Caught SQL exception", e); + LOGGER.error("Achievement Manager -> Failed to load!"); return; } } - logger.info("Achievement Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); + LOGGER.info("Achievement Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); } public Achievement getAchievement(String name) { diff --git a/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java b/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java index e104c4fa..e491523f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java +++ b/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java @@ -5,27 +5,20 @@ import com.eu.habbo.habbohotel.items.Item; import gnu.trove.map.TObjectIntMap; import gnu.trove.map.hash.TObjectIntHashMap; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.ResultSet; import java.sql.SQLException; public class TalentTrackLevel { + private static final Logger LOGGER = LoggerFactory.getLogger(TalentTrackLevel.class); public TalentTrackType type; - - public int level; - - public TObjectIntMap achievements; - - public THashSet items; - - public String[] perks; - - public String[] badges; public TalentTrackLevel(ResultSet set) throws SQLException { @@ -46,7 +39,7 @@ public class TalentTrackLevel { if (achievement != null) { this.achievements.put(achievement, Integer.valueOf(achievementLevels[i])); } 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) { this.items.add(item); } 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); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java b/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java index 197ecd4c..8cedc5ff 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java @@ -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.BotWhisperEvent; import com.eu.habbo.threading.runnables.BotFollowHabbo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -21,6 +23,8 @@ import java.util.ArrayList; import java.util.Arrays; 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 String[] PLACEMENT_MESSAGES = "Yo!;Hello I'm a real party animal!;Hello!".split(";"); @@ -155,7 +159,7 @@ public class Bot implements Runnable { statement.execute(); this.needsUpdate = false; } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java index 3d5754dc..e1b88271 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.*; import com.eu.habbo.habbohotel.users.Habbo; 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.BubbleAlertComposer; 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.BotPlacedEvent; import gnu.trove.map.hash.THashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.lang.reflect.Method; import java.sql.*; import java.util.Map; public class BotManager { + private static final Logger LOGGER = LoggerFactory.getLogger(BotManager.class); final private static THashMap> botDefenitions = new THashMap<>(); public static int MINIMUM_CHAT_SPEED = 7; @@ -38,7 +42,7 @@ public class BotManager { 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 botClazz) throws Exception { @@ -58,10 +62,10 @@ public class BotManager { m.setAccessible(true); m.invoke(null); } 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; } 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; } } @@ -88,12 +92,12 @@ public class BotManager { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return bot; @@ -143,7 +147,7 @@ public class BotManager { try { topItem.onWalkOn(bot.getRoomUnit(), room, null); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } bot.cycle(false); @@ -193,11 +197,11 @@ public class BotManager { if (botClazz != null) return botClazz.getDeclaredConstructor(ResultSet.class).newInstance(set); else - Emulator.getLogging().logErrorLine("Unknown Bot Type: " + type); + LOGGER.error("Unknown Bot Type: " + type); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } return null; @@ -208,7 +212,7 @@ public class BotManager { statement.setInt(1, bot.getId()); return statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return false; @@ -221,9 +225,9 @@ public class BotManager { m.setAccessible(true); m.invoke(null); } 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) { - 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()); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/ButlerBot.java b/src/main/java/com/eu/habbo/habbohotel/bots/ButlerBot.java index 11c82cc3..d776bee9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/ButlerBot.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/ButlerBot.java @@ -8,6 +8,8 @@ import com.eu.habbo.threading.runnables.RoomUnitGiveHanditem; import com.eu.habbo.threading.runnables.RoomUnitWalkToRoomUnit; import gnu.trove.map.hash.THashMap; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.ResultSet; @@ -19,6 +21,7 @@ import java.util.List; import java.util.Map; public class ButlerBot extends Bot { + private static final Logger LOGGER = LoggerFactory.getLogger(ButlerBot.class); public static THashMap, Integer> serveItems = new THashMap<>(); public ButlerBot(ResultSet set) throws SQLException { @@ -43,7 +46,7 @@ public class ButlerBot extends Bot { serveItems.put(ks, set.getInt("item")); } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java index 21e02620..c8d015e6 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java @@ -3,9 +3,12 @@ package com.eu.habbo.habbohotel.catalog; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.FurnitureType; 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.ServerMessage; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -14,7 +17,7 @@ import java.sql.SQLException; import java.util.HashMap; public class CatalogItem implements ISerialize, Runnable, Comparable { - + private static final Logger LOGGER = LoggerFactory.getLogger(CatalogItem.class); int id; int limitedStack; private int pageId; @@ -211,7 +214,7 @@ public class CatalogItem implements ISerialize, Runnable, Comparable 0) { @@ -258,8 +261,8 @@ public class CatalogItem implements ISerialize, Runnable, Comparable limitedNumbers; private int totalSet; @@ -47,7 +51,7 @@ public class CatalogLimitedConfiguration implements Runnable { statement.setInt(5, item.getLimitedSells()); statement.execute(); } 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(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } this.totalSet += amount; @@ -98,7 +102,7 @@ public class CatalogLimitedConfiguration implements Runnable { statement.setInt(3, this.itemId); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPage.java b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPage.java index 53fab1c3..b161c201 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPage.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPage.java @@ -1,6 +1,5 @@ package com.eu.habbo.habbohotel.catalog; -import com.eu.habbo.Emulator; import com.eu.habbo.messages.ISerialize; import com.eu.habbo.messages.ServerMessage; import gnu.trove.TCollections; @@ -8,12 +7,16 @@ import gnu.trove.list.array.TIntArrayList; import gnu.trove.map.TIntObjectMap; import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.TIntObjectHashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; public abstract class CatalogPage implements Comparable, ISerialize { + private static final Logger LOGGER = LoggerFactory.getLogger(CatalogPage.class); + protected final TIntArrayList offerIds = new TIntArrayList(); protected final THashMap childPages = new THashMap<>(); private final TIntObjectMap catalogItems = TCollections.synchronizedMap(new TIntObjectHashMap<>()); @@ -70,8 +73,8 @@ public abstract class CatalogPage implements Comparable, ISerialize try { this.included.add(Integer.valueOf(id)); } catch (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("Caught exception", e); + LOGGER.error("Failed to parse includes column value of (" + id + ") for catalog page (" + this.id + ")"); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/Voucher.java b/src/main/java/com/eu/habbo/habbohotel/catalog/Voucher.java index cf37a8e2..b5e93b13 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/Voucher.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/Voucher.java @@ -1,6 +1,8 @@ package com.eu.habbo.habbohotel.catalog; import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -10,6 +12,8 @@ import java.util.ArrayList; import java.util.List; public class Voucher { + private static final Logger LOGGER = LoggerFactory.getLogger(Voucher.class); + public final int id; public final String code; public final int credits; @@ -41,7 +45,7 @@ public class Voucher { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } @@ -64,7 +68,7 @@ public class Voucher { statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/RoomBundleLayout.java b/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/RoomBundleLayout.java index e2bb6ed4..680d3e9b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/RoomBundleLayout.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/RoomBundleLayout.java @@ -13,11 +13,15 @@ import com.eu.habbo.messages.outgoing.navigator.CanCreateRoomComposer; import gnu.trove.map.TIntObjectMap; import gnu.trove.map.hash.THashMap; import gnu.trove.procedure.TObjectProcedure; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.*; import java.util.Map; public class RoomBundleLayout extends SingleBundle { + private static final Logger LOGGER = LoggerFactory.getLogger(RoomBundleLayout.class); + public int roomId; public Room room; private int lastUpdate = 0; @@ -43,7 +47,7 @@ public class RoomBundleLayout extends SingleBundle { if (this.room != null) this.room.preventUnloading = true; } 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.execute(); } 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) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } Room r = Emulator.getGameEnvironment().getRoomManager().loadRoom(roomId); diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java index ca7ba320..f18ad446 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java @@ -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.MarketPlaceItemSoldEvent; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -26,6 +28,8 @@ import java.util.List; public class MarketPlace { + private static final Logger LOGGER = LoggerFactory.getLogger(MarketPlace.class); + //Configuration. Loaded from database & updated accordingly. public static boolean MARKETPLACE_ENABLED = true; @@ -43,7 +47,7 @@ public class MarketPlace { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return offers; @@ -101,7 +105,7 @@ public class MarketPlace { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); habbo.getClient().sendResponse(new MarketplaceCancelSaleComposer(offer, false)); } } @@ -163,7 +167,7 @@ public class MarketPlace { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return offers; @@ -193,7 +197,7 @@ public class MarketPlace { message.appendInt(1); message.appendInt(itemId); } 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"); } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return number; @@ -226,7 +230,7 @@ public class MarketPlace { avg = set.getInt("avg"); } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return calculateCommision(avg); @@ -294,7 +298,7 @@ public class MarketPlace { } } } 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) { - 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.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlaceOffer.java b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlaceOffer.java index 4bfb6307..196544e7 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlaceOffer.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlaceOffer.java @@ -5,10 +5,14 @@ import com.eu.habbo.habbohotel.items.FurnitureType; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.*; public class MarketPlaceOffer implements Runnable { + private static final Logger LOGGER = LoggerFactory.getLogger(MarketPlaceOffer.class); + public int avarage; public int count; private int offerId; @@ -66,7 +70,7 @@ public class MarketPlaceOffer implements Runnable { } } } 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) { - 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.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/AddYoutubePlaylistCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/AddYoutubePlaylistCommand.java index 28fe8339..d590bb0e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/AddYoutubePlaylistCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/AddYoutubePlaylistCommand.java @@ -3,12 +3,16 @@ package com.eu.habbo.habbohotel.commands; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.YoutubeManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class AddYoutubePlaylistCommand extends Command { + private static final Logger LOGGER = LoggerFactory.getLogger(AddYoutubePlaylistCommand.class); + public AddYoutubePlaylistCommand() { 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(); } 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")); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/BadgeCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/BadgeCommand.java index 31f54aac..1328ed19 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/BadgeCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/BadgeCommand.java @@ -6,6 +6,8 @@ import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.users.HabboManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -13,6 +15,8 @@ import java.sql.ResultSet; import java.sql.SQLException; public class BadgeCommand extends Command { + private static final Logger LOGGER = LoggerFactory.getLogger(BadgeCommand.class); + public BadgeCommand() { super("cmd_badge", Emulator.getTexts().getValue("commands.keys.cmd_badge").split(";")); } @@ -72,7 +76,7 @@ public class BadgeCommand extends Command { return true; } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/EnableCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/EnableCommand.java index b2a9cef6..c56842b6 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/EnableCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/EnableCommand.java @@ -4,8 +4,12 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class EnableCommand extends Command { + private static final Logger LOGGER = LoggerFactory.getLogger(EnableCommand.class); + public EnableCommand() { super("cmd_enable", Emulator.getTexts().getValue("commands.keys.cmd_enable").split(";")); } @@ -38,7 +42,7 @@ public class EnableCommand extends Command { } } } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/FilterWordCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/FilterWordCommand.java index 73cfb7e5..9e208a0a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/FilterWordCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/FilterWordCommand.java @@ -4,12 +4,16 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.modtool.WordFilter; import com.eu.habbo.habbohotel.modtool.WordFilterWord; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class FilterWordCommand extends Command { + private static final Logger LOGGER = LoggerFactory.getLogger(FilterWordCommand.class); + public FilterWordCommand() { 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.execute(); } 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")); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/RoomBundleCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/RoomBundleCommand.java index 2fd4031e..3b3f5161 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/RoomBundleCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/RoomBundleCommand.java @@ -7,10 +7,14 @@ import com.eu.habbo.habbohotel.catalog.CatalogPageLayouts; import com.eu.habbo.habbohotel.catalog.layouts.RoomBundleLayout; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.*; public class RoomBundleCommand extends Command { + private static final Logger LOGGER = LoggerFactory.getLogger(RoomBundleCommand.class); + public RoomBundleCommand() { super("cmd_bundle", Emulator.getTexts().getValue("commands.keys.cmd_bundle").split(";")); } @@ -62,7 +66,7 @@ public class RoomBundleCommand extends Command { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } ((RoomBundleLayout) page).loadItems(gameClient.getHabbo().getHabboInfo().getCurrentRoom()); diff --git a/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingManager.java b/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingManager.java index abdbf28e..9fe611a4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingManager.java @@ -4,6 +4,8 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.Item; 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.PreparedStatement; @@ -11,6 +13,7 @@ import java.sql.ResultSet; import java.sql.SQLException; public class CraftingManager { + private static final Logger LOGGER = LoggerFactory.getLogger(CraftingManager.class); private final THashMap altars; @@ -53,14 +56,14 @@ public class CraftingManager { recipe.addIngredient(ingredientItem, set.getInt("crafting_recipes_ingredients.amount")); altar.addIngredient(ingredientItem); } 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) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } @@ -114,7 +117,7 @@ public class CraftingManager { } statement.executeBatch(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } this.altars.clear(); diff --git a/src/main/java/com/eu/habbo/habbohotel/games/Game.java b/src/main/java/com/eu/habbo/habbohotel/games/Game.java index 619423e3..f8aa6c37 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/Game.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/Game.java @@ -20,12 +20,14 @@ import com.eu.habbo.plugin.events.games.GameStartedEvent; import com.eu.habbo.plugin.events.games.GameStoppedEvent; import com.eu.habbo.threading.runnables.SaveScoreForTeam; import gnu.trove.map.hash.THashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.Map; import java.util.stream.Collectors; public abstract class Game implements Runnable { - + private static final Logger LOGGER = LoggerFactory.getLogger(Game.class); protected final THashMap teams = new THashMap<>(); protected final Room room; private final Class gameTeamClazz; @@ -73,7 +75,7 @@ public abstract class Game implements Runnable { return true; } } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } return false; diff --git a/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java b/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java index 094ee146..31a561b5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java @@ -17,12 +17,16 @@ import com.eu.habbo.messages.outgoing.rooms.users.RoomUserActionComposer; import com.eu.habbo.threading.runnables.BattleBanzaiTilesFlicker; import gnu.trove.map.hash.THashMap; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.*; import java.util.concurrent.Executors; import java.util.concurrent.ThreadPoolExecutor; public class BattleBanzaiGame extends Game { + private static final Logger LOGGER = LoggerFactory.getLogger(BattleBanzaiGame.class); + public static final int effectId = 32; @@ -149,7 +153,7 @@ public class BattleBanzaiGame extends Game { } } } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java b/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java index c44a7fa0..eb625350 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java @@ -23,11 +23,15 @@ import com.eu.habbo.threading.runnables.freeze.FreezeThrowSnowball; import gnu.trove.map.hash.THashMap; import gnu.trove.procedure.TObjectProcedure; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.HashMap; import java.util.Map; public class FreezeGame extends Game { + private static final Logger LOGGER = LoggerFactory.getLogger(FreezeGame.class); + public static final int effectId = 39; public static int POWER_UP_POINTS; @@ -261,7 +265,7 @@ public class FreezeGame extends Game { } } } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/Guild.java b/src/main/java/com/eu/habbo/habbohotel/guilds/Guild.java index f43e52b0..d77f6773 100644 --- a/src/main/java/com/eu/habbo/habbohotel/guilds/Guild.java +++ b/src/main/java/com/eu/habbo/habbohotel/guilds/Guild.java @@ -1,6 +1,8 @@ package com.eu.habbo.habbohotel.guilds; import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -8,6 +10,7 @@ import java.sql.ResultSet; import java.sql.SQLException; public class Guild implements Runnable { + private static final Logger LOGGER = LoggerFactory.getLogger(Guild.class); public boolean needsUpdate; public int lastRequested = Emulator.getIntUnixTimestamp(); private int id; @@ -91,7 +94,7 @@ public class Guild implements Runnable { } } } 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; } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java index a1c7227a..5107be53 100644 --- a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java +++ b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java @@ -9,11 +9,15 @@ import com.eu.habbo.plugin.events.guilds.forums.GuildForumThreadBeforeCreated; import com.eu.habbo.plugin.events.guilds.forums.GuildForumThreadCreated; import gnu.trove.map.hash.THashMap; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.*; import java.util.*; public class ForumThread implements Runnable, ISerialize { + private static final Logger LOGGER = LoggerFactory.getLogger(ForumThread.class); + private final static THashMap> guildThreadsCache = new THashMap<>(); private final static THashMap forumThreadsCache = new THashMap<>(); @@ -108,7 +112,7 @@ public class ForumThread implements Runnable, ISerialize { Emulator.getPluginManager().fireEvent(new GuildForumThreadCreated(createdThread)); } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return createdThread; @@ -156,7 +160,7 @@ public class ForumThread implements Runnable, ISerialize { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return threads; @@ -195,7 +199,7 @@ public class ForumThread implements Runnable, ISerialize { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return foundThread; @@ -337,7 +341,7 @@ public class ForumThread implements Runnable, ISerialize { addComment(comment); } } 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; } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThreadComment.java b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThreadComment.java index 9ff93d55..1be9631a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThreadComment.java +++ b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThreadComment.java @@ -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.GuildForumThreadCommentCreated; import gnu.trove.map.hash.THashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.*; public class ForumThreadComment implements Runnable, ISerialize { + private static final Logger LOGGER = LoggerFactory.getLogger(ForumThreadComment.class); private static THashMap forumCommentsCache = new THashMap<>(); private final int commentId; @@ -64,7 +67,7 @@ public class ForumThreadComment implements Runnable, ISerialize { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return foundComment; @@ -103,7 +106,7 @@ public class ForumThreadComment implements Runnable, ISerialize { Emulator.getPluginManager().fireEvent(new GuildForumThreadCommentCreated(createdComment)); } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return createdComment; @@ -200,7 +203,7 @@ public class ForumThreadComment implements Runnable, ISerialize { this.needsUpdate = false; } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFame.java b/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFame.java index ef7f1986..a4c398b8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFame.java +++ b/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFame.java @@ -2,6 +2,8 @@ package com.eu.habbo.habbohotel.hotelview; import com.eu.habbo.Emulator; import gnu.trove.map.hash.THashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.ResultSet; @@ -9,6 +11,7 @@ import java.sql.SQLException; import java.sql.Statement; public class HallOfFame { + private static final Logger LOGGER = LoggerFactory.getLogger(HallOfFame.class); private final THashMap winners = new THashMap<>(); @@ -32,7 +35,7 @@ public class HallOfFame { this.winners.put(winner.getId(), winner); } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsList.java b/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsList.java index 623cb2c5..b3bebc4f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsList.java +++ b/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsList.java @@ -1,6 +1,8 @@ package com.eu.habbo.habbohotel.hotelview; import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.ResultSet; @@ -9,6 +11,8 @@ import java.sql.Statement; import java.util.ArrayList; public class NewsList { + private static final Logger LOGGER = LoggerFactory.getLogger(NewsList.class); + private final ArrayList newsWidgets; public NewsList() { @@ -25,7 +29,7 @@ public class NewsList { this.newsWidgets.add(new NewsWidget(set)); } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/CrackableReward.java b/src/main/java/com/eu/habbo/habbohotel/items/CrackableReward.java index 727fb47a..60497794 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/CrackableReward.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/CrackableReward.java @@ -1,6 +1,8 @@ package com.eu.habbo.habbohotel.items; import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.ResultSet; import java.sql.SQLException; @@ -9,6 +11,8 @@ import java.util.HashMap; import java.util.Map; public class CrackableReward { + private static final Logger LOGGER = LoggerFactory.getLogger(CrackableReward.class); + public final int itemId; public final int count; public final Map> prizes; @@ -44,7 +48,7 @@ public class CrackableReward { itemId = Integer.valueOf(prize.split(":")[0]); chance = Integer.valueOf(prize.split(":")[1]); } 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 { 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.totalChance += chance; } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/RandomStateParams.java b/src/main/java/com/eu/habbo/habbohotel/items/RandomStateParams.java index 931be676..bc9662a3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/RandomStateParams.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/RandomStateParams.java @@ -1,10 +1,13 @@ package com.eu.habbo.habbohotel.items; -import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.Arrays; public class RandomStateParams { + private static final Logger LOGGER = LoggerFactory.getLogger(RandomStateParams.class); + private int states = -1; private int delay = -1; @@ -22,7 +25,7 @@ public class RandomStateParams { this.delay = Integer.parseInt(keyValue[1]); break; default: - Emulator.getLogging().logDebugLine("RandomStateParams: unknown key: " + keyValue[0]); + LOGGER.warn("RandomStateParams: unknown key: " + keyValue[0]); break; } }); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/YoutubeManager.java b/src/main/java/com/eu/habbo/habbohotel/items/YoutubeManager.java index e3b680cd..d2f3d3bf 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/YoutubeManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/YoutubeManager.java @@ -6,12 +6,13 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import gnu.trove.map.hash.THashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.net.ssl.HttpsURLConnection; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; -import java.net.MalformedURLException; import java.net.URL; import java.sql.*; import java.util.ArrayList; @@ -20,6 +21,8 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; public class YoutubeManager { + private static final Logger LOGGER = LoggerFactory.getLogger(YoutubeManager.class); + public class YoutubeVideo { private final String id; private final int duration; @@ -80,7 +83,7 @@ public class YoutubeManager { Emulator.getThreading().run(() -> { 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 (ResultSet set = statement.executeQuery()) { @@ -95,7 +98,7 @@ public class YoutubeManager { if (playlist != null) { playlists.add(playlist); } else { - Emulator.getLogging().logErrorLine("Failed to load YouTube playlist: " + playlistId); + LOGGER.error("Failed to load YouTube playlist: " + playlistId); } this.playlists.put(itemId, playlists); @@ -103,7 +106,7 @@ public class YoutubeManager { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } youtubeDataLoaderPool.shutdown(); @@ -113,7 +116,7 @@ public class YoutubeManager { e.printStackTrace(); } - logger.info("YouTube Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); + LOGGER.info("YouTube Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); }); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorPlate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorPlate.java index cd089ec3..133e83c9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorPlate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorPlate.java @@ -1,14 +1,17 @@ package com.eu.habbo.habbohotel.items.interactions; -import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomUnit; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.ResultSet; import java.sql.SQLException; public class InteractionColorPlate extends InteractionDefault { + private static final Logger LOGGER = LoggerFactory.getLogger(InteractionColorPlate.class); + public InteractionColorPlate(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); } @@ -41,7 +44,7 @@ public class InteractionColorPlate extends InteractionDefault { try { state = Integer.valueOf(this.getExtradata()); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } state += amount; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDefault.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDefault.java index 95308f40..1db3a1d2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDefault.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDefault.java @@ -1,6 +1,5 @@ package com.eu.habbo.habbohotel.items.interactions; -import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.gameclients.GameClient; 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.wired.WiredEffectType; import com.eu.habbo.messages.ServerMessage; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.ResultSet; import java.sql.SQLException; public class InteractionDefault extends HabboItem { + private static final Logger LOGGER = LoggerFactory.getLogger(InteractionDefault.class); + public InteractionDefault(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); } @@ -74,7 +77,7 @@ public class InteractionDefault extends HabboItem { try { currentState = Integer.valueOf(this.getExtradata()); } 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()); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGift.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGift.java index 869b59a3..41fb4dc1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGift.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGift.java @@ -8,11 +8,15 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.ServerMessage; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.ResultSet; import java.sql.SQLException; public class InteractionGift extends HabboItem { + private static final Logger LOGGER = LoggerFactory.getLogger(InteractionGift.class); + public boolean explode = false; private int[] itemId; private int colorId = 0; @@ -28,7 +32,7 @@ public class InteractionGift extends HabboItem { try { this.loadData(); } 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 { this.loadData(); } catch (Exception e) { - Emulator.getLogging().logDebugLine("Incorrect extradata for gift with ID " + this.getId()); + LOGGER.warn("Incorrect extradata for gift with ID " + this.getId()); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMusicDisc.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMusicDisc.java index 9a163257..f001fc20 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMusicDisc.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMusicDisc.java @@ -1,17 +1,19 @@ package com.eu.habbo.habbohotel.items.interactions; -import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.users.HabboItem; 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.SQLException; public class InteractionMusicDisc extends HabboItem { + private static final Logger LOGGER = LoggerFactory.getLogger(InteractionMusicDisc.class); + private int songId; public InteractionMusicDisc(ResultSet set, Item baseItem) throws SQLException { @@ -23,7 +25,7 @@ public class InteractionMusicDisc extends HabboItem { try { this.songId = Integer.valueOf(stuff[6]); } 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 { this.songId = Integer.valueOf(stuff[6]); } 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!"); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRentableSpace.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRentableSpace.java index d1ee8065..48a4d35a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRentableSpace.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRentableSpace.java @@ -12,6 +12,8 @@ import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.rooms.items.rentablespaces.RentableSpaceInfoComposer; import com.eu.habbo.threading.runnables.ClearRentedSpace; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.awt.*; import java.sql.Connection; @@ -20,6 +22,8 @@ import java.sql.ResultSet; import java.sql.SQLException; public class InteractionRentableSpace extends HabboItem { + private static final Logger LOGGER = LoggerFactory.getLogger(InteractionRentableSpace.class); + private int renterId; private String renterName; private int endTimestamp; @@ -50,7 +54,7 @@ public class InteractionRentableSpace extends HabboItem { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } else { @@ -180,7 +184,7 @@ public class InteractionRentableSpace extends HabboItem { statement.setInt(1, zero); statement.setInt(2, zero); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java index e3c9c702..a465367c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java @@ -7,6 +7,8 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -14,6 +16,7 @@ import java.sql.ResultSet; import java.sql.SQLException; public abstract class InteractionWired extends HabboItem { + private static final Logger LOGGER = LoggerFactory.getLogger(InteractionWired.class); private long cooldown; InteractionWired(ResultSet set, Item baseItem) throws SQLException { @@ -71,7 +74,7 @@ public abstract class InteractionWired extends HabboItem { statement.setInt(2, this.getId()); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } super.run(); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredHighscore.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredHighscore.java index 88a196ac..9708c565 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredHighscore.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredHighscore.java @@ -3,19 +3,23 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; 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.RoomUnit; import com.eu.habbo.habbohotel.users.HabboItem; 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.messages.ServerMessage; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; public class InteractionWiredHighscore extends HabboItem { + private static final Logger LOGGER = LoggerFactory.getLogger(InteractionWiredHighscore.class); + public WiredHighscoreScoreType scoreType; public WiredHighscoreClearType clearType; @@ -33,7 +37,7 @@ public class InteractionWiredHighscore extends HabboItem { this.scoreType = WiredHighscoreScoreType.valueOf(name); this.clearType = WiredHighscoreClearType.values()[ctype]; } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } this.reloadData(); @@ -51,7 +55,7 @@ public class InteractionWiredHighscore extends HabboItem { this.scoreType = WiredHighscoreScoreType.valueOf(name); this.clearType = WiredHighscoreClearType.values()[ctype]; } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } this.reloadData(); @@ -83,7 +87,7 @@ public class InteractionWiredHighscore extends HabboItem { this.setExtradata(Math.abs(state - 1) + ""); room.updateItem(this); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java index 3b064dfa..6197b017 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java @@ -13,12 +13,16 @@ import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredTriggerType; import com.eu.habbo.messages.ServerMessage; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Arrays; 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 baseTime = 0; @@ -89,7 +93,7 @@ public class InteractionGameTimer extends HabboItem implements Runnable { } }).toArray(); } 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); game.initialise(); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java index 079ac0e0..e47107c3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java @@ -1,6 +1,5 @@ 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.interactions.InteractionWiredCondition; 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.messages.ClientMessage; import com.eu.habbo.messages.ServerMessage; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.ResultSet; import java.sql.SQLException; public class WiredConditionHabboHasHandItem extends InteractionWiredCondition { + private static final Logger LOGGER = LoggerFactory.getLogger(WiredConditionHabboHasHandItem.class); + public static final WiredConditionType type = WiredConditionType.ACTOR_HAS_HANDITEM; private int handItem; @@ -71,7 +74,7 @@ public class WiredConditionHabboHasHandItem extends InteractionWiredCondition { try { this.handItem = Integer.valueOf(set.getString("wired_data")); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java index b379fe9c..f4642bf5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java @@ -17,11 +17,15 @@ import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.ResultSet; import java.sql.SQLException; public class WiredEffectMatchFurni extends InteractionWiredEffect { + private static final Logger LOGGER = LoggerFactory.getLogger(WiredEffectMatchFurni.class); + private static final WiredEffectType type = WiredEffectType.MATCH_SSHOT; public boolean checkForWiredResetPermission = true; private THashSet settings; @@ -189,7 +193,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect { } } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java index 2605a4f8..e602c042 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java @@ -19,6 +19,8 @@ import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ServerMessage; import gnu.trove.procedure.TObjectProcedure; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.ResultSet; import java.sql.SQLException; @@ -26,6 +28,8 @@ import java.util.ArrayList; import java.util.List; public class WiredEffectToggleFurni extends InteractionWiredEffect { + private static final Logger LOGGER = LoggerFactory.getLogger(WiredEffectToggleFurni.class); + public static final WiredEffectType type = WiredEffectType.TOGGLE_STATE; private final THashSet 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()}); } } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java index 0caf0ef3..98b41137 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java @@ -17,6 +17,8 @@ import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ServerMessage; import gnu.trove.procedure.TObjectProcedure; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.ResultSet; import java.sql.SQLException; @@ -24,6 +26,8 @@ import java.util.ArrayList; import java.util.List; public class WiredEffectToggleRandom extends InteractionWiredEffect { + private static final Logger LOGGER = LoggerFactory.getLogger(WiredEffectToggleRandom.class); + public static final WiredEffectType type = WiredEffectType.TOGGLE_RANDOM; private final THashSet items = new THashSet<>(); @@ -120,7 +124,7 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect { item.setExtradata(Emulator.getRandom().nextInt(item.getBaseItem().getStateCount() + 1) + ""); room.updateItem(item); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } return true; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredBlob.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredBlob.java index b46c81c9..0017efe8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredBlob.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredBlob.java @@ -1,22 +1,24 @@ 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.games.GamePlayer; import com.eu.habbo.habbohotel.games.GameState; 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.interactions.InteractionDefault; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.wired.WiredEffectType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.ResultSet; import java.sql.SQLException; public class WiredBlob extends InteractionDefault { + private static final Logger LOGGER = LoggerFactory.getLogger(WiredBlob.class); + enum WiredBlobState { ACTIVE("0"), USED("1"); @@ -104,14 +106,14 @@ public class WiredBlob extends InteractionDefault { String[] params = this.getBaseItem().getCustomParams().split(","); 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; } try { this.POINTS_REWARD = Integer.parseInt(params[0]); } 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; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java index 56b98ebd..73c543c3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java @@ -14,6 +14,8 @@ import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ServerMessage; import gnu.trove.procedure.TObjectProcedure; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.ResultSet; import java.sql.SQLException; @@ -21,6 +23,8 @@ import java.util.ArrayList; import java.util.List; public class WiredTriggerBotReachedFurni extends InteractionWiredTrigger { + private static final Logger LOGGER = LoggerFactory.getLogger(WiredTriggerBotReachedFurni.class); + public final static WiredTriggerType type = WiredTriggerType.BOT_REACHED_STF; private THashSet items; @@ -157,7 +161,7 @@ public class WiredTriggerBotReachedFurni extends InteractionWiredTrigger { if (item != null) this.items.add(item); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/messenger/Message.java b/src/main/java/com/eu/habbo/habbohotel/messenger/Message.java index 5949ae4b..a081bfc5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/messenger/Message.java +++ b/src/main/java/com/eu/habbo/habbohotel/messenger/Message.java @@ -1,12 +1,16 @@ package com.eu.habbo.habbohotel.messenger; import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class Message implements Runnable { + private static final Logger LOGGER = LoggerFactory.getLogger(Message.class); + private final int fromId; private final int toId; private final int timestamp; @@ -31,7 +35,7 @@ public class Message implements Runnable { statement.setInt(4, this.timestamp); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java b/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java index 250a7a52..15ef797a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java +++ b/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java @@ -11,6 +11,8 @@ import com.eu.habbo.plugin.events.users.friends.UserAcceptFriendRequestEvent; import gnu.trove.map.hash.THashMap; import gnu.trove.set.hash.THashSet; import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -20,6 +22,9 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class Messenger { + + private static final Logger LOGGER = LoggerFactory.getLogger(Messenger.class); + //Configuration. Loaded from database & updated accordingly. public static boolean SAVE_PRIVATE_CHATS = false; public static int MAXIMUM_FRIENDS = 200; @@ -41,7 +46,7 @@ public class Messenger { statement.setInt(4, userOne); statement.execute(); } 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) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return users; } @@ -85,7 +90,7 @@ public class Messenger { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return false; @@ -102,7 +107,7 @@ public class Messenger { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return false; @@ -114,7 +119,7 @@ public class Messenger { statement.setInt(2, userFrom); statement.executeUpdate(); } 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"); } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return count; @@ -157,7 +162,7 @@ public class Messenger { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return map; } @@ -213,7 +218,7 @@ public class Messenger { } } } 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) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return buddy; @@ -252,7 +257,7 @@ public class Messenger { } } } 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.executeUpdate(); } 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); return statement.executeUpdate(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return 0; @@ -345,7 +350,7 @@ public class Messenger { statement.setInt(3, Emulator.getIntUnixTimestamp()); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } Habbo habboTo = Emulator.getGameServer().getGameClientManager().getHabbo(userTo); diff --git a/src/main/java/com/eu/habbo/habbohotel/messenger/MessengerBuddy.java b/src/main/java/com/eu/habbo/habbohotel/messenger/MessengerBuddy.java index 2ce143bf..4a292b87 100644 --- a/src/main/java/com/eu/habbo/habbohotel/messenger/MessengerBuddy.java +++ b/src/main/java/com/eu/habbo/habbohotel/messenger/MessengerBuddy.java @@ -7,6 +7,8 @@ import com.eu.habbo.habbohotel.users.HabboGender; import com.eu.habbo.messages.ISerialize; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.friends.FriendChatMessageComposer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -14,6 +16,7 @@ import java.sql.ResultSet; import java.sql.SQLException; public class MessengerBuddy implements Runnable, ISerialize { + private static final Logger LOGGER = LoggerFactory.getLogger(MessengerBuddy.class); private int id; private String username; @@ -44,7 +47,7 @@ public class MessengerBuddy implements Runnable, ISerialize { } } } 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.userOne = 0; } 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.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolBan.java b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolBan.java index e79c9ad3..3c8517da 100644 --- a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolBan.java +++ b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolBan.java @@ -1,6 +1,8 @@ package com.eu.habbo.habbohotel.modtool; import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -9,6 +11,8 @@ import java.sql.SQLException; import java.text.SimpleDateFormat; 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 int userId; public String ip; @@ -63,7 +67,7 @@ public class ModToolBan implements Runnable { statement.setInt(9, this.cfhTopic); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java index de887280..da144f97 100644 --- a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java @@ -1,6 +1,7 @@ package com.eu.habbo.habbohotel.modtool; import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.bots.BotManager; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.permissions.Permission; 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.set.hash.THashSet; import io.netty.channel.Channel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.net.InetSocketAddress; import java.sql.*; @@ -29,6 +32,8 @@ import java.util.List; import java.util.Map; public class ModToolManager { + private static final Logger LOGGER = LoggerFactory.getLogger(ModToolManager.class); + private final TIntObjectMap category; private final THashMap> presets; private final THashMap tickets; @@ -41,7 +46,7 @@ public class ModToolManager { this.tickets = new THashMap<>(); this.cfhCategories = new TIntObjectHashMap<>(); 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) { @@ -58,9 +63,9 @@ public class ModToolManager { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL 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.loadCfhCategories(connection); } 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) { - 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")); } } 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)); } } 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")))); } } 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) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return chatlogs; @@ -215,7 +220,7 @@ public class ModToolManager { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return chatlogs; @@ -235,7 +240,7 @@ public class ModToolManager { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return chatLogs; @@ -272,7 +277,7 @@ public class ModToolManager { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return chatlogs; @@ -290,7 +295,7 @@ public class ModToolManager { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return roomVisits; @@ -348,7 +353,7 @@ public class ModToolManager { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return roomVisits; @@ -378,7 +383,7 @@ public class ModToolManager { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return null; @@ -495,7 +500,7 @@ public class ModToolManager { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return ban; @@ -519,7 +524,7 @@ public class ModToolManager { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return banned; @@ -543,7 +548,7 @@ public class ModToolManager { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return false; @@ -557,7 +562,7 @@ public class ModToolManager { statement.execute(); return statement.getUpdateCount() > 0; } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return false; @@ -662,7 +667,7 @@ public class ModToolManager { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return total; diff --git a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolSanctions.java b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolSanctions.java index e909120a..3960d07e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolSanctions.java +++ b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolSanctions.java @@ -4,6 +4,8 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.plugin.events.sanctions.SanctionEvent; import gnu.trove.map.hash.THashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -13,6 +15,7 @@ import java.util.ArrayList; import java.util.Date; public class ModToolSanctions { + private static final Logger LOGGER = LoggerFactory.getLogger(ModToolSanctions.class); private final THashMap> sanctionHashmap; private final THashMap sanctionLevelsHashmap; @@ -22,8 +25,8 @@ public class ModToolSanctions { this.sanctionHashmap = new THashMap<>(); this.sanctionLevelsHashmap = new THashMap<>(); this.loadModSanctions(); - logger.info("Sanctions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); + LOGGER.info("Sanctions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); } public synchronized void loadModSanctions() { @@ -41,7 +44,7 @@ public class ModToolSanctions { } } } 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) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return this.sanctionHashmap; @@ -87,7 +90,7 @@ public class ModToolSanctions { statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } @@ -98,7 +101,7 @@ public class ModToolSanctions { statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } @@ -109,7 +112,7 @@ public class ModToolSanctions { statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } @@ -120,7 +123,7 @@ public class ModToolSanctions { statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java b/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java index f13e95fc..791d12d5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java +++ b/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java @@ -9,6 +9,8 @@ import com.eu.habbo.plugin.events.users.UserTriggerWordFilterEvent; import gnu.trove.iterator.hash.TObjectHashIterator; import gnu.trove.set.hash.THashSet; import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.ResultSet; @@ -18,6 +20,8 @@ import java.text.Normalizer; import java.util.regex.Pattern; 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}]+"); //Configuration. Loaded from database & updated accordingly. public static boolean ENABLED_FRIENDCHAT = true; @@ -29,7 +33,7 @@ public class WordFilter { public WordFilter() { long start = System.currentTimeMillis(); this.reload(); - logger.info("WordFilter -> Loaded! (" + (System.currentTimeMillis() - start) + " MS)"); + LOGGER.info("WordFilter -> Loaded! (" + (System.currentTimeMillis() - start) + " MS)"); } private static String stripDiacritics(String str) { @@ -54,7 +58,7 @@ public class WordFilter { try { word = new WordFilterWord(set); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); continue; } @@ -67,7 +71,7 @@ public class WordFilter { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java b/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java index 7051d864..e815b4b1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java @@ -6,6 +6,8 @@ import com.eu.habbo.plugin.HabboPlugin; import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.TIntIntHashMap; import gnu.trove.map.hash.TIntObjectHashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.*; import java.util.ArrayList; @@ -13,6 +15,8 @@ import java.util.List; import java.util.Set; public class PermissionsManager { + private static final Logger LOGGER = LoggerFactory.getLogger(PermissionsManager.class); + private final TIntObjectHashMap ranks; private final TIntIntHashMap enables; private final THashMap> badges; @@ -25,7 +29,7 @@ public class PermissionsManager { this.reload(); - logger.info("Permissions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); + LOGGER.info("Permissions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); } public void reload() { @@ -58,7 +62,7 @@ public class PermissionsManager { } } } 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")); } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/GnomePet.java b/src/main/java/com/eu/habbo/habbohotel/pets/GnomePet.java index de49ac85..b488f968 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/GnomePet.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/GnomePet.java @@ -4,6 +4,8 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.achievements.AchievementManager; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.ServerMessage; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -11,6 +13,8 @@ import java.sql.ResultSet; import java.sql.SQLException; public class GnomePet extends Pet implements IPetLook { + private static final Logger LOGGER = LoggerFactory.getLogger(GnomePet.class); + private final String gnomeData; public GnomePet(ResultSet set) throws SQLException { @@ -47,7 +51,7 @@ public class GnomePet extends Pet implements IPetLook { statement.setInt(2, this.id); statement.executeUpdate(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/HorsePet.java b/src/main/java/com/eu/habbo/habbohotel/pets/HorsePet.java index c4cbc233..666fa8d1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/HorsePet.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/HorsePet.java @@ -1,6 +1,8 @@ package com.eu.habbo.habbohotel.pets; import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -8,6 +10,8 @@ import java.sql.ResultSet; import java.sql.SQLException; public class HorsePet extends RideablePet { + private static final Logger LOGGER = LoggerFactory.getLogger(HorsePet.class); + private int hairColor; private int hairStyle; @@ -40,7 +44,7 @@ public class HorsePet extends RideablePet { statement.setInt(6, super.getId()); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } super.run(); diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java b/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java index 3f242328..7d4d0300 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java @@ -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.users.RoomUserStatusComposer; import org.apache.commons.math3.util.Pair; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -23,6 +25,8 @@ import java.util.LinkedHashMap; import java.util.Map; public class MonsterplantPet extends Pet implements IPetLook { + private static final Logger LOGGER = LoggerFactory.getLogger(MonsterplantPet.class); + public static final Map> bodyRarity = new LinkedHashMap>() { { this.put(1, new Pair<>("Blungon", 0)); @@ -138,7 +142,7 @@ public class MonsterplantPet extends Pet implements IPetLook { statement.setInt(13, this.id); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/Pet.java b/src/main/java/com/eu/habbo/habbohotel/pets/Pet.java index 143f7962..d5e13742 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/Pet.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/Pet.java @@ -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.plugin.events.pets.PetTalkEvent; import gnu.trove.map.hash.THashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.*; import java.util.Calendar; @@ -21,6 +23,7 @@ import java.util.Map; import java.util.TimeZone; public class Pet implements ISerialize, Runnable { + private static final Logger LOGGER = LoggerFactory.getLogger(Pet.class); public int levelThirst; public int levelHunger; @@ -62,7 +65,7 @@ public class Pet implements ISerialize, Runnable { this.name = set.getString("name"); this.petData = Emulator.getGameEnvironment().getPetManager().getPetData(set.getInt("type")); 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.race = set.getInt("race"); @@ -85,7 +88,7 @@ public class Pet implements ISerialize, Runnable { this.petData = Emulator.getGameEnvironment().getPetManager().getPetData(type); 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; @@ -205,7 +208,7 @@ public class Pet implements ISerialize, Runnable { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } this.needsUpdate = false; diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java b/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java index dce3d5f4..6b8b3d77 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java @@ -19,7 +19,8 @@ import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.procedure.TIntObjectProcedure; import gnu.trove.set.hash.THashSet; 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.util.ArrayList; @@ -27,6 +28,7 @@ import java.util.Collection; import java.util.Map; 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}; static int[] skins = new int[]{0, 1, 6, 7}; public final THashMap petActions = new THashMap() { @@ -80,7 +82,7 @@ public class PetManager { 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) { @@ -151,8 +153,8 @@ public class PetManager { this.loadPetCommands(connection); this.loadPetBreeding(connection); } catch (SQLException e) { - logger.error("Caught SQL exception", e); - Emulator.getLogging().logErrorLine("Pet Manager -> Failed to load!"); + LOGGER.error("Caught SQL exception", e); + LOGGER.error("Pet Manager -> Failed to load!"); } } @@ -167,7 +169,7 @@ public class PetManager { this.petRaces.get(set.getInt("race")).add(new PetRace(set)); } } 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)); } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } this.loadPetItems(connection); @@ -217,7 +219,7 @@ public class PetManager { } } } 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) { this.petData.get(set.getInt("pet_id")).petVocals.get(petVocalsType).add(new PetVocal(set.getString("message"))); } else { - Emulator.getLogging().logErrorLine("Unknown pet vocal type " + set.getString("type")); + LOGGER.error("Unknown pet vocal type " + set.getString("type")); } } 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 { if (!PetData.generalPetVocals.containsKey(PetVocalsType.valueOf(set.getString("type").toUpperCase()))) @@ -244,7 +246,7 @@ public class PetManager { } } } 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")))); } } 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")) { @@ -267,7 +269,7 @@ public class PetManager { } } } 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")); } } 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")) { @@ -294,13 +296,13 @@ public class PetManager { this.breedingReward.get(reward.petType).get(reward.rarityLevel).add(reward); } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } public THashSet getBreeds(String petName) { if (!petName.startsWith("a0 pet")) { - Emulator.getLogging().logErrorLine("Pet " + petName + " not found. Make sure it matches the pattern \"a0 pet\"!"); + LOGGER.error("Pet " + petName + " not found. Make sure it matches the pattern \"a0 pet\"!"); return null; } @@ -308,7 +310,7 @@ public class PetManager { int petId = Integer.valueOf(petName.split("t")[1]); return this.petRaces.get(petId); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } return null; @@ -346,7 +348,7 @@ public class PetManager { return this.petData.get(type); } else { 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 (?)")) { statement.setInt(1, type); statement.execute(); @@ -358,13 +360,13 @@ public class PetManager { if (set.next()) { PetData petData = new PetData(set); 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; } } } } 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()); return statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return false; diff --git a/src/main/java/com/eu/habbo/habbohotel/polls/PollManager.java b/src/main/java/com/eu/habbo/habbohotel/polls/PollManager.java index 2841e741..8e2d78a5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/polls/PollManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/polls/PollManager.java @@ -3,10 +3,14 @@ package com.eu.habbo.habbohotel.polls; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.Habbo; import gnu.trove.map.hash.THashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.*; public class PollManager { + private static final Logger LOGGER = LoggerFactory.getLogger(PollManager.class); + private final THashMap activePolls = new THashMap<>(); public PollManager() { @@ -23,7 +27,7 @@ public class PollManager { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return false; } @@ -63,7 +67,7 @@ public class PollManager { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/CustomRoomLayout.java b/src/main/java/com/eu/habbo/habbohotel/rooms/CustomRoomLayout.java index 4a30e521..3ca0650f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/CustomRoomLayout.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/CustomRoomLayout.java @@ -1,6 +1,8 @@ package com.eu.habbo.habbohotel.rooms; import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -8,6 +10,8 @@ import java.sql.ResultSet; import java.sql.SQLException; public class CustomRoomLayout extends RoomLayout implements Runnable { + private static final Logger LOGGER = LoggerFactory.getLogger(CustomRoomLayout.class); + private final int roomId; private boolean needsUpdate; @@ -30,7 +34,7 @@ public class CustomRoomLayout extends RoomLayout implements Runnable { statement.setInt(5, this.roomId); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index a5d3975c..69b53ec0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -72,6 +72,8 @@ import gnu.trove.procedure.TObjectProcedure; import gnu.trove.set.hash.THashSet; import io.netty.util.internal.ConcurrentSet; import org.apache.commons.math3.util.Pair; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.awt.*; import java.sql.Connection; @@ -86,6 +88,9 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; public class Room implements Comparable, ISerialize, Runnable { + + private static final Logger LOGGER = LoggerFactory.getLogger(Room.class); + public static final Comparator SORT_SCORE = (o1, o2) -> { if (!(o1 instanceof Room && o2 instanceof Room)) @@ -265,7 +270,7 @@ public class Room implements Comparable, ISerialize, Runnable { this.loadBans(connection); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } this.tradeMode = set.getInt("trade_mode"); @@ -313,49 +318,49 @@ public class Room implements Comparable, ISerialize, Runnable { try { this.loadLayout(); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } try { this.loadRights(connection); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } try { this.loadItems(connection); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } try { this.loadHeightmap(); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } try { this.loadBots(connection); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } try { this.loadPets(connection); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } try { this.loadWordFilter(connection); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } try { this.loadWiredData(connection); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } this.idleCycles = 0; @@ -363,7 +368,7 @@ public class Room implements Comparable, ISerialize, Runnable { this.roomCycleTask = Emulator.getThreading().getService().scheduleAtFixedRate(this, 500, 500, TimeUnit.MILLISECONDS); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } this.traxManager = new TraxManager(this); @@ -401,7 +406,7 @@ public class Room implements Comparable, ISerialize, Runnable { } } } 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, ISerialize, Runnable { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } 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, ISerialize, Runnable { ((InteractionWired) item).loadWiredData(set, this); } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } @@ -481,7 +486,7 @@ public class Room implements Comparable, ISerialize, Runnable { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } @@ -511,12 +516,12 @@ public class Room implements Comparable, ISerialize, Runnable { this.getFurniOwnerNames().put(pet.getUserId(), set.getString("pet_owner_name")); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", 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, ISerialize, Runnable { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } @@ -921,7 +926,7 @@ public class Room implements Comparable, ISerialize, Runnable { botIterator.value().needsUpdate(true); Emulator.getThreading().run(botIterator.value()); } catch (NoSuchElementException e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); break; } } @@ -929,7 +934,7 @@ public class Room implements Comparable, ISerialize, Runnable { this.currentBots.clear(); this.currentPets.clear(); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } @@ -941,7 +946,7 @@ public class Room implements Comparable, ISerialize, Runnable { this.preLoaded = true; this.layout = null; } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } @@ -1033,7 +1038,7 @@ public class Room implements Comparable, ISerialize, Runnable { Emulator.getThreading().run( Room.this::cycle); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } } @@ -1096,7 +1101,7 @@ public class Room implements Comparable, ISerialize, Runnable { statement.executeUpdate(); this.needsUpdate = false; } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } @@ -1107,7 +1112,7 @@ public class Room implements Comparable, ISerialize, Runnable { statement.setInt(2, this.id); statement.executeUpdate(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } @@ -1250,7 +1255,7 @@ public class Room implements Comparable, ISerialize, Runnable { } catch (NoSuchElementException e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); break; } } @@ -1263,7 +1268,7 @@ public class Room implements Comparable, ISerialize, Runnable { try { petIterator.advance(); } catch (NoSuchElementException e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); break; } @@ -1458,7 +1463,7 @@ public class Room implements Comparable, ISerialize, Runnable { try { item.onWalkOn(unit, room, null); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } }, this.getRollerSpeed() == 0 ? 250 : InteractionRoller.DELAY); @@ -2010,7 +2015,7 @@ public class Room implements Comparable, ISerialize, Runnable { pet.needsUpdate = true; pet.run(); } catch (NoSuchElementException e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); break; } } @@ -2123,7 +2128,7 @@ public class Room implements Comparable, ISerialize, Runnable { statement.setInt(10, this.promotion.getCategory()); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } this.needsUpdate = true; @@ -2215,7 +2220,7 @@ public class Room implements Comparable, ISerialize, Runnable { return this.habboQueue.remove(habbo.getHabboInfo().getId()) != null; } } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } return true; @@ -2288,7 +2293,7 @@ public class Room implements Comparable, ISerialize, Runnable { if (habbo != null) { this.furniOwnerNames.put(item.getUserId(), habbo.getUsername()); } 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, ISerialize, Runnable { try { item.onWalkOff(habbo.getRoomUnit(), this, new Object[]{}); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } } @@ -2674,7 +2679,7 @@ public class Room implements Comparable, ISerialize, Runnable { try { iterator.advance(); } catch (NoSuchElementException e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); break; } @@ -2694,7 +2699,7 @@ public class Room implements Comparable, ISerialize, Runnable { try { iterator.advance(); } catch (NoSuchElementException e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); break; } @@ -2716,7 +2721,7 @@ public class Room implements Comparable, ISerialize, Runnable { try { iterator.advance(); } catch (NoSuchElementException e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); break; } @@ -2759,7 +2764,7 @@ public class Room implements Comparable, ISerialize, Runnable { try { petIterator.advance(); } catch (NoSuchElementException e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); break; } @@ -2838,7 +2843,7 @@ public class Room implements Comparable, ISerialize, Runnable { try { petIterator.advance(); } catch (NoSuchElementException e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); break; } @@ -2993,7 +2998,7 @@ public class Room implements Comparable, ISerialize, Runnable { try { doorTileTopItem.onWalkOn(habbo.getRoomUnit(), this, new Object[]{}); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } } @@ -3180,7 +3185,7 @@ public class Room implements Comparable, ISerialize, Runnable { bot.onUserSay(roomChatMessage); } catch (NoSuchElementException e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); break; } } @@ -3204,7 +3209,7 @@ public class Room implements Comparable, ISerialize, Runnable { item.onClick(habbo.getClient(), this, new Object[0]); break; } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } } @@ -3757,7 +3762,7 @@ public class Room implements Comparable, ISerialize, Runnable { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } @@ -3776,7 +3781,7 @@ public class Room implements Comparable, ISerialize, Runnable { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } @@ -3820,7 +3825,7 @@ public class Room implements Comparable, ISerialize, Runnable { statement.setInt(2, userId); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } @@ -3857,7 +3862,7 @@ public class Room implements Comparable, ISerialize, Runnable { statement.setInt(2, userId); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } @@ -3875,7 +3880,7 @@ public class Room implements Comparable, ISerialize, Runnable { statement.setInt(1, this.id); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } this.refreshRightsInRoom(); @@ -3942,7 +3947,7 @@ public class Room implements Comparable, ISerialize, Runnable { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } @@ -4246,7 +4251,7 @@ public class Room implements Comparable, ISerialize, Runnable { statement.setString(2, word); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); return; } @@ -4263,7 +4268,7 @@ public class Room implements Comparable, ISerialize, Runnable { statement.setString(2, word); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomBan.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomBan.java index d22adb0d..3765175b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomBan.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomBan.java @@ -1,6 +1,8 @@ package com.eu.habbo.habbohotel.rooms; import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -9,15 +11,11 @@ import java.sql.SQLException; public class RoomBan { + private static final Logger LOGGER = LoggerFactory.getLogger(RoomBan.class); + public final int roomId; - - public final int userId; - - public final String username; - - public final 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.execute(); } 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.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java index 7eb6dbb0..80eec020 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java @@ -2,6 +2,8 @@ package com.eu.habbo.habbohotel.rooms; import com.eu.habbo.Emulator; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.awt.*; import java.sql.ResultSet; @@ -12,6 +14,7 @@ import java.util.LinkedList; import java.util.List; public class RoomLayout { + private static final Logger LOGGER = LoggerFactory.getLogger(RoomLayout.class); protected static final int BASICMOVEMENTCOST = 10; protected static final int DIAGONALMOVEMENTCOST = 14; public static double MAXIMUM_STEP_HEIGHT = 1.1; @@ -42,7 +45,7 @@ public class RoomLayout { this.parse(); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomPromotion.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomPromotion.java index 853a452d..f24e111a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomPromotion.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomPromotion.java @@ -1,6 +1,8 @@ package com.eu.habbo.habbohotel.rooms; import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -8,6 +10,7 @@ import java.sql.ResultSet; import java.sql.SQLException; public class RoomPromotion { + private static final Logger LOGGER = LoggerFactory.getLogger(RoomPromotion.class); private final Room room; public boolean needsUpdate; private String title; @@ -43,7 +46,7 @@ public class RoomPromotion { statement.setInt(4, this.room.getId()); statement.executeUpdate(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } this.needsUpdate = false; diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java index 86fd5922..c6ba64e0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java @@ -10,12 +10,15 @@ import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer; import com.eu.habbo.messages.outgoing.trading.*; import com.eu.habbo.threading.runnables.QueryDeleteHabboItem; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.*; import java.util.ArrayList; import java.util.List; public class RoomTrade { + private static final Logger LOGGER = LoggerFactory.getLogger(RoomTrade.class); //Configuration. Loaded from database & updated accordingly. public static boolean TRADING_ENABLED = true; public static boolean TRADING_REQUIRES_PERK = true; @@ -206,7 +209,7 @@ public class RoomTrade { statement.executeBatch(); } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } THashSet itemsUserOne = new THashSet<>(userOne.getItems()); diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java index 07c2a093..e6eb506d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java @@ -24,6 +24,8 @@ import com.eu.habbo.util.pathfinding.Rotation; import gnu.trove.map.TMap; import gnu.trove.map.hash.THashMap; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.*; import java.util.concurrent.ConcurrentHashMap; @@ -31,6 +33,9 @@ import java.util.concurrent.ScheduledFuture; import java.util.stream.Collectors; public class RoomUnit { + + private static final Logger LOGGER = LoggerFactory.getLogger(RoomUnit.class); + public boolean isWiredTeleporting = false; private final ConcurrentHashMap status; private final THashMap cacheable; @@ -361,7 +366,7 @@ public class RoomUnit { return false; } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); return false; } } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/TraxManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/TraxManager.java index a4656a57..c445158e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/TraxManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/TraxManager.java @@ -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.JukeBoxNowPlayingMessageComposer; 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.PreparedStatement; @@ -25,6 +27,7 @@ import java.util.List; import java.util.stream.Collectors; public class TraxManager implements Disposable { + private static final Logger LOGGER = LoggerFactory.getLogger(TraxManager.class); private final Room room; private final List songs = new ArrayList<>(0); private int totalLength = 0; @@ -51,7 +54,7 @@ public class TraxManager implements Disposable { stmt.setInt(2, musicDisc.getId()); stmt.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); return; } } else { @@ -67,7 +70,7 @@ public class TraxManager implements Disposable { } } } 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.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); return; } @@ -184,7 +187,7 @@ public class TraxManager implements Disposable { statement.setInt(2, itemId); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); return; } @@ -277,7 +280,7 @@ public class TraxManager implements Disposable { statement.setInt(1, this.room.getId()); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java b/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java index 120d59bf..242bdd02 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java @@ -20,6 +20,8 @@ import com.eu.habbo.plugin.events.users.UserPointsEvent; import gnu.trove.TIntCollection; import gnu.trove.map.hash.THashMap; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.net.InetSocketAddress; import java.net.SocketAddress; @@ -28,6 +30,9 @@ import java.util.*; import java.util.stream.Collectors; public class Habbo implements Runnable { + + private static final Logger LOGGER = LoggerFactory.getLogger(Habbo.class); + private final HabboInfo habboInfo; private final HabboStats habboStats; private final Messenger messenger; @@ -122,7 +127,7 @@ public class Habbo implements Runnable { this.messenger.connectionChanged(this, true, false); 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) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } try { @@ -164,13 +169,13 @@ public class Habbo implements Runnable { this.habboStats.dispose(); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); return; } finally { Emulator.getGameEnvironment().getRoomManager().unloadRoomsForHabbo(this); Emulator.getGameEnvironment().getHabboManager().removeHabbo(this); } - Emulator.getLogging().logUserLine(this.habboInfo.getUsername() + " disconnected."); + LOGGER.info("{} disconnected.", this.habboInfo.getUsername()); this.client = null; } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboBadge.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboBadge.java index 59afdfc3..5903cdc5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboBadge.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboBadge.java @@ -1,10 +1,13 @@ package com.eu.habbo.habbohotel.users; import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.*; public class HabboBadge implements Runnable { + private static final Logger LOGGER = LoggerFactory.getLogger(HabboBadge.class); private int id; private String code; private int slot; @@ -77,7 +80,7 @@ public class HabboBadge implements Runnable { this.needsUpdate = false; } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java index a5a0768f..a7fd28a5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java @@ -14,13 +14,17 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer; import gnu.trove.map.hash.TIntIntHashMap; import gnu.trove.procedure.TIntIntProcedure; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.*; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; public class HabboInfo implements Runnable { + + private static final Logger LOGGER = LoggerFactory.getLogger(HabboInfo.class); + public boolean firstVisit = false; private String username; private String motto; @@ -66,8 +70,8 @@ public class HabboInfo implements Runnable { this.rank = Emulator.getGameEnvironment().getPermissionsManager().getRank(set.getInt("rank")); 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."); - Emulator.getLogging().logUserLine(this.username + " has an invalid rank 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."); + 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); } @@ -79,7 +83,7 @@ public class HabboInfo implements Runnable { this.online = false; this.currentRoom = null; } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } this.loadCurrencies(); @@ -97,7 +101,7 @@ public class HabboInfo implements Runnable { } } } 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.addBatch(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return true; } }); statement.executeBatch(); } 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) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } @@ -160,7 +164,7 @@ public class HabboInfo implements Runnable { } } } 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.execute(); } 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.executeUpdate(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboInventory.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboInventory.java index 340819e5..7eaf048d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboInventory.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboInventory.java @@ -1,13 +1,17 @@ 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.MarketPlaceOffer; import com.eu.habbo.habbohotel.catalog.marketplace.MarketPlaceState; import com.eu.habbo.habbohotel.users.inventory.*; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class HabboInventory { + + private static final Logger LOGGER = LoggerFactory.getLogger(HabboInventory.class); + //Configuration. Loaded from database & updated accordingly. public static int MAXIMUM_ITEMS = 10000; private final THashSet items; @@ -24,37 +28,37 @@ public class HabboInventory { try { this.badgesComponent = new BadgesComponent(this.habbo); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } try { this.botsComponent = new BotsComponent(this.habbo); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } try { this.effectsComponent = new EffectsComponent(this.habbo); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } try { this.itemsComponent = new ItemsComponent(this, this.habbo); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } try { this.petsComponent = new PetsComponent(this.habbo); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } try { this.wardrobeComponent = new WardrobeComponent(this.habbo); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } this.items = MarketPlace.getOwnOffers(this.habbo); diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java index e5e05f68..35b809dd 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java @@ -21,6 +21,8 @@ import com.eu.habbo.messages.outgoing.users.UpdateUserLookComposer; import gnu.trove.set.hash.THashSet; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.math3.util.Pair; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.awt.*; import java.sql.Connection; @@ -29,10 +31,12 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Arrays; -import java.util.Deque; import java.util.List; public abstract class HabboItem implements Runnable, IEventTriggers { + + private static final Logger LOGGER = LoggerFactory.getLogger(HabboItem.class); + private static Class[] TOGGLING_INTERACTIONS = new Class[]{ InteractionGameTimer.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) : "")); } 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.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); - Emulator.getLogging().logErrorLine("SQLException trying to save HabboItem: " + this.toString()); + LOGGER.error("Caught SQL exception", e); + LOGGER.error("SQLException trying to save HabboItem: " + this.toString()); } this.needsUpdate = false; } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboNavigatorWindowSettings.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboNavigatorWindowSettings.java index 0b2051f3..36c1c975 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboNavigatorWindowSettings.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboNavigatorWindowSettings.java @@ -4,6 +4,8 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.navigation.DisplayMode; import com.eu.habbo.habbohotel.navigation.ListMode; import gnu.trove.map.hash.THashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -12,6 +14,7 @@ import java.sql.SQLException; import java.util.Map; public class HabboNavigatorWindowSettings { + private static final Logger LOGGER = LoggerFactory.getLogger(HabboNavigatorWindowSettings.class); public final THashMap displayModes = new THashMap<>(2); private final int userId; public int x = 100; @@ -53,7 +56,7 @@ public class HabboNavigatorWindowSettings { statement.setString(4, displayMode.name().toLowerCase()); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } this.displayModes.put(category, new HabboNavigatorPersonalDisplayMode(listMode, displayMode)); @@ -114,7 +117,7 @@ public class HabboNavigatorWindowSettings { statement.execute(); } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java index 0069d965..99bf5650 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java @@ -13,6 +13,8 @@ import gnu.trove.map.TIntObjectMap; import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.stack.array.TIntArrayStack; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -24,6 +26,9 @@ import java.util.List; import java.util.Map; public class HabboStats implements Runnable { + + private static final Logger LOGGER = LoggerFactory.getLogger(HabboStats.class); + public final TIntArrayList secretRecipes; public final HabboNavigatorWindowSettings navigatorWindowSettings; public final THashMap cache; @@ -228,7 +233,7 @@ public class HabboStats implements Runnable { statement.setInt(1, habboInfo.getId()); statement.executeUpdate(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return load(habboInfo); @@ -287,7 +292,7 @@ public class HabboStats implements Runnable { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return stats; @@ -365,7 +370,7 @@ public class HabboStats implements Runnable { this.navigatorWindowSettings.save(connection); } 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.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } this.favoriteRooms.add(roomId); @@ -493,7 +498,7 @@ public class HabboStats implements Runnable { statement.setInt(2, roomId); statement.execute(); } 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.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } this.secretRecipes.add(id); @@ -605,7 +610,7 @@ public class HabboStats implements Runnable { statement.setInt(2, userId); statement.execute(); } 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.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/cache/HabboOfferPurchase.java b/src/main/java/com/eu/habbo/habbohotel/users/cache/HabboOfferPurchase.java index 01307acf..e3591750 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/cache/HabboOfferPurchase.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/cache/HabboOfferPurchase.java @@ -2,6 +2,8 @@ package com.eu.habbo.habbohotel.users.cache; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.Habbo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -9,6 +11,7 @@ import java.sql.ResultSet; import java.sql.SQLException; public class HabboOfferPurchase { + private static final Logger LOGGER = LoggerFactory.getLogger(HabboOfferPurchase.class); private final int userId; private final int offerId; private int state; @@ -38,7 +41,7 @@ public class HabboOfferPurchase { statement.setInt(2, offerId); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); return null; } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java b/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java index 1340f8d2..02573ff4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java @@ -5,6 +5,8 @@ import com.eu.habbo.habbohotel.permissions.Rank; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboBadge; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -15,6 +17,8 @@ import java.util.Comparator; import java.util.Set; public class BadgesComponent { + private static final Logger LOGGER = LoggerFactory.getLogger(BadgesComponent.class); + private final THashSet badges = new THashSet<>(); public BadgesComponent(Habbo habbo) { @@ -51,7 +55,7 @@ public class BadgesComponent { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return badgesList; @@ -78,7 +82,7 @@ public class BadgesComponent { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return badgesList; } @@ -102,7 +106,7 @@ public class BadgesComponent { statement.setString(2, badge); statement.execute(); } 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.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/inventory/BotsComponent.java b/src/main/java/com/eu/habbo/habbohotel/users/inventory/BotsComponent.java index 3db630c3..cf9097bf 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/inventory/BotsComponent.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/inventory/BotsComponent.java @@ -4,6 +4,8 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.users.Habbo; import gnu.trove.map.hash.THashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -12,6 +14,7 @@ import java.sql.SQLException; import java.util.Map; public class BotsComponent { + private static final Logger LOGGER = LoggerFactory.getLogger(BotsComponent.class); private final THashMap bots = new THashMap<>(); @@ -32,7 +35,7 @@ public class BotsComponent { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/inventory/EffectsComponent.java b/src/main/java/com/eu/habbo/habbohotel/users/inventory/EffectsComponent.java index e80f876e..99bff77a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/inventory/EffectsComponent.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/inventory/EffectsComponent.java @@ -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.EffectsListRemoveComposer; 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.PreparedStatement; @@ -14,6 +15,8 @@ import java.sql.ResultSet; import java.sql.SQLException; public class EffectsComponent { + private static final Logger LOGGER = LoggerFactory.getLogger(EffectsComponent.class); + public final THashMap effects = new THashMap<>(); public final Habbo habbo; public int activatedEffect = 0; @@ -28,7 +31,7 @@ public class EffectsComponent { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } if(habbo.getHabboInfo().getRank().getRoomEffect() > 0) this.createRankEffect(habbo.getHabboInfo().getRank().getRoomEffect()); @@ -89,7 +92,7 @@ public class EffectsComponent { statement.setInt(5, effect.effect); statement.addBatch(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } return true; @@ -97,7 +100,7 @@ public class EffectsComponent { statement.executeBatch(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } this.effects.clear(); @@ -205,7 +208,7 @@ public class EffectsComponent { statement.setInt(4, this.duration); statement.execute(); } 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.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/inventory/ItemsComponent.java b/src/main/java/com/eu/habbo/habbohotel/users/inventory/ItemsComponent.java index e751ad66..613868c4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/inventory/ItemsComponent.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/inventory/ItemsComponent.java @@ -15,6 +15,8 @@ import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.procedure.TObjectProcedure; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -23,6 +25,8 @@ import java.sql.SQLException; import java.util.NoSuchElementException; public class ItemsComponent { + private static final Logger LOGGER = LoggerFactory.getLogger(ItemsComponent.class); + private final TIntObjectMap items = TCollections.synchronizedMap(new TIntObjectHashMap<>()); private final HabboInventory inventory; @@ -46,15 +50,15 @@ public class ItemsComponent { if (item != null) { itemsList.put(set.getInt("id"), item); } else { - Emulator.getLogging().logErrorLine("Failed to load HabboItem: " + set.getInt("id")); + LOGGER.error("Failed to load HabboItem: " + set.getInt("id")); } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return itemsList; @@ -150,7 +154,7 @@ public class ItemsComponent { TIntObjectIterator items = this.items.iterator(); if (items == null) { - Emulator.getLogging().logErrorLine(new RuntimeException("Items is NULL!")); + LOGGER.error("Items is NULL!"); return; } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/inventory/PetsComponent.java b/src/main/java/com/eu/habbo/habbohotel/users/inventory/PetsComponent.java index 4d2e20a4..cd963297 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/inventory/PetsComponent.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/inventory/PetsComponent.java @@ -8,6 +8,8 @@ import gnu.trove.TCollections; import gnu.trove.iterator.TIntObjectIterator; import gnu.trove.map.TIntObjectMap; import gnu.trove.map.hash.TIntObjectHashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -17,6 +19,7 @@ import java.util.NoSuchElementException; import java.util.Set; public class PetsComponent { + private static final Logger LOGGER = LoggerFactory.getLogger(PetsComponent.class); private final TIntObjectMap pets = TCollections.synchronizedMap(new TIntObjectHashMap<>()); public PetsComponent(Habbo habbo) { @@ -34,7 +37,7 @@ public class PetsComponent { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/inventory/WardrobeComponent.java b/src/main/java/com/eu/habbo/habbohotel/users/inventory/WardrobeComponent.java index 1e68dacf..2d207132 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/inventory/WardrobeComponent.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/inventory/WardrobeComponent.java @@ -7,6 +7,8 @@ import gnu.trove.TIntCollection; import gnu.trove.map.hash.THashMap; import gnu.trove.set.TIntSet; import gnu.trove.set.hash.TIntHashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -14,6 +16,7 @@ import java.sql.ResultSet; import java.sql.SQLException; public class WardrobeComponent { + private static final Logger LOGGER = LoggerFactory.getLogger(WardrobeComponent.class); private final THashMap looks; private final TIntSet clothing; @@ -42,7 +45,7 @@ public class WardrobeComponent { } } } 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) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/wired/WiredHandler.java b/src/main/java/com/eu/habbo/habbohotel/wired/WiredHandler.java index 935b740f..98924182 100644 --- a/src/main/java/com/eu/habbo/habbohotel/wired/WiredHandler.java +++ b/src/main/java/com/eu/habbo/habbohotel/wired/WiredHandler.java @@ -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.users.UserWiredRewardReceived; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -38,6 +40,8 @@ import java.util.Collections; import java.util.List; public class WiredHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(WiredHandler.class); + //Configuration. Loaded from database & updated accordingly. public static int MAXIMUM_FURNI_SELECTION = 5; public static int TELEPORT_DELAY = 500; @@ -199,7 +203,7 @@ public class WiredHandler { if (!effect.execute(roomUnit, room, stuff)) return; effect.setCooldown(millis); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } effect.activateBox(room); @@ -235,7 +239,7 @@ public class WiredHandler { statement.setInt(1, wiredId); statement.execute(); } 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.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } if (reward.badge) { @@ -404,7 +408,7 @@ public class WiredHandler { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return false; diff --git a/src/main/java/com/eu/habbo/habbohotel/wired/highscores/WiredHighscoreManager.java b/src/main/java/com/eu/habbo/habbohotel/wired/highscores/WiredHighscoreManager.java index 42a6b353..31431699 100644 --- a/src/main/java/com/eu/habbo/habbohotel/wired/highscores/WiredHighscoreManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/wired/highscores/WiredHighscoreManager.java @@ -3,6 +3,8 @@ package com.eu.habbo.habbohotel.wired.highscores; import com.eu.habbo.Emulator; import com.eu.habbo.plugin.EventHandler; import com.eu.habbo.plugin.events.emulator.EmulatorLoadedEvent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -17,6 +19,8 @@ import java.util.stream.Collectors; import java.util.stream.Stream; public class WiredHighscoreManager { + private static final Logger LOGGER = LoggerFactory.getLogger(WiredHighscoreManager.class); + private final HashMap> data = new HashMap<>(); 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.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 @@ -65,7 +69,7 @@ public class WiredHighscoreManager { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } @@ -85,7 +89,7 @@ public class WiredHighscoreManager { statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/camera/CameraPublishToWebEvent.java b/src/main/java/com/eu/habbo/messages/incoming/camera/CameraPublishToWebEvent.java index 30eef4b9..9d63b55a 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/camera/CameraPublishToWebEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/camera/CameraPublishToWebEvent.java @@ -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.catalog.NotEnoughPointsTypeComposer; import com.eu.habbo.plugin.events.users.UserPublishPictureEvent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; 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_TYPE = 0; @@ -50,7 +54,7 @@ public class CameraPublishToWebEvent extends MessageHandler { isOk = true; } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemAsGiftEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemAsGiftEvent.java index e7077d1c..8c08198a 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemAsGiftEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemAsGiftEvent.java @@ -25,6 +25,8 @@ import com.eu.habbo.messages.outgoing.users.UserPointsComposer; import com.eu.habbo.threading.runnables.ShutdownEmulator; import gnu.trove.map.hash.THashMap; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -33,6 +35,8 @@ import java.sql.SQLException; import java.util.Calendar; public class CatalogBuyItemAsGiftEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(CatalogBuyItemAsGiftEvent.class); + @Override public void handle() throws Exception { if (Emulator.getIntUnixTimestamp() - this.client.getHabbo().getHabboStats().lastGiftTimestamp >= CatalogManager.PURCHASE_COOLDOWN) { @@ -104,7 +108,7 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } else { userId = habbo.getHabboInfo().getId(); @@ -287,7 +291,7 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler { try { guildId = Integer.parseInt(extraData); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); return; } @@ -359,7 +363,7 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler { this.client.sendResponse(new PurchaseOKComposer(item)); } catch (Exception e) { - Emulator.getLogging().logPacketError(e); + LOGGER.error("Exception caught", e); this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); } } finally { diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/marketplace/SellItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/marketplace/SellItemEvent.java index 5e8a793b..f63df2b2 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/marketplace/SellItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/marketplace/SellItemEvent.java @@ -7,8 +7,12 @@ import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.catalog.AlertPurchaseFailedComposer; import com.eu.habbo.messages.outgoing.catalog.marketplace.MarketplaceItemPostedComposer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class SellItemEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(SellItemEvent.class); + @Override public void handle() throws Exception { if (!MarketPlace.MARKETPLACE_ENABLED) { @@ -26,7 +30,7 @@ public class SellItemEvent extends MessageHandler { 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 + ""); ScripterManager.scripterDetected(this.client, message); - Emulator.getLogging().logUserLine(message); + LOGGER.info(message); this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); return; } @@ -34,7 +38,7 @@ public class SellItemEvent extends MessageHandler { 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 + ""); ScripterManager.scripterDetected(this.client, message); - Emulator.getLogging().logUserLine(message); + LOGGER.info(message); this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java b/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java index 5d618d19..09f8ec6f 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java @@ -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.FriendRequestErrorComposer; import com.eu.habbo.plugin.events.users.friends.UserRequestFriendshipEvent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -16,6 +18,8 @@ import java.sql.SQLException; public class FriendRequestEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(FriendRequestEvent.class); + @Override public void handle() throws Exception { String username = this.packet.readString(); @@ -50,7 +54,7 @@ public class FriendRequestEvent extends MessageHandler { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); return; } } else { diff --git a/src/main/java/com/eu/habbo/messages/incoming/guardians/GuardianVoteEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guardians/GuardianVoteEvent.java index 0356b9ef..b2675d27 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guardians/GuardianVoteEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guardians/GuardianVoteEvent.java @@ -4,8 +4,12 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.guides.GuardianTicket; import com.eu.habbo.habbohotel.guides.GuardianVoteType; import com.eu.habbo.messages.incoming.MessageHandler; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class GuardianVoteEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(GuardianVoteEvent.class); + @Override public void handle() throws Exception { int voteType = this.packet.readInt(); @@ -22,7 +26,7 @@ public class GuardianVoteEvent extends MessageHandler { } else if (voteType == 2) { type = GuardianVoteType.AWFULLY; } else { - Emulator.getLogging().logErrorLine("Uknown vote type: " + voteType); + LOGGER.error("Uknown vote type: " + voteType); } ticket.vote(this.client.getHabbo(), type); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildBuyEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildBuyEvent.java index ea5e530b..fd969b85 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildBuyEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildBuyEvent.java @@ -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.GuildInfoComposer; import com.eu.habbo.plugin.events.guilds.GuildPurchasedEvent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class RequestGuildBuyEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(RequestGuildBuyEvent.class); + @Override public void handle() throws Exception { if (!this.client.getHabbo().hasPermission("acc_infinite_credits")) { @@ -95,7 +99,7 @@ public class RequestGuildBuyEvent extends MessageHandler { } 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())); ScripterManager.scripterDetected(this.client, message); - Emulator.getLogging().logUserLine(message); + LOGGER.info(message); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumListEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumListEvent.java index cd1307a2..991b7a7b 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumListEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumListEvent.java @@ -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.handshake.ConnectionErrorComposer; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -14,6 +16,8 @@ import java.sql.SQLException; import java.util.Set; public class GuildForumListEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(GuildForumListEvent.class); + @Override public void handle() throws Exception { int mode = this.packet.readInt(); @@ -60,7 +64,7 @@ public class GuildForumListEvent extends MessageHandler { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); this.client.sendResponse(new ConnectionErrorComposer(500)); } @@ -84,7 +88,7 @@ public class GuildForumListEvent extends MessageHandler { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); this.client.sendResponse(new ConnectionErrorComposer(500)); } diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java index 0923ac86..afe9ddf5 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java @@ -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.users.UserLoginEvent; import gnu.trove.map.hash.THashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.Date; @NoAuthMessage public class SecureLoginEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(SecureLoginEvent.class); + @Override @@ -97,7 +101,7 @@ public class SecureLoginEvent extends MessageHandler { Emulator.getThreading().run(habbo); Emulator.getGameEnvironment().getHabboManager().addHabbo(habbo); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); Emulator.getGameServer().getGameClientManager().disposeClient(this.client); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/hotelview/HotelViewDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/hotelview/HotelViewDataEvent.java index e554ceab..16f7fefd 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/hotelview/HotelViewDataEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/hotelview/HotelViewDataEvent.java @@ -1,10 +1,13 @@ package com.eu.habbo.messages.incoming.hotelview; -import com.eu.habbo.Emulator; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.hotelview.HotelViewDataComposer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class HotelViewDataEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(HotelViewDataEvent.class); + @Override public void handle() { @@ -30,7 +33,7 @@ public class HotelViewDataEvent extends MessageHandler { this.client.sendResponse(new HotelViewDataComposer(data, data.split(",")[data.split(",").length - 1])); } } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/inventory/RequestInventoryItemsEvent.java b/src/main/java/com/eu/habbo/messages/incoming/inventory/RequestInventoryItemsEvent.java index ad9a7140..2b9641cb 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/inventory/RequestInventoryItemsEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/inventory/RequestInventoryItemsEvent.java @@ -1,16 +1,19 @@ package com.eu.habbo.messages.incoming.inventory; -import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.inventory.InventoryItemsComposer; import gnu.trove.iterator.TIntObjectIterator; import gnu.trove.map.TIntObjectMap; import gnu.trove.map.hash.TIntObjectHashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.NoSuchElementException; public class RequestInventoryItemsEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(RequestInventoryItemsEvent.class); + @Override public void handle() throws Exception { int totalItems = this.client.getHabbo().getInventory().getItemsComponent().getItems().size(); @@ -35,7 +38,7 @@ public class RequestInventoryItemsEvent extends MessageHandler { items.put(iterator.key(), iterator.value()); count++; } catch (NoSuchElementException e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); break; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestCreateRoomEvent.java b/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestCreateRoomEvent.java index 222063b5..45ba380a 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestCreateRoomEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestCreateRoomEvent.java @@ -7,8 +7,12 @@ import com.eu.habbo.habbohotel.rooms.RoomManager; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.navigator.CanCreateRoomComposer; import com.eu.habbo.messages.outgoing.navigator.RoomCreatedComposer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class RequestCreateRoomEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(RequestCreateRoomEvent.class); + @Override public void handle() throws Exception { @@ -20,14 +24,14 @@ public class RequestCreateRoomEvent extends MessageHandler { int tradeType = this.packet.readInt(); 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; } RoomCategory category = Emulator.getGameEnvironment().getRoomManager().getCategory(categoryId); 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; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestDeleteRoomEvent.java b/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestDeleteRoomEvent.java index 75a7909d..3d7ebf41 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestDeleteRoomEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestDeleteRoomEvent.java @@ -6,12 +6,16 @@ import com.eu.habbo.habbohotel.modtool.ScripterManager; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.plugin.events.navigator.NavigatorRoomDeletedEvent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class RequestDeleteRoomEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(RequestDeleteRoomEvent.class); + @Override public void handle() throws Exception { int roomId = this.packet.readInt(); @@ -69,12 +73,12 @@ public class RequestDeleteRoomEvent extends MessageHandler { filter.execute(); } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } 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()); ScripterManager.scripterDetected(this.client, message); - Emulator.getLogging().logUserLine(message); + LOGGER.info(message); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestNewNavigatorRoomsEvent.java b/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestNewNavigatorRoomsEvent.java index c5f71d4e..4fb1dec0 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestNewNavigatorRoomsEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestNewNavigatorRoomsEvent.java @@ -8,10 +8,14 @@ import com.eu.habbo.habbohotel.rooms.RoomCategory; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.navigator.NewNavigatorSearchResultsComposer; import gnu.trove.map.hash.THashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.*; public class RequestNewNavigatorRoomsEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(RequestNewNavigatorRoomsEvent.class); + @Override public void handle() throws Exception { String view = this.packet.readString(); @@ -89,7 +93,7 @@ public class RequestNewNavigatorRoomsEvent extends MessageHandler { resultLists = toQueryResults(resultLists); this.client.sendResponse(new NewNavigatorSearchResultsComposer(view, query, resultLists)); } 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) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } */ } diff --git a/src/main/java/com/eu/habbo/messages/incoming/polls/AnswerPollEvent.java b/src/main/java/com/eu/habbo/messages/incoming/polls/AnswerPollEvent.java index 3abc1a7a..574e50ca 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/polls/AnswerPollEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/polls/AnswerPollEvent.java @@ -6,12 +6,16 @@ import com.eu.habbo.habbohotel.users.HabboBadge; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.users.AddUserBadgeComposer; import com.eu.habbo.messages.outgoing.wired.WiredRewardAlertComposer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class AnswerPollEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(AnswerPollEvent.class); + @Override public void handle() throws Exception { int pollId = this.packet.readInt(); @@ -40,7 +44,7 @@ public class AnswerPollEvent extends MessageHandler { statement.setString(4, answer.toString()); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } if (poll.lastQuestionId == questionId) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/polls/CancelPollEvent.java b/src/main/java/com/eu/habbo/messages/incoming/polls/CancelPollEvent.java index 02284cbe..a38b5a03 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/polls/CancelPollEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/polls/CancelPollEvent.java @@ -3,12 +3,16 @@ package com.eu.habbo.messages.incoming.polls; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.polls.Poll; import com.eu.habbo.messages.incoming.MessageHandler; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class CancelPollEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(CancelPollEvent.class); + @Override public void handle() throws Exception { int pollId = this.packet.readInt(); @@ -24,7 +28,7 @@ public class CancelPollEvent extends MessageHandler { statement.setString(4, ""); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomSettingsSaveEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomSettingsSaveEvent.java index db338bf2..415809d6 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomSettingsSaveEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomSettingsSaveEvent.java @@ -7,8 +7,12 @@ import com.eu.habbo.habbohotel.rooms.RoomCategory; import com.eu.habbo.habbohotel.rooms.RoomState; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.rooms.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class RoomSettingsSaveEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(RoomSettingsSaveEvent.class); + @Override public void handle() throws Exception { int roomId = this.packet.readInt(); @@ -93,7 +97,7 @@ public class RoomSettingsSaveEvent extends MessageHandler { } ScripterManager.scripterDetected(this.client, message); - Emulator.getLogging().logUserLine(message); + LOGGER.info(message); } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RedeemClothingEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RedeemClothingEvent.java index 048a772e..95382469 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RedeemClothingEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RedeemClothingEvent.java @@ -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.users.UserClothesComposer; import com.eu.habbo.threading.runnables.QueryDeleteHabboItem; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class RedeemClothingEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(RedeemClothingEvent.class); + @Override public void handle() throws Exception { int itemId = this.packet.readInt(); @@ -45,7 +49,7 @@ public class RedeemClothingEvent extends MessageHandler { statement.setInt(2, clothing.id); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } 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)); } } 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!"); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RedeemItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RedeemItemEvent.java index a5f72a41..3533ca6d 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RedeemItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RedeemItemEvent.java @@ -11,8 +11,12 @@ import com.eu.habbo.messages.outgoing.users.UserCreditsComposer; import com.eu.habbo.messages.outgoing.users.UserCurrencyComposer; import com.eu.habbo.plugin.events.furniture.FurnitureRedeemedEvent; import com.eu.habbo.threading.runnables.QueryDeleteHabboItem; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class RedeemItemEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(RedeemItemEvent.class); + @Override public void handle() throws Exception { int itemId = this.packet.readInt(); @@ -32,7 +36,7 @@ public class RedeemItemEvent extends MessageHandler { try { credits = Integer.valueOf(item.getBaseItem().getName().split("_")[1]); } catch (Exception e) { - Emulator.getLogging().logErrorLine("Failed to parse redeemable furniture: " + item.getBaseItem().getName() + ". Must be in format of CF_"); + LOGGER.error("Failed to parse redeemable furniture: " + item.getBaseItem().getName() + ". Must be in format of CF_"); return; } @@ -43,7 +47,7 @@ public class RedeemItemEvent extends MessageHandler { try { pixels = Integer.valueOf(item.getBaseItem().getName().split("_")[1]); } catch (Exception e) { - Emulator.getLogging().logErrorLine("Failed to parse redeemable pixel furniture: " + item.getBaseItem().getName() + ". Must be in format of PF_"); + LOGGER.error("Failed to parse redeemable pixel furniture: " + item.getBaseItem().getName() + ". Must be in format of PF_"); return; } @@ -55,14 +59,14 @@ public class RedeemItemEvent extends MessageHandler { try { pointsType = Integer.valueOf(item.getBaseItem().getName().split("_")[1]); } catch (Exception e) { - Emulator.getLogging().logErrorLine("Failed to parse redeemable points furniture: " + item.getBaseItem().getName() + ". Must be in format of DF__ where equals integer representation of seasonal currency."); + LOGGER.error("Failed to parse redeemable points furniture: " + item.getBaseItem().getName() + ". Must be in format of DF__ where equals integer representation of seasonal currency."); return; } try { points = Integer.valueOf(item.getBaseItem().getName().split("_")[2]); } catch (Exception e) { - Emulator.getLogging().logErrorLine("Failed to parse redeemable points furniture: " + item.getBaseItem().getName() + ". Must be in format of DF__ where equals integer representation of seasonal currency."); + LOGGER.error("Failed to parse redeemable points furniture: " + item.getBaseItem().getName() + ". Must be in format of DF__ where equals integer representation of seasonal currency."); return; } @@ -73,7 +77,7 @@ public class RedeemItemEvent extends MessageHandler { try { points = Integer.valueOf(item.getBaseItem().getName().split("_")[2]); } catch (Exception e) { - Emulator.getLogging().logErrorLine("Failed to parse redeemable diamonds furniture: " + item.getBaseItem().getName() + ". Must be in format of CF_diamond_"); + LOGGER.error("Failed to parse redeemable diamonds furniture: " + item.getBaseItem().getName() + ". Must be in format of CF_diamond_"); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SavePostItStickyPoleEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SavePostItStickyPoleEvent.java index 8a672308..9f393896 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SavePostItStickyPoleEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SavePostItStickyPoleEvent.java @@ -7,10 +7,14 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionPostIt; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.incoming.MessageHandler; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.time.LocalDate; public class SavePostItStickyPoleEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(SavePostItStickyPoleEvent.class); + @Override public void handle() throws Exception { int itemId = this.packet.readInt(); @@ -26,7 +30,7 @@ public class SavePostItStickyPoleEvent extends MessageHandler { CommandHandler.handleCommand(this.client, command); } } 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 { String text = this.packet.readString(); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/ToggleFloorItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/ToggleFloorItemEvent.java index 2bc02132..5b665d79 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/ToggleFloorItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/ToggleFloorItemEvent.java @@ -2,8 +2,8 @@ package com.eu.habbo.messages.incoming.rooms.items; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.interactions.InteractionDice; -import com.eu.habbo.habbohotel.items.interactions.pets.InteractionMonsterPlantSeed; import com.eu.habbo.habbohotel.items.interactions.InteractionWired; +import com.eu.habbo.habbohotel.items.interactions.pets.InteractionMonsterPlantSeed; import com.eu.habbo.habbohotel.pets.MonsterplantPet; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.HabboItem; @@ -12,8 +12,12 @@ import com.eu.habbo.messages.outgoing.rooms.items.RemoveFloorItemComposer; import com.eu.habbo.messages.outgoing.rooms.pets.PetPackageComposer; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer; import com.eu.habbo.threading.runnables.QueryDeleteHabboItem; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ToggleFloorItemEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(ToggleFloorItemEvent.class); + @Override public void handle() throws Exception { try { @@ -120,7 +124,7 @@ public class ToggleFloorItemEvent extends MessageHandler { this.client.getHabbo().getRoomUnit().setGoalLocation(this.client.getHabbo().getRoomUnit().getCurrentLocation()); } } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/UseRandomStateItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/UseRandomStateItemEvent.java index f8fbcba2..85a357ff 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/UseRandomStateItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/UseRandomStateItemEvent.java @@ -1,12 +1,15 @@ package com.eu.habbo.messages.incoming.rooms.items; -import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.interactions.InteractionRandomState; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.incoming.MessageHandler; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class UseRandomStateItemEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(UseRandomStateItemEvent.class); + @Override public void handle() throws Exception { try { @@ -23,7 +26,7 @@ public class UseRandomStateItemEvent extends MessageHandler { InteractionRandomState randomStateItem = (InteractionRandomState)item; randomStateItem.onRandomStateClick(this.client, room); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/youtube/YoutubeRequestPlaylists.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/youtube/YoutubeRequestPlaylists.java index 6c4b804b..15f9206a 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/youtube/YoutubeRequestPlaylists.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/youtube/YoutubeRequestPlaylists.java @@ -7,10 +7,14 @@ import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.handshake.ConnectionErrorComposer; import com.eu.habbo.messages.outgoing.rooms.items.youtube.YoutubeDisplayListComposer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.ArrayList; public class YoutubeRequestPlaylists extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(YoutubeRequestPlaylists.class); + @Override public void handle() throws Exception { int itemId = this.packet.readInt(); @@ -24,7 +28,7 @@ public class YoutubeRequestPlaylists extends MessageHandler { ArrayList playlists = Emulator.getGameEnvironment().getItemManager().getYoutubeManager().getPlaylistsForItemId(item.getBaseItem().getId()); if (playlists == null) { - Emulator.getLogging().logErrorLine("No YouTube playlists set for base item #" + item.getBaseItem().getId()); + LOGGER.error("No YouTube playlists set for base item #" + item.getBaseItem().getId()); this.client.sendResponse(new ConnectionErrorComposer(1000)); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/CompostMonsterplantEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/CompostMonsterplantEvent.java index 333e86bc..2b87a45a 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/CompostMonsterplantEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/CompostMonsterplantEvent.java @@ -8,12 +8,16 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.rooms.items.AddFloorItemComposer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class CompostMonsterplantEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(CompostMonsterplantEvent.class); + @Override public void handle() throws Exception { int petId = this.packet.readInt(); @@ -42,7 +46,7 @@ public class CompostMonsterplantEvent extends MessageHandler { statement.setInt(1, pet.getId()); statement.executeUpdate(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/HorseRemoveSaddleEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/HorseRemoveSaddleEvent.java index 3b73995d..9c36827c 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/HorseRemoveSaddleEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/HorseRemoveSaddleEvent.java @@ -10,6 +10,8 @@ import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.inventory.AddHabboItemComposer; import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer; import com.eu.habbo.messages.outgoing.rooms.pets.RoomPetHorseFigureComposer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -17,6 +19,8 @@ import java.sql.ResultSet; import java.sql.SQLException; public class HorseRemoveSaddleEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(HorseRemoveSaddleEvent.class); + @Override public void handle() throws Exception { Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom(); @@ -36,12 +40,12 @@ public class HorseRemoveSaddleEvent extends MessageHandler { if (set.next()) { saddleItemId = set.getInt("id"); } else { - Emulator.getLogging().logErrorLine("There is no viable fallback saddle item for old horses with no saddle item ID. Horse pet ID: " + horse.getId()); + LOGGER.error("There is no viable fallback saddle item for old horses with no saddle item ID. Horse pet ID: " + horse.getId()); return; } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserShoutEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserShoutEvent.java index 3e217e75..1c0e4fba 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserShoutEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserShoutEvent.java @@ -6,8 +6,12 @@ import com.eu.habbo.habbohotel.rooms.RoomChatMessage; import com.eu.habbo.habbohotel.rooms.RoomChatType; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.plugin.events.users.UserTalkEvent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class RoomUserShoutEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(RoomUserShoutEvent.class); + @Override public void handle() throws Exception { if (this.client.getHabbo().getHabboInfo().getCurrentRoom() == null) @@ -34,7 +38,7 @@ public class RoomUserShoutEvent extends MessageHandler { } else { String reportMessage = Emulator.getTexts().getValue("scripter.warning.chat.length").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%length%", message.getMessage().length() + ""); ScripterManager.scripterDetected(this.client, reportMessage); - Emulator.getLogging().logUserLine(reportMessage); + LOGGER.info(reportMessage); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserTalkEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserTalkEvent.java index a3debf17..2201fb4c 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserTalkEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserTalkEvent.java @@ -7,8 +7,12 @@ import com.eu.habbo.habbohotel.rooms.RoomChatMessage; import com.eu.habbo.habbohotel.rooms.RoomChatType; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.plugin.events.users.UserTalkEvent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class RoomUserTalkEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(RoomUserTalkEvent.class); + @Override public void handle() throws Exception { @@ -36,7 +40,7 @@ public class RoomUserTalkEvent extends MessageHandler { } else { String reportMessage = Emulator.getTexts().getValue("scripter.warning.chat.length").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%length%", message.getMessage().length() + ""); ScripterManager.scripterDetected(this.client, reportMessage); - Emulator.getLogging().logUserLine(reportMessage); + LOGGER.info(reportMessage); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserWalkEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserWalkEvent.java index 1cd43572..859be049 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserWalkEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserWalkEvent.java @@ -12,8 +12,12 @@ import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.rooms.users.RoomUnitOnRollerComposer; import com.eu.habbo.plugin.events.users.UserIdleEvent; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class RoomUserWalkEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(RoomUserWalkEvent.class); + @Override public int getRatelimit() { return 500; @@ -154,7 +158,7 @@ public class RoomUserWalkEvent extends MessageHandler { } } } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserWhisperEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserWhisperEvent.java index 7a35384e..b153138c 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserWhisperEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserWhisperEvent.java @@ -6,8 +6,12 @@ import com.eu.habbo.habbohotel.rooms.RoomChatMessage; import com.eu.habbo.habbohotel.rooms.RoomChatType; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.plugin.events.users.UserTalkEvent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class RoomUserWhisperEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(RoomUserWhisperEvent.class); + @Override public void handle() throws Exception { if (this.client.getHabbo().getHabboInfo().getCurrentRoom() == null) @@ -31,7 +35,7 @@ public class RoomUserWhisperEvent extends MessageHandler { } else { String reportMessage = Emulator.getTexts().getValue("scripter.warning.chat.length").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%length%", chatMessage.getMessage().length() + ""); ScripterManager.scripterDetected(this.client, reportMessage); - Emulator.getLogging().logUserLine(reportMessage); + LOGGER.info(reportMessage); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/users/ConfirmChangeNameEvent.java b/src/main/java/com/eu/habbo/messages/incoming/users/ConfirmChangeNameEvent.java index 8d8004b6..03e02149 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/users/ConfirmChangeNameEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/users/ConfirmChangeNameEvent.java @@ -10,6 +10,8 @@ import com.eu.habbo.messages.outgoing.rooms.users.RoomUserNameChangedComposer; import com.eu.habbo.messages.outgoing.users.ChangeNameCheckResultComposer; import com.eu.habbo.messages.outgoing.users.UserDataComposer; import com.eu.habbo.plugin.events.users.UserNameChangedEvent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -18,6 +20,8 @@ import java.util.ArrayList; import java.util.List; public class ConfirmChangeNameEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(ConfirmChangeNameEvent.class); + public static final List changingUsernames = new ArrayList<>(2); @Override @@ -80,7 +84,7 @@ public class ConfirmChangeNameEvent extends MessageHandler { statement.setInt(4, Emulator.getIntUnixTimestamp()); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } else { this.client.sendResponse(new ChangeNameCheckResultComposer(ChangeNameCheckResultComposer.TAKEN_WITH_SUGGESTIONS, name, new ArrayList<>())); diff --git a/src/main/java/com/eu/habbo/messages/incoming/users/RequestUserDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/users/RequestUserDataEvent.java index 01f1f1af..f4d37e90 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/users/RequestUserDataEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/users/RequestUserDataEvent.java @@ -8,10 +8,14 @@ import com.eu.habbo.messages.outgoing.rooms.ForwardToRoomComposer; import com.eu.habbo.messages.outgoing.users.MeMenuSettingsComposer; import com.eu.habbo.messages.outgoing.users.UserDataComposer; import com.eu.habbo.messages.outgoing.users.UserPerksComposer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.ArrayList; public class RequestUserDataEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(RequestUserDataEvent.class); + @Override public void handle() throws Exception { if (this.client.getHabbo() != null) { @@ -59,7 +63,7 @@ public class RequestUserDataEvent extends MessageHandler { } else { - Emulator.getLogging().logDebugLine("Habbo is NULL!"); + LOGGER.debug("Attempted to request user data where Habbo was null."); Emulator.getGameServer().getGameClientManager().disposeClient(this.client); } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/users/UserSaveLookEvent.java b/src/main/java/com/eu/habbo/messages/incoming/users/UserSaveLookEvent.java index 97bcbf93..411f24e3 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/users/UserSaveLookEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/users/UserSaveLookEvent.java @@ -8,8 +8,12 @@ import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDataComposer; import com.eu.habbo.messages.outgoing.users.UpdateUserLookComposer; import com.eu.habbo.plugin.events.users.UserSavedLookEvent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class UserSaveLookEvent extends MessageHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(UserSaveLookEvent.class); + @Override public void handle() throws Exception { String genderCode = this.packet.readString(); @@ -20,7 +24,7 @@ public class UserSaveLookEvent extends MessageHandler { } catch (IllegalArgumentException e) { String message = Emulator.getTexts().getValue("scripter.warning.look.gender").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%gender%", genderCode); ScripterManager.scripterDetected(this.client, message); - Emulator.getLogging().logUserLine(message); + LOGGER.info(message); return; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/achievements/AchievementListComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/achievements/AchievementListComposer.java index 580ab0da..54418f38 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/achievements/AchievementListComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/achievements/AchievementListComposer.java @@ -8,8 +8,12 @@ import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.Outgoing; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class AchievementListComposer extends MessageComposer { + private static final Logger LOGGER = LoggerFactory.getLogger(AchievementListComposer.class); + private final Habbo habbo; public AchievementListComposer(Habbo habbo) { @@ -49,7 +53,7 @@ public class AchievementListComposer extends MessageComposer { this.response.appendString(""); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPagesListComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPagesListComposer.java index d7c340be..1a23cd62 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPagesListComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPagesListComposer.java @@ -6,10 +6,14 @@ import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.Outgoing; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.List; public class CatalogPagesListComposer extends MessageComposer { + private static final Logger LOGGER = LoggerFactory.getLogger(CatalogPagesListComposer.class); + private final Habbo habbo; private final String mode; private final boolean hasPermission; @@ -44,7 +48,7 @@ public class CatalogPagesListComposer extends MessageComposer { return this.response; } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } return null; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceOwnItemsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceOwnItemsComposer.java index 8507f9a6..d230697b 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceOwnItemsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceOwnItemsComposer.java @@ -7,8 +7,12 @@ import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.Outgoing; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class MarketplaceOwnItemsComposer extends MessageComposer { + private static final Logger LOGGER = LoggerFactory.getLogger(MarketplaceOwnItemsComposer.class); + private final Habbo habbo; public MarketplaceOwnItemsComposer(Habbo habbo) { @@ -54,7 +58,7 @@ public class MarketplaceOwnItemsComposer extends MessageComposer { this.response.appendInt(0); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendsComposer.java index 4d829ac5..6832ff9e 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendsComposer.java @@ -1,6 +1,5 @@ package com.eu.habbo.messages.outgoing.friends; -import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.messenger.Messenger; import com.eu.habbo.habbohotel.messenger.MessengerBuddy; import com.eu.habbo.habbohotel.users.Habbo; @@ -8,10 +7,14 @@ import com.eu.habbo.habbohotel.users.HabboGender; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.Outgoing; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.Map; public class FriendsComposer extends MessageComposer { + private static final Logger LOGGER = LoggerFactory.getLogger(FriendsComposer.class); + private final Habbo habbo; public FriendsComposer(Habbo habbo) { @@ -67,7 +70,7 @@ public class FriendsComposer extends MessageComposer { return this.response; } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } return null; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumDataComposer.java index 588a974a..3a64640a 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumDataComposer.java @@ -12,6 +12,8 @@ import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.Outgoing; import com.eu.habbo.messages.outgoing.handshake.ConnectionErrorComposer; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -20,6 +22,8 @@ import java.sql.SQLException; public class GuildForumDataComposer extends MessageComposer { + private static final Logger LOGGER = LoggerFactory.getLogger(GuildForumDataComposer.class); + public final Guild guild; public Habbo habbo; @@ -73,7 +77,7 @@ public class GuildForumDataComposer extends MessageComposer { newComments = set.getInt(1); } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } response.appendInt(guild.getId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryItemsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryItemsComposer.java index 3a7dae3f..6fb8a0cd 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryItemsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryItemsComposer.java @@ -1,6 +1,5 @@ package com.eu.habbo.messages.outgoing.inventory; -import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.FurnitureType; import com.eu.habbo.habbohotel.items.interactions.InteractionGift; import com.eu.habbo.habbohotel.users.HabboItem; @@ -9,8 +8,12 @@ import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.Outgoing; import gnu.trove.map.TIntObjectMap; import gnu.trove.procedure.TIntObjectProcedure; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class InventoryItemsComposer extends MessageComposer implements TIntObjectProcedure { + private static final Logger LOGGER = LoggerFactory.getLogger(InventoryItemsComposer.class); + private final int page; private final int out; private final TIntObjectMap items; @@ -32,7 +35,7 @@ public class InventoryItemsComposer extends MessageComposer implements TIntObjec this.items.forEachEntry(this); return this.response; } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } return null; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java index da10c277..36e63b84 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java @@ -8,12 +8,16 @@ import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.Outgoing; import gnu.trove.map.hash.THashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; public class ModToolUserInfoComposer extends MessageComposer { + private static final Logger LOGGER = LoggerFactory.getLogger(ModToolUserInfoComposer.class); + private final ResultSet set; public ModToolUserInfoComposer(ResultSet set) { @@ -61,7 +65,7 @@ public class ModToolUserInfoComposer extends MessageComposer { return this.response; } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } return null; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/navigator/PrivateRoomsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/navigator/PrivateRoomsComposer.java index 8628a1d2..36a13e8c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/navigator/PrivateRoomsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/navigator/PrivateRoomsComposer.java @@ -1,14 +1,17 @@ package com.eu.habbo.messages.outgoing.navigator; -import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.Outgoing; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.List; public class PrivateRoomsComposer extends MessageComposer { + private static final Logger LOGGER = LoggerFactory.getLogger(PrivateRoomsComposer.class); + private final List rooms; public PrivateRoomsComposer(List rooms) { @@ -42,7 +45,7 @@ public class PrivateRoomsComposer extends MessageComposer { this.response.appendString("E"); return this.response; } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } return null; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/ProfileFriendsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/ProfileFriendsComposer.java index 4bf9a48e..4cae8211 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/ProfileFriendsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/ProfileFriendsComposer.java @@ -1,6 +1,5 @@ package com.eu.habbo.messages.outgoing.users; -import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.messenger.MessengerBuddy; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.ServerMessage; @@ -8,6 +7,8 @@ import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.Outgoing; import gnu.trove.map.hash.THashMap; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.List; @@ -15,6 +16,8 @@ import java.util.Map; import java.util.Random; public class ProfileFriendsComposer extends MessageComposer { + private static final Logger LOGGER = LoggerFactory.getLogger(ProfileFriendsComposer.class); + private final List lovers = new ArrayList<>(); private final List friends = new ArrayList<>(); private final List haters = new ArrayList<>(); @@ -47,7 +50,7 @@ public class ProfileFriendsComposer extends MessageComposer { } } } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } this.userId = habbo.getHabboInfo().getId(); @@ -101,7 +104,7 @@ public class ProfileFriendsComposer extends MessageComposer { this.response.appendString(this.haters.get(hatersIndex).getLook()); } } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UserCurrencyComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UserCurrencyComposer.java index d4e4df03..d974ce80 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UserCurrencyComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UserCurrencyComposer.java @@ -5,8 +5,12 @@ import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.Outgoing; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class UserCurrencyComposer extends MessageComposer { + private static final Logger LOGGER = LoggerFactory.getLogger(UserCurrencyComposer.class); + private final Habbo habbo; public UserCurrencyComposer(Habbo habbo) { @@ -23,7 +27,7 @@ public class UserCurrencyComposer extends MessageComposer { try { type = Integer.valueOf(s); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); return null; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UserProfileComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UserProfileComposer.java index 75895e72..b2944ea8 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UserProfileComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UserProfileComposer.java @@ -9,6 +9,8 @@ import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.Outgoing; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -20,6 +22,8 @@ import java.util.Date; import java.util.List; public class UserProfileComposer extends MessageComposer { + private static final Logger LOGGER = LoggerFactory.getLogger(UserProfileComposer.class); + private final HabboInfo habboInfo; private Habbo habbo; private GameClient viewer; @@ -60,7 +64,7 @@ public class UserProfileComposer extends MessageComposer { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } this.response.appendInt(achievementScore); diff --git a/src/main/java/com/eu/habbo/messages/rcon/ExecuteCommand.java b/src/main/java/com/eu/habbo/messages/rcon/ExecuteCommand.java index ca772404..fd16a35c 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/ExecuteCommand.java +++ b/src/main/java/com/eu/habbo/messages/rcon/ExecuteCommand.java @@ -4,8 +4,12 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.CommandHandler; import com.eu.habbo.habbohotel.users.Habbo; import com.google.gson.Gson; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ExecuteCommand extends RCONMessage { + private static final Logger LOGGER = LoggerFactory.getLogger(ExecuteCommand.class); + public ExecuteCommand() { super(JSONExecuteCommand.class); @@ -25,7 +29,7 @@ public class ExecuteCommand extends RCONMessage { + private static final Logger LOGGER = LoggerFactory.getLogger(GiveBadge.class); + public GiveBadge() { super(GiveBadgeJSON.class); @@ -74,7 +78,7 @@ public class GiveBadge extends RCONMessage { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); this.status = RCONMessage.STATUS_ERROR; this.message = e.getMessage(); } diff --git a/src/main/java/com/eu/habbo/messages/rcon/GiveCredits.java b/src/main/java/com/eu/habbo/messages/rcon/GiveCredits.java index 6c566e1d..60e9326a 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/GiveCredits.java +++ b/src/main/java/com/eu/habbo/messages/rcon/GiveCredits.java @@ -3,12 +3,16 @@ package com.eu.habbo.messages.rcon; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.Habbo; import com.google.gson.Gson; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class GiveCredits extends RCONMessage { + private static final Logger LOGGER = LoggerFactory.getLogger(GiveCredits.class); + public GiveCredits() { super(JSONGiveCredits.class); @@ -27,7 +31,7 @@ public class GiveCredits extends RCONMessage { statement.execute(); } catch (SQLException e) { this.status = RCONMessage.SYSTEM_ERROR; - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } this.message = "offline"; diff --git a/src/main/java/com/eu/habbo/messages/rcon/GivePixels.java b/src/main/java/com/eu/habbo/messages/rcon/GivePixels.java index 82b492c1..45001f98 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/GivePixels.java +++ b/src/main/java/com/eu/habbo/messages/rcon/GivePixels.java @@ -3,12 +3,16 @@ package com.eu.habbo.messages.rcon; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.Habbo; import com.google.gson.Gson; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class GivePixels extends RCONMessage { + private static final Logger LOGGER = LoggerFactory.getLogger(GivePixels.class); + public GivePixels() { super(JSONGivePixels.class); @@ -27,7 +31,7 @@ public class GivePixels extends RCONMessage { statement.execute(); } catch (SQLException e) { this.status = RCONMessage.SYSTEM_ERROR; - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } this.message = "offline"; diff --git a/src/main/java/com/eu/habbo/messages/rcon/GivePoints.java b/src/main/java/com/eu/habbo/messages/rcon/GivePoints.java index 072389b6..2afff479 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/GivePoints.java +++ b/src/main/java/com/eu/habbo/messages/rcon/GivePoints.java @@ -3,12 +3,16 @@ package com.eu.habbo.messages.rcon; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.Habbo; import com.google.gson.Gson; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class GivePoints extends RCONMessage { + private static final Logger LOGGER = LoggerFactory.getLogger(GivePoints.class); + public GivePoints() { super(JSONGivePoints.class); @@ -29,7 +33,7 @@ public class GivePoints extends RCONMessage { statement.execute(); } catch (SQLException e) { this.status = RCONMessage.SYSTEM_ERROR; - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } this.message = "offline"; diff --git a/src/main/java/com/eu/habbo/messages/rcon/GiveRespect.java b/src/main/java/com/eu/habbo/messages/rcon/GiveRespect.java index ee01e139..078f7143 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/GiveRespect.java +++ b/src/main/java/com/eu/habbo/messages/rcon/GiveRespect.java @@ -3,12 +3,16 @@ package com.eu.habbo.messages.rcon; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.Habbo; import com.google.gson.Gson; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class GiveRespect extends RCONMessage { + private static final Logger LOGGER = LoggerFactory.getLogger(GiveRespect.class); + public GiveRespect() { super(JSONGiveRespect.class); @@ -31,7 +35,7 @@ public class GiveRespect extends RCONMessage { statement.execute(); } catch (SQLException e) { this.status = RCONMessage.SYSTEM_ERROR; - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } this.message = "offline"; diff --git a/src/main/java/com/eu/habbo/messages/rcon/GiveUserClothing.java b/src/main/java/com/eu/habbo/messages/rcon/GiveUserClothing.java index 94c27399..41b81669 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/GiveUserClothing.java +++ b/src/main/java/com/eu/habbo/messages/rcon/GiveUserClothing.java @@ -7,12 +7,16 @@ import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys; import com.eu.habbo.messages.outgoing.users.UserClothesComposer; import com.google.gson.Gson; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class GiveUserClothing extends RCONMessage { + private static final Logger LOGGER = LoggerFactory.getLogger(GiveUserClothing.class); + public GiveUserClothing() { super(GiveUserClothing.JSONGiveUserClothing.class); } @@ -26,7 +30,7 @@ public class GiveUserClothing extends RCONMessage { + private static final Logger LOGGER = LoggerFactory.getLogger(IgnoreUser.class); + public IgnoreUser() { super(JSONIgnoreUser.class); } @@ -26,7 +30,7 @@ public class IgnoreUser extends RCONMessage { statement.setInt(2, object.target_id); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } this.message = "offline"; diff --git a/src/main/java/com/eu/habbo/messages/rcon/MuteUser.java b/src/main/java/com/eu/habbo/messages/rcon/MuteUser.java index abacad3e..711b7d22 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/MuteUser.java +++ b/src/main/java/com/eu/habbo/messages/rcon/MuteUser.java @@ -3,12 +3,16 @@ package com.eu.habbo.messages.rcon; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.Habbo; import com.google.gson.Gson; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class MuteUser extends RCONMessage { + private static final Logger LOGGER = LoggerFactory.getLogger(MuteUser.class); + public MuteUser() { super(MuteUser.JSON.class); } @@ -31,7 +35,7 @@ public class MuteUser extends RCONMessage { this.status = HABBO_NOT_FOUND; } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/messages/rcon/SendGift.java b/src/main/java/com/eu/habbo/messages/rcon/SendGift.java index 33a2cf46..8f644659 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/SendGift.java +++ b/src/main/java/com/eu/habbo/messages/rcon/SendGift.java @@ -6,6 +6,8 @@ import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer; import com.google.gson.Gson; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -13,6 +15,7 @@ import java.sql.ResultSet; import java.sql.SQLException; public class SendGift extends RCONMessage { + private static final Logger LOGGER = LoggerFactory.getLogger(SendGift.class); public SendGift() { super(SendGiftJSON.class); @@ -56,7 +59,7 @@ public class SendGift extends RCONMessage { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } else { username = habbo.getHabboInfo().getUsername(); diff --git a/src/main/java/com/eu/habbo/messages/rcon/SetMotto.java b/src/main/java/com/eu/habbo/messages/rcon/SetMotto.java index fc3546d5..88ce9c20 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/SetMotto.java +++ b/src/main/java/com/eu/habbo/messages/rcon/SetMotto.java @@ -4,12 +4,16 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDataComposer; import com.google.gson.Gson; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class SetMotto extends RCONMessage { + private static final Logger LOGGER = LoggerFactory.getLogger(SetMotto.class); + public SetMotto() { super(SetMottoJSON.class); } @@ -29,7 +33,7 @@ public class SetMotto extends RCONMessage { statement.execute(); } } catch (SQLException e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/messages/rcon/UpdateUser.java b/src/main/java/com/eu/habbo/messages/rcon/UpdateUser.java index 1e1a6bf2..7357a760 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/UpdateUser.java +++ b/src/main/java/com/eu/habbo/messages/rcon/UpdateUser.java @@ -6,12 +6,15 @@ import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDataComposer; import com.eu.habbo.messages.outgoing.users.MeMenuSettingsComposer; import com.eu.habbo.messages.outgoing.users.UpdateUserLookComposer; import com.google.gson.Gson; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class UpdateUser extends RCONMessage { + private static final Logger LOGGER = LoggerFactory.getLogger(UpdateUser.class); public UpdateUser() { super(UpdateUser.JSON.class); @@ -105,7 +108,7 @@ public class UpdateUser extends RCONMessage { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/networking/camera/CameraPacketHandler.java b/src/main/java/com/eu/habbo/networking/camera/CameraPacketHandler.java index 8d52ee08..b0dc0582 100644 --- a/src/main/java/com/eu/habbo/networking/camera/CameraPacketHandler.java +++ b/src/main/java/com/eu/habbo/networking/camera/CameraPacketHandler.java @@ -1,13 +1,16 @@ package com.eu.habbo.networking.camera; -import com.eu.habbo.Emulator; import com.eu.habbo.networking.camera.messages.incoming.*; import io.netty.buffer.ByteBuf; import io.netty.channel.Channel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.HashMap; public class CameraPacketHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(CameraPacketHandler.class); + private static CameraPacketHandler INSTANCE; private final HashMap> packetDefinitions; @@ -38,7 +41,7 @@ public class CameraPacketHandler { message.handle(channel); message.buffer.release(); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageHandler.java b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageHandler.java index 022d5f16..143b6c61 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageHandler.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageHandler.java @@ -8,11 +8,13 @@ import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.handler.codec.TooLongFrameException; - -import java.io.IOException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @ChannelHandler.Sharable public class GameMessageHandler extends ChannelInboundHandlerAdapter { + private static final Logger LOGGER = LoggerFactory.getLogger(GameMessageHandler.class); + @Override public void channelRegistered(ChannelHandlerContext ctx) { @@ -40,7 +42,7 @@ public class GameMessageHandler extends ChannelInboundHandlerAdapter { handler.run(); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } @@ -52,15 +54,15 @@ public class GameMessageHandler extends ChannelInboundHandlerAdapter { @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { if (cause instanceof TooLongFrameException) { - Emulator.getLogging().logErrorLine("Disconnecting client, reason: \"" + cause.getMessage() + "\"."); + LOGGER.error("Disconnecting client, reason: \"" + cause.getMessage() + "\"."); } else { cause.printStackTrace(); - Emulator.getLogging().logErrorLine("Disconnecting client, exception in GameMessageHander:"); - Emulator.getLogging().logErrorLine(cause.toString()); + LOGGER.error("Disconnecting client, exception in GameMessageHander:"); + LOGGER.error(cause.toString()); for (StackTraceElement element : cause.getStackTrace()) { - Emulator.getLogging().logErrorLine(element.toString()); + LOGGER.error(element.toString()); } } diff --git a/src/main/java/com/eu/habbo/threading/HabboExecutorService.java b/src/main/java/com/eu/habbo/threading/HabboExecutorService.java index be426435..36ccd05a 100644 --- a/src/main/java/com/eu/habbo/threading/HabboExecutorService.java +++ b/src/main/java/com/eu/habbo/threading/HabboExecutorService.java @@ -1,12 +1,15 @@ package com.eu.habbo.threading; -import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ThreadFactory; public class HabboExecutorService extends ScheduledThreadPoolExecutor { + private static final Logger LOGGER = LoggerFactory.getLogger(HabboExecutorService.class); + public HabboExecutorService(int corePoolSize, ThreadFactory threadFactory) { super(corePoolSize, threadFactory); } @@ -16,10 +19,7 @@ public class HabboExecutorService extends ScheduledThreadPoolExecutor { super.afterExecute(r, t); if (t != null && !(t instanceof IOException)) { - try { - Emulator.getLogging().logErrorLine(t); - } catch (Exception e) { - } + LOGGER.error("Error in HabboExecutorService", t); } } } diff --git a/src/main/java/com/eu/habbo/threading/RejectedExecutionHandlerImpl.java b/src/main/java/com/eu/habbo/threading/RejectedExecutionHandlerImpl.java index 2888ed04..1517ce17 100644 --- a/src/main/java/com/eu/habbo/threading/RejectedExecutionHandlerImpl.java +++ b/src/main/java/com/eu/habbo/threading/RejectedExecutionHandlerImpl.java @@ -1,14 +1,16 @@ package com.eu.habbo.threading; -import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.concurrent.RejectedExecutionHandler; import java.util.concurrent.ThreadPoolExecutor; public class RejectedExecutionHandlerImpl implements RejectedExecutionHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(RejectedExecutionHandlerImpl.class); @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { - Emulator.getLogging().logErrorLine(r.toString() + " is rejected"); + LOGGER.error(r.toString() + " is rejected"); } } diff --git a/src/main/java/com/eu/habbo/threading/ThreadPooling.java b/src/main/java/com/eu/habbo/threading/ThreadPooling.java index 160ca121..eb7e25c4 100644 --- a/src/main/java/com/eu/habbo/threading/ThreadPooling.java +++ b/src/main/java/com/eu/habbo/threading/ThreadPooling.java @@ -1,7 +1,6 @@ package com.eu.habbo.threading; import com.eu.habbo.Emulator; -import com.eu.habbo.util.imager.badges.BadgeImager; import io.netty.util.concurrent.DefaultThreadFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -20,7 +19,7 @@ public class ThreadPooling { public ThreadPooling(Integer threads) { this.threads = threads; - this.scheduledPool = new HabboExecutorService(this.threads, new DefaultThreadFactory("ArcturusThreadFactory")); + this.scheduledPool = new HabboExecutorService(this.threads, new DefaultThreadFactory("HabExec")); this.canAdd = true; LOGGER.info("Thread Pool -> Loaded!"); } diff --git a/src/main/java/com/eu/habbo/threading/runnables/OpenGift.java b/src/main/java/com/eu/habbo/threading/runnables/OpenGift.java index 23f72bba..03e02605 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/OpenGift.java +++ b/src/main/java/com/eu/habbo/threading/runnables/OpenGift.java @@ -11,6 +11,8 @@ import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer; import com.eu.habbo.messages.outgoing.inventory.InventoryUpdateItemComposer; import com.eu.habbo.messages.outgoing.rooms.items.PresentItemOpenedComposer; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.HashMap; @@ -18,6 +20,8 @@ import java.util.List; import java.util.Map; public class OpenGift implements Runnable { + private static final Logger LOGGER = LoggerFactory.getLogger(OpenGift.class); + private final HabboItem item; private final Habbo habbo; private final Room room; @@ -100,7 +104,7 @@ public class OpenGift implements Runnable { this.habbo.getClient().sendResponse(new PresentItemOpenedComposer(inside, "", false)); } } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboBadge.java b/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboBadge.java index b13decab..2910fedd 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboBadge.java +++ b/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboBadge.java @@ -2,12 +2,16 @@ package com.eu.habbo.threading.runnables; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.Habbo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; class QueryDeleteHabboBadge implements Runnable { + private static final Logger LOGGER = LoggerFactory.getLogger(QueryDeleteHabboBadge.class); + private final String name; private final Habbo habbo; @@ -23,7 +27,7 @@ class QueryDeleteHabboBadge implements Runnable { statement.setString(2, this.name); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboItem.java b/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboItem.java index d12d16de..91579bfd 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboItem.java +++ b/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboItem.java @@ -2,12 +2,16 @@ package com.eu.habbo.threading.runnables; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.HabboItem; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class QueryDeleteHabboItem implements Runnable { + private static final Logger LOGGER = LoggerFactory.getLogger(QueryDeleteHabboItem.class); + private final int itemId; public QueryDeleteHabboItem(int itemId) { @@ -24,7 +28,7 @@ public class QueryDeleteHabboItem implements Runnable { statement.setInt(1, this.itemId); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboItems.java b/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboItems.java index 20340ee1..71e30aca 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboItems.java +++ b/src/main/java/com/eu/habbo/threading/runnables/QueryDeleteHabboItems.java @@ -3,12 +3,16 @@ package com.eu.habbo.threading.runnables; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.HabboItem; import gnu.trove.map.TIntObjectMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class QueryDeleteHabboItems implements Runnable { + private static final Logger LOGGER = LoggerFactory.getLogger(QueryDeleteHabboItems.class); + private TIntObjectMap items; public QueryDeleteHabboItems(TIntObjectMap items) { @@ -28,7 +32,7 @@ public class QueryDeleteHabboItems implements Runnable { statement.executeBatch(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } this.items.clear(); diff --git a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleport.java b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleport.java index 399e683f..9228596a 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleport.java +++ b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleport.java @@ -1,6 +1,5 @@ package com.eu.habbo.threading.runnables; -import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomUnit; @@ -8,10 +7,14 @@ import com.eu.habbo.habbohotel.rooms.RoomUnitStatus; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.rooms.users.RoomUnitOnRollerComposer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.LinkedList; public class RoomUnitTeleport implements Runnable { + private static final Logger LOGGER = LoggerFactory.getLogger(RoomUnitTeleport.class); + private RoomUnit roomUnit; private Room room; private int x; @@ -42,7 +45,7 @@ public class RoomUnitTeleport implements Runnable { try { topItem.onWalkOff(this.roomUnit, this.room, new Object[]{this}); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } this.roomUnit.setPath(new LinkedList<>()); diff --git a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleportWalkToAction.java b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleportWalkToAction.java index f3ab7254..61c65c74 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleportWalkToAction.java +++ b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleportWalkToAction.java @@ -5,8 +5,12 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class RoomUnitTeleportWalkToAction implements Runnable { + private static final Logger LOGGER = LoggerFactory.getLogger(RoomUnitTeleportWalkToAction.class); + private final Habbo habbo; private final HabboItem habboItem; private final Room room; @@ -29,7 +33,7 @@ public class RoomUnitTeleportWalkToAction implements Runnable { try { this.habboItem.onClick(this.habbo.getClient(), this.room, new Object[]{0}); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } else { if (tile.isWalkable()) { diff --git a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitVendingMachineAction.java b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitVendingMachineAction.java index fde3f333..926e38f3 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitVendingMachineAction.java +++ b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitVendingMachineAction.java @@ -5,8 +5,12 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class RoomUnitVendingMachineAction implements Runnable { + private static final Logger LOGGER = LoggerFactory.getLogger(RoomUnitVendingMachineAction.class); + private final Habbo habbo; private final HabboItem habboItem; private final Room room; @@ -28,7 +32,7 @@ public class RoomUnitVendingMachineAction implements Runnable { try { this.habboItem.onClick(this.habbo.getClient(), this.room, new Object[]{0}); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } else { if (this.room.getLayout().getTile(tile.x, tile.y).isWalkable()) { diff --git a/src/main/java/com/eu/habbo/threading/runnables/SaveScoreForTeam.java b/src/main/java/com/eu/habbo/threading/runnables/SaveScoreForTeam.java index d046b669..44151ae6 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/SaveScoreForTeam.java +++ b/src/main/java/com/eu/habbo/threading/runnables/SaveScoreForTeam.java @@ -4,12 +4,16 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.games.Game; import com.eu.habbo.habbohotel.games.GamePlayer; import com.eu.habbo.habbohotel.games.GameTeam; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class SaveScoreForTeam implements Runnable { + private static final Logger LOGGER = LoggerFactory.getLogger(SaveScoreForTeam.class); + public final GameTeam team; public final Game game; @@ -34,7 +38,7 @@ public class SaveScoreForTeam implements Runnable { statement.executeBatch(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/TeleportInteraction.java b/src/main/java/com/eu/habbo/threading/runnables/TeleportInteraction.java index 3513b8f6..83c6388d 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/TeleportInteraction.java +++ b/src/main/java/com/eu/habbo/threading/runnables/TeleportInteraction.java @@ -11,8 +11,12 @@ import com.eu.habbo.messages.outgoing.rooms.users.RoomUserEffectComposer; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserRemoveComposer; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer; import com.eu.habbo.messages.outgoing.rooms.users.RoomUsersComposer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; class TeleportInteraction extends Thread { + private static final Logger LOGGER = LoggerFactory.getLogger(TeleportInteraction.class); + private final Room room; private final GameClient client; private final HabboItem teleportOne; @@ -112,7 +116,7 @@ class TeleportInteraction extends Thread { } } } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java b/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java index b79c87ec..70ea304b 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java +++ b/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java @@ -2,12 +2,16 @@ package com.eu.habbo.threading.runnables; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.modtool.ModToolIssue; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class UpdateModToolIssue implements Runnable { + private static final Logger LOGGER = LoggerFactory.getLogger(UpdateModToolIssue.class); + private final ModToolIssue issue; public UpdateModToolIssue(ModToolIssue issue) { @@ -24,7 +28,7 @@ public class UpdateModToolIssue implements Runnable { statement.setInt(5, this.issue.id); statement.execute(); } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/freeze/FreezeHandleSnowballExplosion.java b/src/main/java/com/eu/habbo/threading/runnables/freeze/FreezeHandleSnowballExplosion.java index c7b923a6..c8ba4612 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/freeze/FreezeHandleSnowballExplosion.java +++ b/src/main/java/com/eu/habbo/threading/runnables/freeze/FreezeHandleSnowballExplosion.java @@ -10,8 +10,12 @@ import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; import gnu.trove.set.hash.THashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; class FreezeHandleSnowballExplosion implements Runnable { + private static final Logger LOGGER = LoggerFactory.getLogger(FreezeHandleSnowballExplosion.class); + private final FreezeThrowSnowball thrownData; public FreezeHandleSnowballExplosion(FreezeThrowSnowball thrownData) { @@ -100,7 +104,7 @@ class FreezeHandleSnowballExplosion implements Runnable { Emulator.getThreading().run(new FreezeResetExplosionTiles(freezeTiles, this.thrownData.room), 1000); } catch (Exception e) { - logger.error("Caught exception", e); + LOGGER.error("Caught exception", e); } } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionTwo.java b/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionTwo.java index cdefe057..97b04dca 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionTwo.java +++ b/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionTwo.java @@ -4,6 +4,8 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.HabboItem; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -11,6 +13,8 @@ import java.sql.ResultSet; import java.sql.SQLException; class HopperActionTwo implements Runnable { + private static final Logger LOGGER = LoggerFactory.getLogger(HopperActionTwo.class); + private final HabboItem teleportOne; private final Room room; private final GameClient client; @@ -39,7 +43,7 @@ class HopperActionTwo implements Runnable { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } if (targetRoomId != 0 && targetItemId != 0) { diff --git a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionTwo.java b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionTwo.java index 3e362919..feedd769 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionTwo.java +++ b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionTwo.java @@ -9,6 +9,8 @@ import com.eu.habbo.habbohotel.rooms.RoomUnitStatus; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer; import com.eu.habbo.threading.runnables.HabboItemNewState; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; @@ -16,6 +18,8 @@ import java.sql.ResultSet; import java.sql.SQLException; class TeleportActionTwo implements Runnable { + private static final Logger LOGGER = LoggerFactory.getLogger(TeleportActionTwo.class); + private final HabboItem currentTeleport; private final Room room; private final GameClient client; @@ -72,7 +76,7 @@ class TeleportActionTwo implements Runnable { } } } catch (SQLException e) { - logger.error("Caught SQL exception", e); + LOGGER.error("Caught SQL exception", e); } } From a0582c09eeef826b1ff1b6b7fa810988d9076ae3 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Tue, 5 May 2020 00:20:07 +0200 Subject: [PATCH 054/215] Re-added Jansi, moved ClientMessage logging. --- pom.xml | 6 ++++ src/main/java/com/eu/habbo/Emulator.java | 15 ++++++++++ .../com/eu/habbo/messages/ClientMessage.java | 11 ++----- .../com/eu/habbo/messages/PacketManager.java | 19 ++++-------- .../com/eu/habbo/messages/ServerMessage.java | 11 ++----- .../java/com/eu/habbo/networking/Server.java | 11 ++++--- .../networking/gameserver/GameServer.java | 24 +++++++++------ .../decoders/GameClientMessageLogger.java | 23 ++++++++++++++ ...der.java => GameServerMessageEncoder.java} | 3 +- .../encoders/GameServerMessageLogger.java | 12 +++----- src/main/java/com/eu/habbo/util/ANSI.java | 16 ++++++++++ src/main/java/com/eu/habbo/util/HexUtils.java | 30 ------------------- .../java/com/eu/habbo/util/PacketUtils.java | 19 ++++++++++++ 13 files changed, 115 insertions(+), 85 deletions(-) create mode 100644 src/main/java/com/eu/habbo/networking/gameserver/decoders/GameClientMessageLogger.java rename src/main/java/com/eu/habbo/networking/gameserver/encoders/{ServerMessageEncoder.java => GameServerMessageEncoder.java} (78%) create mode 100644 src/main/java/com/eu/habbo/util/ANSI.java create mode 100644 src/main/java/com/eu/habbo/util/PacketUtils.java diff --git a/pom.xml b/pom.xml index 68c85820..35de71dc 100644 --- a/pom.xml +++ b/pom.xml @@ -154,6 +154,12 @@ compile + + org.fusesource.jansi + jansi + 1.18 + + joda-time joda-time diff --git a/src/main/java/com/eu/habbo/Emulator.java b/src/main/java/com/eu/habbo/Emulator.java index 8aece311..e361e1e5 100644 --- a/src/main/java/com/eu/habbo/Emulator.java +++ b/src/main/java/com/eu/habbo/Emulator.java @@ -1,6 +1,8 @@ package com.eu.habbo; import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.core.ConsoleAppender; import com.eu.habbo.core.*; import com.eu.habbo.core.consolecommands.ConsoleCommand; import com.eu.habbo.database.Database; @@ -30,6 +32,8 @@ import java.util.concurrent.ThreadLocalRandom; public final class Emulator { private static final Logger LOGGER = LoggerFactory.getLogger(Emulator.class); + private static final String OS_NAME = System.getProperty("os.name"); + private static final String CLASS_PATH = System.getProperty("java.class.path"); public final static int MAJOR = 2; public final static int MINOR = 4; @@ -81,6 +85,17 @@ public final class Emulator { public static void main(String[] args) throws Exception { try { + // Check if running on Windows and not in IntelliJ. + // If so, we need to reconfigure the console appender and enable Jansi for colors. + if (OS_NAME.startsWith("Windows") && !CLASS_PATH.contains("idea_rt.jar")) { + ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); + ConsoleAppender appender = (ConsoleAppender) root.getAppender("Console"); + + appender.stop(); + appender.setWithJansi(true); + appender.start(); + } + Locale.setDefault(new Locale("en")); setBuild(); Emulator.stopped = false; diff --git a/src/main/java/com/eu/habbo/messages/ClientMessage.java b/src/main/java/com/eu/habbo/messages/ClientMessage.java index 4cbd2f2d..a5185cb9 100644 --- a/src/main/java/com/eu/habbo/messages/ClientMessage.java +++ b/src/main/java/com/eu/habbo/messages/ClientMessage.java @@ -1,10 +1,9 @@ package com.eu.habbo.messages; +import com.eu.habbo.util.PacketUtils; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import java.nio.charset.Charset; - public class ClientMessage { private final int header; private final ByteBuf buffer; @@ -65,13 +64,7 @@ public class ClientMessage { } public String getMessageBody() { - String consoleText = this.buffer.toString(Charset.defaultCharset()); - - for (int i = -1; i < 31; i++) { - consoleText = consoleText.replace(Character.toString((char) i), "[" + i + "]"); - } - - return consoleText; + return PacketUtils.formatPacket(this.buffer); } public int bytesAvailable() { diff --git a/src/main/java/com/eu/habbo/messages/PacketManager.java b/src/main/java/com/eu/habbo/messages/PacketManager.java index d7657c25..8360b2bb 100644 --- a/src/main/java/com/eu/habbo/messages/PacketManager.java +++ b/src/main/java/com/eu/habbo/messages/PacketManager.java @@ -1,7 +1,6 @@ package com.eu.habbo.messages; import com.eu.habbo.Emulator; -import com.eu.habbo.core.CreditsScheduler; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.messages.incoming.Incoming; import com.eu.habbo.messages.incoming.MessageHandler; @@ -53,9 +52,9 @@ import com.eu.habbo.messages.incoming.rooms.items.jukebox.*; import com.eu.habbo.messages.incoming.rooms.items.lovelock.LoveLockStartConfirmEvent; import com.eu.habbo.messages.incoming.rooms.items.rentablespace.RentSpaceCancelEvent; import com.eu.habbo.messages.incoming.rooms.items.rentablespace.RentSpaceEvent; -import com.eu.habbo.messages.incoming.rooms.items.youtube.YoutubeRequestStateChange; -import com.eu.habbo.messages.incoming.rooms.items.youtube.YoutubeRequestPlaylists; import com.eu.habbo.messages.incoming.rooms.items.youtube.YoutubeRequestPlaylistChange; +import com.eu.habbo.messages.incoming.rooms.items.youtube.YoutubeRequestPlaylists; +import com.eu.habbo.messages.incoming.rooms.items.youtube.YoutubeRequestStateChange; import com.eu.habbo.messages.incoming.rooms.pets.*; import com.eu.habbo.messages.incoming.rooms.promotions.BuyRoomPromotionEvent; import com.eu.habbo.messages.incoming.rooms.promotions.RequestPromotionRoomsEvent; @@ -169,7 +168,7 @@ public class PacketManager { if (client.getHabbo() == null && !handlerClass.isAnnotationPresent(NoAuthMessage.class)) { if (DEBUG_SHOW_PACKETS) { - LOGGER.debug("[CLIENT][NOT LOGGED IN][{}] => {}", packet.getMessageId(), packet.getMessageBody()); + LOGGER.warn("Client packet {} requires an authenticated session.", packet.getMessageId()); } return; @@ -180,7 +179,7 @@ public class PacketManager { if (handler.getRatelimit() > 0) { if (client.messageTimestamps.containsKey(handlerClass) && System.currentTimeMillis() - client.messageTimestamps.get(handlerClass) < handler.getRatelimit()) { if (PacketManager.DEBUG_SHOW_PACKETS) { - LOGGER.debug("[CLIENT][{}][RATELIMITED] => {}", packet.getMessageId(), packet.getMessageBody()); + LOGGER.warn("Client packet {} was ratelimited.", packet.getMessageId()); } return; @@ -189,12 +188,8 @@ public class PacketManager { } } - if (PacketManager.DEBUG_SHOW_PACKETS) { - LOGGER.debug("[CLIENT][{}] => {}", packet.getMessageId(), packet.getMessageBody()); - } - if (logList.contains(packet.getMessageId()) && client.getHabbo() != null) { - LOGGER.debug("[CLIENT][{}][{}] => {}", client.getHabbo().getHabboInfo().getUsername(), packet.getMessageId(), packet.getMessageBody()); + LOGGER.info("User {} sent packet {} with body {}", client.getHabbo().getHabboInfo().getUsername(), packet.getMessageId(), packet.getMessageBody()); } handler.client = client; @@ -209,10 +204,6 @@ public class PacketManager { if (!handler.isCancelled) { handler.handle(); } - } else { - if (PacketManager.DEBUG_SHOW_PACKETS) { - LOGGER.debug("[CLIENT][UNDEFINED][{}] => {}", packet.getMessageId(), packet.getMessageBody()); - } } } catch (Exception e) { LOGGER.error("Caught exception", e); diff --git a/src/main/java/com/eu/habbo/messages/ServerMessage.java b/src/main/java/com/eu/habbo/messages/ServerMessage.java index e5cf3204..b6e5a840 100644 --- a/src/main/java/com/eu/habbo/messages/ServerMessage.java +++ b/src/main/java/com/eu/habbo/messages/ServerMessage.java @@ -1,10 +1,9 @@ package com.eu.habbo.messages; -import com.eu.habbo.util.HexUtils; +import com.eu.habbo.util.PacketUtils; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufOutputStream; import io.netty.buffer.Unpooled; -import io.netty.util.IllegalReferenceCountException; import io.netty.util.ReferenceCounted; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -173,13 +172,7 @@ public class ServerMessage implements ReferenceCounted { } public String getBodyString() { - byte[] data = this.get().array(); - - if (data.length == 0) { - return ""; - } - - return HexUtils.pretty(data); + return PacketUtils.formatPacket(this.channelBuffer); } public int getHeader() { diff --git a/src/main/java/com/eu/habbo/networking/Server.java b/src/main/java/com/eu/habbo/networking/Server.java index f59a6d5a..800529c1 100644 --- a/src/main/java/com/eu/habbo/networking/Server.java +++ b/src/main/java/com/eu/habbo/networking/Server.java @@ -8,6 +8,7 @@ import io.netty.channel.EventLoopGroup; import io.netty.channel.FixedRecvByteBufAllocator; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.nio.NioServerSocketChannel; +import io.netty.util.concurrent.DefaultThreadFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -29,8 +30,10 @@ public abstract class Server { this.host = host; this.port = port; - this.bossGroup = new NioEventLoopGroup(bossGroupThreads); - this.workerGroup = new NioEventLoopGroup(workerGroupThreads); + String threadName = name.replace("Server", "").replace(" ", ""); + + this.bossGroup = new NioEventLoopGroup(bossGroupThreads, new DefaultThreadFactory(threadName + "Boss")); + this.workerGroup = new NioEventLoopGroup(workerGroupThreads, new DefaultThreadFactory(threadName + "Worker")); this.serverBootstrap = new ServerBootstrap(); } @@ -40,8 +43,8 @@ public abstract class Server { this.serverBootstrap.childOption(ChannelOption.TCP_NODELAY, true); this.serverBootstrap.childOption(ChannelOption.SO_KEEPALIVE, true); this.serverBootstrap.childOption(ChannelOption.SO_REUSEADDR, true); - this.serverBootstrap.childOption(ChannelOption.SO_RCVBUF, 5120); - this.serverBootstrap.childOption(ChannelOption.RCVBUF_ALLOCATOR, new FixedRecvByteBufAllocator(5120)); + this.serverBootstrap.childOption(ChannelOption.SO_RCVBUF, 4096); + this.serverBootstrap.childOption(ChannelOption.RCVBUF_ALLOCATOR, new FixedRecvByteBufAllocator(4096)); this.serverBootstrap.childOption(ChannelOption.ALLOCATOR, new UnpooledByteBufAllocator(false)); } diff --git a/src/main/java/com/eu/habbo/networking/gameserver/GameServer.java b/src/main/java/com/eu/habbo/networking/gameserver/GameServer.java index 933eb65a..bbd2f4bf 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/GameServer.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/GameServer.java @@ -5,7 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClientManager; import com.eu.habbo.messages.PacketManager; import com.eu.habbo.networking.Server; import com.eu.habbo.networking.gameserver.decoders.*; -import com.eu.habbo.networking.gameserver.encoders.ServerMessageEncoder; +import com.eu.habbo.networking.gameserver.encoders.GameServerMessageEncoder; import com.eu.habbo.networking.gameserver.encoders.GameServerMessageLogger; import io.netty.channel.ChannelInitializer; import io.netty.channel.socket.SocketChannel; @@ -30,17 +30,23 @@ public class GameServer extends Server { public void initChannel(SocketChannel ch) throws Exception { ch.pipeline().addLast("logger", new LoggingHandler()); + // Logger. + + // Decoders. - ch.pipeline().addLast( - new GamePolicyDecoder(), - new GameByteFrameDecoder(), - new GameByteDecoder(), - new GameMessageRateLimit(), - new GameMessageHandler() - ); + ch.pipeline().addLast(new GamePolicyDecoder()); + ch.pipeline().addLast(new GameByteFrameDecoder()); + ch.pipeline().addLast(new GameByteDecoder()); + + if (PacketManager.DEBUG_SHOW_PACKETS) { + ch.pipeline().addLast(new GameClientMessageLogger()); + } + + ch.pipeline().addLast(new GameMessageRateLimit()); + ch.pipeline().addLast(new GameMessageHandler()); // Encoders. - ch.pipeline().addLast(new ServerMessageEncoder()); + ch.pipeline().addLast(new GameServerMessageEncoder()); if (PacketManager.DEBUG_SHOW_PACKETS) { ch.pipeline().addLast(new GameServerMessageLogger()); diff --git a/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameClientMessageLogger.java b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameClientMessageLogger.java new file mode 100644 index 00000000..8891e5a2 --- /dev/null +++ b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameClientMessageLogger.java @@ -0,0 +1,23 @@ +package com.eu.habbo.networking.gameserver.decoders; + +import com.eu.habbo.messages.ClientMessage; +import com.eu.habbo.util.ANSI; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.MessageToMessageDecoder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.List; + +public class GameClientMessageLogger extends MessageToMessageDecoder { + + private static final Logger LOGGER = LoggerFactory.getLogger(GameClientMessageLogger.class); + + @Override + protected void decode(ChannelHandlerContext ctx, ClientMessage message, List out) { + LOGGER.debug(String.format("[" + ANSI.GREEN + "CLIENT" + ANSI.DEFAULT + "][%-4d] => %s", message.getMessageId(), message.getMessageBody())); + + out.add(message); + } + +} diff --git a/src/main/java/com/eu/habbo/networking/gameserver/encoders/ServerMessageEncoder.java b/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageEncoder.java similarity index 78% rename from src/main/java/com/eu/habbo/networking/gameserver/encoders/ServerMessageEncoder.java rename to src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageEncoder.java index 3baba4ce..a3a59dbd 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/encoders/ServerMessageEncoder.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageEncoder.java @@ -4,9 +4,8 @@ import com.eu.habbo.messages.ServerMessage; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToByteEncoder; -import io.netty.util.IllegalReferenceCountException; -public class ServerMessageEncoder extends MessageToByteEncoder { +public class GameServerMessageEncoder extends MessageToByteEncoder { @Override protected void encode(ChannelHandlerContext ctx, ServerMessage message, ByteBuf out) { diff --git a/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java b/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java index b6ac3cf3..bcbe5b13 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java @@ -1,6 +1,7 @@ package com.eu.habbo.networking.gameserver.encoders; import com.eu.habbo.messages.ServerMessage; +import com.eu.habbo.util.ANSI; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToMessageEncoder; import org.slf4j.Logger; @@ -13,15 +14,10 @@ public class GameServerMessageLogger extends MessageToMessageEncoder out) throws Exception { - LOGGER.debug("[SERVER][{}]", message.getHeader()); - - String body = message.getBodyString(); - if (body == null || body.length() == 0) { - LOGGER.debug("\n" + message.getBodyString()); - } + protected void encode(ChannelHandlerContext ctx, ServerMessage message, List out) { + LOGGER.debug(String.format("[" + ANSI.BLUE + "SERVER" + ANSI.DEFAULT + "][%-4d] => %s", message.getHeader(), message.getBodyString())); out.add(message.retain()); } -} +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/util/ANSI.java b/src/main/java/com/eu/habbo/util/ANSI.java new file mode 100644 index 00000000..4c59761f --- /dev/null +++ b/src/main/java/com/eu/habbo/util/ANSI.java @@ -0,0 +1,16 @@ +package com.eu.habbo.util; + +import ch.qos.logback.core.pattern.color.ANSIConstants; + +public class ANSI { + + public static final String RED = "\u001B[" + ANSIConstants.RED_FG + "m"; + public static final String GREEN = "\u001B[" + ANSIConstants.GREEN_FG + "m"; + public static final String YELLOW = "\u001B[" + ANSIConstants.YELLOW_FG + "m"; + public static final String BLUE = "\u001B[" + ANSIConstants.BLUE_FG + "m"; + public static final String MAGENTA = "\u001B[" + ANSIConstants.MAGENTA_FG + "m"; + public static final String CYAN = "\u001B[" + ANSIConstants.CYAN_FG + "m"; + public static final String WHITE = "\u001B[" + ANSIConstants.WHITE_FG + "m"; + public static final String DEFAULT = "\u001B[" + ANSIConstants.DEFAULT_FG + "m"; + +} diff --git a/src/main/java/com/eu/habbo/util/HexUtils.java b/src/main/java/com/eu/habbo/util/HexUtils.java index 63846653..82ad1990 100644 --- a/src/main/java/com/eu/habbo/util/HexUtils.java +++ b/src/main/java/com/eu/habbo/util/HexUtils.java @@ -1,7 +1,5 @@ package com.eu.habbo.util; -import java.nio.charset.StandardCharsets; - public class HexUtils { private static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray(); @@ -26,32 +24,4 @@ public class HexUtils { return data; } - public static String pretty(byte[] array) { - final int width = 32; - - StringBuilder builder = new StringBuilder(); - - for (int rowOffset = 0; rowOffset < array.length; rowOffset += width) { - builder.append(String.format("%06d: ", rowOffset)); - - for (int index = 0; index < width; index++) { - if (rowOffset + index < array.length) { - builder.append(String.format("%02x ", array[rowOffset + index])); - } else { - builder.append(" "); - } - } - - int asciiWidth = Math.min(width, array.length - rowOffset); - builder.append(" | "); - builder.append(new String(array, rowOffset, asciiWidth, StandardCharsets.UTF_8).replaceAll("\r\n", " ").replaceAll("\n", " ")); - - if (rowOffset + width < array.length) { - builder.append(String.format("%n")); - } - } - - return builder.toString(); - } - } diff --git a/src/main/java/com/eu/habbo/util/PacketUtils.java b/src/main/java/com/eu/habbo/util/PacketUtils.java new file mode 100644 index 00000000..855ca9ae --- /dev/null +++ b/src/main/java/com/eu/habbo/util/PacketUtils.java @@ -0,0 +1,19 @@ +package com.eu.habbo.util; + +import io.netty.buffer.ByteBuf; + +import java.nio.charset.Charset; + +public class PacketUtils { + + public static String formatPacket(ByteBuf buffer) { + String result = buffer.toString(Charset.defaultCharset()); + + for (int i = -1; i < 31; i++) { + result = result.replace(Character.toString((char) i), "[" + i + "]"); + } + + return result; + } + +} From 1bd9db75a6cdb960dffad44dabc59cabb2878497 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Tue, 5 May 2020 00:22:54 +0200 Subject: [PATCH 055/215] Added logback xml because it was ignored somehow. --- .gitignore | 1 - src/main/resources/logback.xml | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/logback.xml diff --git a/.gitignore b/.gitignore index 54f0682d..94c0cbd9 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,6 @@ target/** TODO.txt packet.pkt plugins/** -src/main/resources/ src/test/ target/ config.ini diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml new file mode 100644 index 00000000..8e8ca6b1 --- /dev/null +++ b/src/main/resources/logback.xml @@ -0,0 +1,21 @@ + + + + false + + %d{HH:mm:ss.SSS} [%-14thread] %highlight(%-5level) %cyan(%-36logger{36}) - %msg%n + + + + + + + + + + + + + + + \ No newline at end of file From a7946b4adcce7c496c3298a62da22321d46687e4 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Tue, 5 May 2020 00:28:25 +0200 Subject: [PATCH 056/215] Replace remainder sout with logger. --- .../core/consolecommands/ConsoleCommand.java | 7 ++-- .../consolecommands/ConsoleInfoCommand.java | 32 +++++++++++-------- .../ConsoleReconnectCameraCommand.java | 6 +++- .../consolecommands/ConsoleTestCommand.java | 6 +++- .../ShowInteractionsCommand.java | 6 +++- .../consolecommands/ShowRCONCommands.java | 6 +++- .../teleport/TeleportActionThree.java | 2 +- 7 files changed, 42 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java index 43aa98d0..23604f3e 100644 --- a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java +++ b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java @@ -5,7 +5,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public abstract class ConsoleCommand { - private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleCommand.class); private static final THashMap commands = new THashMap<>(); @@ -48,11 +47,11 @@ public abstract class ConsoleCommand { LOGGER.error("Caught exception", e); } } else { - System.out.println("Unknown Console Command " + message[0]); - System.out.println("Commands Available (" + commands.size() + "): "); + LOGGER.info("Unknown Console Command " + message[0]); + LOGGER.info("Commands Available (" + commands.size() + "): "); for (ConsoleCommand c : commands.values()) { - System.out.println(c.key + " - " + c.usage); + LOGGER.info(c.key + " - " + c.usage); } } } diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java index c36f82bf..db7c22bf 100644 --- a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java +++ b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java @@ -2,10 +2,14 @@ package com.eu.habbo.core.consolecommands; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.catalog.CatalogManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.concurrent.TimeUnit; public class ConsoleInfoCommand extends ConsoleCommand { + private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleInfoCommand.class); + public ConsoleInfoCommand() { super("info", "Show current statistics."); } @@ -18,21 +22,21 @@ public class ConsoleInfoCommand extends ConsoleCommand { long minute = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60); long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) * 60); - System.out.println("Emulator version: " + Emulator.version); - System.out.println("Emulator build: " + Emulator.build); + LOGGER.info("Emulator version: " + Emulator.version); + LOGGER.info("Emulator build: " + Emulator.build); - System.out.println(""); + LOGGER.info(""); - System.out.println("Hotel Statistics"); - System.out.println("- Users: " + Emulator.getGameEnvironment().getHabboManager().getOnlineCount()); - System.out.println("- Rooms: " + Emulator.getGameEnvironment().getRoomManager().getActiveRooms().size()); - System.out.println("- Shop: " + Emulator.getGameEnvironment().getCatalogManager().catalogPages.size() + " pages and " + CatalogManager.catalogItemAmount + " items."); - System.out.println("- Furni: " + Emulator.getGameEnvironment().getItemManager().getItems().size() + " items."); - System.out.println(""); - System.out.println("Server Statistics"); - System.out.println("- Uptime: " + day + (day > 1 ? " days, " : " day, ") + hours + (hours > 1 ? " hours, " : " hour, ") + minute + (minute > 1 ? " minutes, " : " minute, ") + second + (second > 1 ? " seconds!" : " second!")); - System.out.println("- RAM Usage: " + (Emulator.getRuntime().totalMemory() - Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "/" + (Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "MB"); - System.out.println("- CPU Cores: " + Emulator.getRuntime().availableProcessors()); - System.out.println("- Total Memory: " + Emulator.getRuntime().maxMemory() / (1024 * 1024) + "MB"); + LOGGER.info("Hotel Statistics"); + LOGGER.info("- Users: " + Emulator.getGameEnvironment().getHabboManager().getOnlineCount()); + LOGGER.info("- Rooms: " + Emulator.getGameEnvironment().getRoomManager().getActiveRooms().size()); + LOGGER.info("- Shop: " + Emulator.getGameEnvironment().getCatalogManager().catalogPages.size() + " pages and " + CatalogManager.catalogItemAmount + " items."); + LOGGER.info("- Furni: " + Emulator.getGameEnvironment().getItemManager().getItems().size() + " items."); + LOGGER.info(""); + LOGGER.info("Server Statistics"); + LOGGER.info("- Uptime: " + day + (day > 1 ? " days, " : " day, ") + hours + (hours > 1 ? " hours, " : " hour, ") + minute + (minute > 1 ? " minutes, " : " minute, ") + second + (second > 1 ? " seconds!" : " second!")); + LOGGER.info("- RAM Usage: " + (Emulator.getRuntime().totalMemory() - Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "/" + (Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "MB"); + LOGGER.info("- CPU Cores: " + Emulator.getRuntime().availableProcessors()); + LOGGER.info("- Total Memory: " + Emulator.getRuntime().maxMemory() / (1024 * 1024) + "MB"); } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleReconnectCameraCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleReconnectCameraCommand.java index 0520a5e3..587130d1 100644 --- a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleReconnectCameraCommand.java +++ b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleReconnectCameraCommand.java @@ -1,15 +1,19 @@ package com.eu.habbo.core.consolecommands; import com.eu.habbo.networking.camera.CameraClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ConsoleReconnectCameraCommand extends ConsoleCommand { + private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleReconnectCameraCommand.class); + public ConsoleReconnectCameraCommand() { super("camera", "Attempt to reconnect to the camera server."); } @Override public void handle(String[] args) throws Exception { - System.out.println("Connecting to the camera..."); + LOGGER.info("Connecting to the camera..."); CameraClient.attemptReconnect = true; } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleTestCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleTestCommand.java index d40fb13e..cd02b90c 100644 --- a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleTestCommand.java +++ b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleTestCommand.java @@ -3,8 +3,12 @@ package com.eu.habbo.core.consolecommands; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.Habbo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ConsoleTestCommand extends ConsoleCommand { + private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleTestCommand.class); + public ConsoleTestCommand() { super("test", "This is just a test."); } @@ -12,7 +16,7 @@ public class ConsoleTestCommand extends ConsoleCommand { @Override public void handle(String[] args) throws Exception { if (Emulator.debugging) { - System.out.println("This is a test command for live debugging."); + LOGGER.info("This is a test command for live debugging."); //AchievementManager.progressAchievement(4, Emulator.getGameEnvironment().getAchievementManager().getAchievement("AllTimeHotelPresence"), 30); diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ShowInteractionsCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ShowInteractionsCommand.java index 9aa6eee9..e8487a92 100644 --- a/src/main/java/com/eu/habbo/core/consolecommands/ShowInteractionsCommand.java +++ b/src/main/java/com/eu/habbo/core/consolecommands/ShowInteractionsCommand.java @@ -1,8 +1,12 @@ package com.eu.habbo.core.consolecommands; import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ShowInteractionsCommand extends ConsoleCommand { + private static final Logger LOGGER = LoggerFactory.getLogger(ShowInteractionsCommand.class); + public ShowInteractionsCommand() { super("interactions", "Show a list of available furniture interactions."); } @@ -10,7 +14,7 @@ public class ShowInteractionsCommand extends ConsoleCommand { @Override public void handle(String[] args) throws Exception { for (String interaction : Emulator.getGameEnvironment().getItemManager().getInteractionList()) { - System.out.println(interaction); + LOGGER.info(interaction); } } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ShowRCONCommands.java b/src/main/java/com/eu/habbo/core/consolecommands/ShowRCONCommands.java index a7df7bf3..821d2f1f 100644 --- a/src/main/java/com/eu/habbo/core/consolecommands/ShowRCONCommands.java +++ b/src/main/java/com/eu/habbo/core/consolecommands/ShowRCONCommands.java @@ -1,8 +1,12 @@ package com.eu.habbo.core.consolecommands; import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ShowRCONCommands extends ConsoleCommand { + private static final Logger LOGGER = LoggerFactory.getLogger(ShowRCONCommands.class); + public ShowRCONCommands() { super("rconcommands", "Show a list of all RCON commands"); } @@ -10,7 +14,7 @@ public class ShowRCONCommands extends ConsoleCommand { @Override public void handle(String[] args) throws Exception { for (String command : Emulator.getRconServer().getCommands()) { - System.out.println(command); + LOGGER.info(command); } } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionThree.java b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionThree.java index 036ce89c..8289a1b6 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionThree.java +++ b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionThree.java @@ -66,7 +66,7 @@ class TeleportActionThree implements Runnable { targetTeleport.setExtradata("2"); targetRoom.updateItem(targetTeleport); //targetRoom.updateHabbo(this.client.getHabbo()); - //System.out.println(targetTeleport.getX() + " | " + targetTeleport.getY()); + //LOGGER.info((targetTeleport.getX() + " | " + targetTeleport.getY()); this.client.getHabbo().getHabboInfo().setCurrentRoom(targetRoom); //Emulator.getThreading().run(new HabboItemNewState(this.currentTeleport, this.room, "0"), 500); Emulator.getThreading().run(new TeleportActionFour(targetTeleport, targetRoom, this.client), this.currentTeleport instanceof InteractionTeleportTile ? 0 : 500); From 14a1c56877fa73e95af025768a25121cc513e2f4 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Tue, 5 May 2020 01:27:39 +0200 Subject: [PATCH 057/215] Remove unused packet ids and fix duplicate composer. --- .../eu/habbo/messages/incoming/Incoming.java | 4 --- .../rooms/bots/BotSaveSettingsEvent.java | 4 +-- .../eu/habbo/messages/outgoing/Outgoing.java | 23 +++++----------- .../users/RoomUnitUpdateUsernameComposer.java | 25 ------------------ .../users/RoomUserNameChangedComposer.java | 26 ++++++++++++------- 5 files changed, 26 insertions(+), 56 deletions(-) delete mode 100644 src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUnitUpdateUsernameComposer.java diff --git a/src/main/java/com/eu/habbo/messages/incoming/Incoming.java b/src/main/java/com/eu/habbo/messages/incoming/Incoming.java index ee3b7193..2f2bfc1d 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/Incoming.java +++ b/src/main/java/com/eu/habbo/messages/incoming/Incoming.java @@ -35,7 +35,6 @@ public class Incoming { public static final int RoomUserShoutEvent = 2085; public static final int ScratchPetEvent = 3202; public static final int RoomUserWalkEvent = 3320; - public static final int RequestUserTagsEvent = 17; public static final int RequestTagsEvent = 826; public static final int GetMarketplaceConfigEvent = 2597; public static final int RequestHeightmapEvent = 3898; @@ -114,8 +113,6 @@ public class Incoming { public static final int SearchRoomsMyFavoriteEvent = 2578; public static final int TradeStartEvent = 1481; public static final int RequestTargetOfferEvent = 2487; - public static final int ClientActionsMessageEvent = 3457; - public static final int UknownMessageEventSomethingSomething = 1827; public static final int ChangeRelationEvent = 3768; public static final int RoomUserSitEvent = 2235; public static final int RequestCanCreateRoomEvent = 2128; @@ -275,7 +272,6 @@ public class Incoming { public static final int GuardianNoUpdatesWantedEvent = 2501; public static final int GuardianVoteEvent = 3961; public static final int GuardianAcceptRequestEvent = 3365; - public static final int RequestGameConfigurationsEvent = 741; public static final int RequestAchievementConfigurationEvent = -1; public static final int RequestReportUserBullyingEvent = 3786; public static final int ReportBullyEvent = 3060; diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/bots/BotSaveSettingsEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/bots/BotSaveSettingsEvent.java index a0d13549..aea766c0 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/bots/BotSaveSettingsEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/bots/BotSaveSettingsEvent.java @@ -8,8 +8,8 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.DanceType; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.generic.alerts.BotErrorComposer; -import com.eu.habbo.messages.outgoing.rooms.users.RoomUnitUpdateUsernameComposer; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDanceComposer; +import com.eu.habbo.messages.outgoing.rooms.users.RoomUserNameChangedComposer; import com.eu.habbo.messages.outgoing.rooms.users.RoomUsersComposer; import com.eu.habbo.plugin.events.bots.BotSavedChatEvent; import com.eu.habbo.plugin.events.bots.BotSavedLookEvent; @@ -143,7 +143,7 @@ public class BotSaveSettingsEvent extends MessageHandler { bot.setName(nameEvent.name); bot.needsUpdate(true); - room.sendComposer(new RoomUnitUpdateUsernameComposer(bot.getRoomUnit(), nameEvent.name).compose()); + room.sendComposer(new RoomUserNameChangedComposer(bot.getRoomUnit().getId(), bot.getRoomUnit().getId(), nameEvent.name).compose()); } } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/Outgoing.java b/src/main/java/com/eu/habbo/messages/outgoing/Outgoing.java index 38cba122..c6e299c0 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/Outgoing.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/Outgoing.java @@ -138,11 +138,11 @@ public class Outgoing { public final static int WallItemUpdateComposer = 2009; // PRODUCTION-201611291003-338511768 public final static int TradeAcceptedComposer = 2568; // PRODUCTION-201611291003-338511768 public final static int AddWallItemComposer = 2187; // PRODUCTION-201611291003-338511768 - public final static int RoomEntryInfoComposer = 749; // PRODUCTION-201611291003-338511768 + public final static int RoomEntryInfoComposer = -1; // PRODUCTION-201611291003-338511768 public final static int HotelViewDataComposer = 1745; // PRODUCTION-201611291003-338511768 public final static int PresentItemOpenedComposer = 56; // PRODUCTION-201611291003-338511768 public final static int RoomUserRemoveRightsComposer = 84; // PRODUCTION-201611291003-338511768 - public final static int UserBCLimitsComposer = 3828; // PRODUCTION-201611291003-338511768 + public final static int UserBCLimitsComposer = -1; // PRODUCTION-201611291003-338511768 public final static int PetTrainingPanelComposer = 1164; // PRODUCTION-201611291003-338511768 public final static int RoomPaneComposer = 749; // PRODUCTION-201611291003-338511768 public final static int RedeemVoucherErrorComposer = 714; // PRODUCTION-201611291003-338511768 @@ -199,7 +199,6 @@ public class Outgoing { public final static int NewNavigatorCollapsedCategoriesComposer = 1543; // PRODUCTION-201611291003-338511768 public final static int NewNavigatorLiftedRoomsComposer = 3104; // PRODUCTION-201611291003-338511768 public final static int NewNavigatorSavedSearchesComposer = 3984; // PRODUCTION-201611291003-338511768 - public final static int RoomUnitUpdateUsernameComposer = 2182; // PRODUCTION-201611291003-338511768 public final static int PostItDataComposer = 2202; // PRODUCTION-201611291003-338511768 public final static int ModToolReportReceivedAlertComposer = 3635; // PRODUCTION-201611291003-338511768 public final static int ModToolIssueResponseAlertComposer = 3796; // PRODUCTION-201611291003-338511768 @@ -237,7 +236,7 @@ public class Outgoing { public final static int ItemExtraDataComposer = 2547; // PRODUCTION-201611291003-338511768 public final static int PostUpdateMessageComposer = 324; // PRODUCTION-201611291003-338511768 //NotSure Needs Testing - public final static int QuestionInfoComposer = 2665; // PRODUCTION-201611291003-338511768 + public final static int QuestionInfoComposer = -1; // PRODUCTION-201611291003-338511768 public final static int TalentTrackEmailVerifiedComposer = 612; // PRODUCTION-201611291003-338511768 public final static int TalentTrackEmailFailedComposer = 1815; // PRODUCTION-201611291003-338511768 public final static int UnknownAvatarEditorComposer = 3473; // PRODUCTION-201611291003-338511768 @@ -249,8 +248,8 @@ public class Outgoing { public final static int GuildForumAddCommentComposer = 2049; // PRODUCTION-201611291003-338511768 public final static int GuildForumDataComposer = 3011; // PRODUCTION-201611291003-338511768 public final static int GuildForumCommentsComposer = 509; // PRODUCTION-201611291003-338511768 - public final static int UnknownGuildForumComposer6 = 324; // PRODUCTION-201611291003-338511768 - public final static int UnknownGuildForumComposer7 = 2528; // PRODUCTION-201611291003-338511768 + public final static int UnknownGuildForumComposer6 = -1; // PRODUCTION-201611291003-338511768 + public final static int UnknownGuildForumComposer7 = -1; // PRODUCTION-201611291003-338511768 public final static int GuildForumThreadsComposer = 1073; // PRODUCTION-201611291003-338511768 public final static int GuildForumListComposer = 3001; // PRODUCTION-201611291003-338511768 public final static int ThreadUpdateMessageComposer = 2528; @@ -342,11 +341,11 @@ public class Outgoing { public final static int MostUselessErrorAlertComposer = 662; // PRODUCTION-201611291003-338511768 public final static int AchievementsConfigurationComposer = 1689; // PRODUCTION-201611291003-338511768 public final static int PetBreedingResultComposer = 634; // PRODUCTION-201611291003-338511768 - public final static int RoomUserQuestionAnsweredComposer = 2589; // PRODUCTION-201611291003-338511768 + public final static int RoomUserQuestionAnsweredComposer = -1; // PRODUCTION-201611291003-338511768 public final static int PetBreedingStartComposer = 1746; // PRODUCTION-201611291003-338511768 public final static int CustomNotificationComposer = 909; // PRODUCTION-201611291003-338511768 public final static int UpdateStackHeightTileHeightComposer = 2816; // PRODUCTION-201611291003-338511768 - public final static int HotelViewCustomTimerComposer = 3926; // PRODUCTION-201611291003-338511768 + public final static int HotelViewCustomTimerComposer = -1; // PRODUCTION-201611291003-338511768 public final static int MarketplaceItemPostedComposer = 1359; // PRODUCTION-201611291003-338511768 public final static int HabboWayQuizComposer2 = 2927; // PRODUCTION-201611291003-338511768 public final static int GuildFavoriteRoomUserUpdateComposer = 3403; // PRODUCTION-201611291003-338511768 @@ -413,7 +412,6 @@ public class Outgoing { public final static int CraftingComposerFour = 2124; // PRODUCTION-201611291003-338511768 public final static int UnknownComposer_100 = 1553; // PRODUCTION-201611291003-338511768 //PetBReedingResult - public final static int UnknownComposer_1031 = 1001; // PRODUCTION-201611291003-338511768 public final static int ConnectionErrorComposer = 1004; // PRODUCTION-201611291003-338511768 public final static int BotForceOpenContextMenuComposer = 296; // PRODUCTION-201611291003-338511768 public final static int UnknownComposer_1111 = 1551; // PRODUCTION-201611291003-338511768 @@ -421,13 +419,10 @@ public class Outgoing { public final static int UnknownComposer_1165 = 904; // PRODUCTION-201611291003-338511768 public final static int EffectsListAddComposer = 2867; // PRODUCTION-201611291003-338511768 public final static int UnknownComposer_1188 = 1437; // PRODUCTION-201611291003-338511768 - public final static int UnknownComposer_1218 = 1730; // PRODUCTION-201611291003-338511768 public final static int SubmitCompetitionRoomComposer = 3841; // PRODUCTION-201611291003-338511768 public final static int GameAchievementsListComposer = 2265; // PRODUCTION-201611291003-338511768 - public final static int UnknownComposer_1271 = 1660; // PRODUCTION-201611291003-338511768 public final static int OtherTradingDisabledComposer = 1254; // PRODUCTION-201611291003-338511768 public final static int BaseJumpUnloadGameComposer = 1715; // PRODUCTION-201611291003-338511768 - public final static int UnknownComposer_1322 = 1730; // PRODUCTION-201611291003-338511768 public final static int UnknownComposer_137 = 2897; // PRODUCTION-201611291003-338511768 public final static int GameCenterAccountInfoComposer = 2893; // PRODUCTION-201611291003-338511768 public final static int UnknowComposer_1390 = 2270; // PRODUCTION-201611291003-338511768 @@ -435,20 +430,16 @@ public class Outgoing { public final static int UnknowComposer_1427 = 3319; // PRODUCTION-201611291003-338511768 public final static int AdventCalendarDataComposer = 2531; // PRODUCTION-201611291003-338511768 public final static int UnknownComposer_152 = 3954; // PRODUCTION-201611291003-338511768 - public final static int UnknownComposer_1529 = 1730; // PRODUCTION-201611291003-338511768 public final static int UnknownComposer_1577 = 2641; // PRODUCTION-201611291003-338511768 - public final static int UnknownComposer_1712 = 1730; // PRODUCTION-201611291003-338511768 public final static int NewYearResolutionCompletedComposer = 740; // PRODUCTION-201611291003-338511768 public final static int UnknownComposer_1741 = 2246; // PRODUCTION-201611291003-338511768 public final static int UnknownComposer_1744 = 2873; // PRODUCTION-201611291003-338511768 public final static int AdventCalendarProductComposer = 2551; // PRODUCTION-201611291003-338511768 public final static int ModToolSanctionInfoComposer = 2221; // PRODUCTION-201611291003-338511768 public final static int UnknownComposer_1965 = 3292; // PRODUCTION-201611291003-338511768 - public final static int UnknownComposer_2053 = 1660; // PRODUCTION-201611291003-338511768 public final static int GuideSessionPartnerIsPlayingComposer = 448; // PRODUCTION-201611291003-338511768 public final static int BaseJumpLeaveQueueComposer = 1477; // PRODUCTION-201611291003-338511768 public final static int Game2WeeklySmallLeaderboardComposer = 3512; // PRODUCTION-201611291003-338511768 - public final static int CatalogBuyVIPSMSComposer = 3315; // PRODUCTION-201611291003-338511768 public final static int GameCenterGameListComposer = 222; // PRODUCTION-201611291003-338511768 public final static int RoomUsersGuildBadgesComposer = 2402; // PRODUCTION-201611291003-338511768 public final static int UnknownComposer_2563 = 1774; // PRODUCTION-201611291003-338511768 diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUnitUpdateUsernameComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUnitUpdateUsernameComposer.java deleted file mode 100644 index c3cde9be..00000000 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUnitUpdateUsernameComposer.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.eu.habbo.messages.outgoing.rooms.users; - -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.messages.ServerMessage; -import com.eu.habbo.messages.outgoing.MessageComposer; -import com.eu.habbo.messages.outgoing.Outgoing; - -public class RoomUnitUpdateUsernameComposer extends MessageComposer { - private RoomUnit roomUnit; - private String name; - - public RoomUnitUpdateUsernameComposer(RoomUnit roomUnit, String name) { - this.roomUnit = roomUnit; - this.name = name; - } - - @Override - public ServerMessage compose() { - this.response.init(Outgoing.RoomUnitUpdateUsernameComposer); - this.response.appendInt(this.roomUnit.getId()); - this.response.appendInt(this.roomUnit.getId()); - this.response.appendString(this.name); - return this.response; - } -} diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserNameChangedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserNameChangedComposer.java index 53c8b5b9..f62b4d2e 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserNameChangedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserNameChangedComposer.java @@ -7,25 +7,33 @@ import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.Outgoing; public class RoomUserNameChangedComposer extends MessageComposer { - private final Habbo habbo; - private final boolean includePrefix; + + private final int userId; + private final int roomId; + private final String name; public RoomUserNameChangedComposer(Habbo habbo) { - this.habbo = habbo; - this.includePrefix = false; + this(habbo, false); } public RoomUserNameChangedComposer(Habbo habbo, boolean includePrefix) { - this.habbo = habbo; - this.includePrefix = includePrefix; + this.userId = habbo.getHabboInfo().getId(); + this.roomId = habbo.getRoomUnit().getId(); + this.name = (includePrefix ? Room.PREFIX_FORMAT.replace("%color%", habbo.getHabboInfo().getRank().getPrefixColor()).replace("%prefix%", habbo.getHabboInfo().getRank().getPrefix()) : "") + habbo.getHabboInfo().getUsername(); + } + + public RoomUserNameChangedComposer(int userId, int roomId, String name) { + this.userId = userId; + this.roomId = roomId; + this.name = name; } @Override public ServerMessage compose() { this.response.init(Outgoing.RoomUserNameChangedComposer); - this.response.appendInt(this.habbo.getHabboInfo().getId()); - this.response.appendInt(this.habbo.getRoomUnit().getId()); - this.response.appendString((this.includePrefix ? Room.PREFIX_FORMAT.replace("%color%", this.habbo.getHabboInfo().getRank().getPrefixColor()).replace("%prefix%", this.habbo.getHabboInfo().getRank().getPrefix()) : "") + this.habbo.getHabboInfo().getUsername()); + this.response.appendInt(this.userId); + this.response.appendInt(this.roomId); + this.response.appendString(this.name); return this.response; } } \ No newline at end of file From 5fc6bc4002dc001898080ee5c9ba62b6daa16a0d Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Tue, 5 May 2020 01:31:50 +0200 Subject: [PATCH 058/215] Add packet names to logger. --- .../com/eu/habbo/messages/PacketManager.java | 7 +++ .../com/eu/habbo/messages/PacketNames.java | 58 +++++++++++++++++++ .../decoders/GameClientMessageLogger.java | 12 +++- .../encoders/GameServerMessageLogger.java | 12 +++- 4 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/eu/habbo/messages/PacketNames.java diff --git a/src/main/java/com/eu/habbo/messages/PacketManager.java b/src/main/java/com/eu/habbo/messages/PacketManager.java index 8360b2bb..54ad2f77 100644 --- a/src/main/java/com/eu/habbo/messages/PacketManager.java +++ b/src/main/java/com/eu/habbo/messages/PacketManager.java @@ -85,10 +85,13 @@ public class PacketManager { public static boolean MULTI_THREADED_PACKET_HANDLING = false; private final THashMap> incoming; private final THashMap> callables; + private final PacketNames names; public PacketManager() throws Exception { this.incoming = new THashMap<>(); this.callables = new THashMap<>(); + this.names = new PacketNames(); + this.names.initialize(); this.registerHandshake(); this.registerCatalog(); @@ -115,6 +118,10 @@ public class PacketManager { this.registerGameCenter(); } + public PacketNames getNames() { + return names; + } + @EventHandler public static void onConfigurationUpdated(EmulatorConfigUpdatedEvent event) { logList.clear(); diff --git a/src/main/java/com/eu/habbo/messages/PacketNames.java b/src/main/java/com/eu/habbo/messages/PacketNames.java new file mode 100644 index 00000000..4fa159ec --- /dev/null +++ b/src/main/java/com/eu/habbo/messages/PacketNames.java @@ -0,0 +1,58 @@ +package com.eu.habbo.messages; + +import com.eu.habbo.messages.incoming.Incoming; +import com.eu.habbo.messages.outgoing.Outgoing; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.HashMap; + +public class PacketNames { + + private static final Logger LOGGER = LoggerFactory.getLogger(PacketNames.class); + + private final HashMap incoming; + private final HashMap outgoing; + + public PacketNames() { + this.incoming = new HashMap<>(); + this.outgoing = new HashMap<>(); + } + + public void initialize() { + PacketNames.getNames(Incoming.class, this.incoming); + PacketNames.getNames(Outgoing.class, this.outgoing); + } + + public String getIncomingName(int key) { + return this.incoming.getOrDefault(key, "Unknown"); + } + + public String getOutgoingName(int key) { + return this.outgoing.getOrDefault(key, "Unknown"); + } + + private static void getNames(Class clazz, HashMap target) { + for (Field field : clazz.getFields()) { + int modifiers = field.getModifiers(); + if (Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers) && Modifier.isFinal(modifiers) && field.getType() == int.class) { + try { + int packetId = field.getInt(null); + if (packetId > 0) { + if (target.containsKey(packetId)) { + LOGGER.warn("Duplicate packet id found {} for {}.", packetId, clazz.getSimpleName()); + continue; + } + + target.put(packetId, field.getName()); + } + } catch (IllegalAccessException e) { + LOGGER.error("Failed to read field integer.", e); + } + } + } + } + +} diff --git a/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameClientMessageLogger.java b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameClientMessageLogger.java index 8891e5a2..bf433250 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameClientMessageLogger.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameClientMessageLogger.java @@ -1,6 +1,8 @@ package com.eu.habbo.networking.gameserver.decoders; +import com.eu.habbo.Emulator; import com.eu.habbo.messages.ClientMessage; +import com.eu.habbo.messages.PacketNames; import com.eu.habbo.util.ANSI; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToMessageDecoder; @@ -12,10 +14,18 @@ import java.util.List; public class GameClientMessageLogger extends MessageToMessageDecoder { private static final Logger LOGGER = LoggerFactory.getLogger(GameClientMessageLogger.class); + private final PacketNames names; + + public GameClientMessageLogger() { + this.names = Emulator.getGameServer().getPacketManager().getNames(); + } @Override protected void decode(ChannelHandlerContext ctx, ClientMessage message, List out) { - LOGGER.debug(String.format("[" + ANSI.GREEN + "CLIENT" + ANSI.DEFAULT + "][%-4d] => %s", message.getMessageId(), message.getMessageBody())); + LOGGER.debug(String.format("[" + ANSI.GREEN + "CLIENT" + ANSI.DEFAULT + "][%-4d][%-41s] => %s", + message.getMessageId(), + this.names.getIncomingName(message.getMessageId()), + message.getMessageBody())); out.add(message); } diff --git a/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java b/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java index bcbe5b13..a21edde9 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java @@ -1,5 +1,7 @@ package com.eu.habbo.networking.gameserver.encoders; +import com.eu.habbo.Emulator; +import com.eu.habbo.messages.PacketNames; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.util.ANSI; import io.netty.channel.ChannelHandlerContext; @@ -12,10 +14,18 @@ import java.util.List; public class GameServerMessageLogger extends MessageToMessageEncoder { private static final Logger LOGGER = LoggerFactory.getLogger(GameServerMessageLogger.class); + private final PacketNames names; + + public GameServerMessageLogger() { + this.names = Emulator.getGameServer().getPacketManager().getNames(); + } @Override protected void encode(ChannelHandlerContext ctx, ServerMessage message, List out) { - LOGGER.debug(String.format("[" + ANSI.BLUE + "SERVER" + ANSI.DEFAULT + "][%-4d] => %s", message.getHeader(), message.getBodyString())); + LOGGER.debug(String.format("[" + ANSI.BLUE + "SERVER" + ANSI.DEFAULT + "][%-4d][%-41s] => %s", + message.getHeader(), + this.names.getOutgoingName(message.getHeader()), + message.getBodyString())); out.add(message.retain()); } From fd2293342fae6d41508437a116b0ee21607b9360 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Tue, 5 May 2020 01:59:28 +0200 Subject: [PATCH 059/215] Add rolling files. --- pom.xml | 12 +++++++ src/main/resources/logback.xml | 64 ++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/pom.xml b/pom.xml index 35de71dc..d2571ab0 100644 --- a/pom.xml +++ b/pom.xml @@ -160,6 +160,18 @@ 1.18 + + org.codehaus.janino + janino + 3.1.2 + + + + org.codehaus.groovy + groovy-all + 3.0.3 + + joda-time joda-time diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index 8e8ca6b1..7597aff6 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -7,6 +7,67 @@ + + logging/debug.txt + + + + e.level == DEBUG + + + DENY + NEUTRAL + + + logging/debug.%d{yyyy-MM-dd}.%i.gz + 50MB + 7 + + + %d{HH:mm:ss.SSS} [%thread] %level %logger - %msg%n + + + + + logging/errors/runtime.txt + + error + + + + java.sql.SQLException.class.isInstance(throwable) + + DENY + + + logging/errors/runtime.%d{yyyy-MM-dd}.%i.gz + 50MB + 7 + + + %d{HH:mm:ss.SSS} [%thread] %level %logger - %msg%n + + + + + logging/errors/sql.txt + + + java.sql.SQLException.class.isInstance(throwable) + + DENY + NEUTRAL + + + logging/errors/sql.%d{yyyy-MM-dd}.%i.gz + 50MB + 7 + + + %d{HH:mm:ss.SSS} [%thread] %level %logger - %msg%n + + + @@ -17,5 +78,8 @@ + + + \ No newline at end of file From b5265a1fd24bf115951110944284292ec647f62d Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Tue, 5 May 2020 02:01:36 +0200 Subject: [PATCH 060/215] Fix groovy? --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index d2571ab0..d38ccad3 100644 --- a/pom.xml +++ b/pom.xml @@ -170,6 +170,7 @@ org.codehaus.groovy groovy-all 3.0.3 + pom From ca5ca73a9d79291607200d7a5b14e549d3efd5b4 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Tue, 5 May 2020 02:24:33 +0200 Subject: [PATCH 061/215] Try to improve build size by reducing dependencies used for logging. --- pom.xml | 13 -------- .../util/logback/SqlExceptionFilter.java | 23 +++++++++++++ src/main/resources/logback.xml | 32 ++++++------------- 3 files changed, 32 insertions(+), 36 deletions(-) create mode 100644 src/main/java/com/eu/habbo/util/logback/SqlExceptionFilter.java diff --git a/pom.xml b/pom.xml index d38ccad3..35de71dc 100644 --- a/pom.xml +++ b/pom.xml @@ -160,19 +160,6 @@ 1.18 - - org.codehaus.janino - janino - 3.1.2 - - - - org.codehaus.groovy - groovy-all - 3.0.3 - pom - - joda-time joda-time diff --git a/src/main/java/com/eu/habbo/util/logback/SqlExceptionFilter.java b/src/main/java/com/eu/habbo/util/logback/SqlExceptionFilter.java new file mode 100644 index 00000000..1026ad58 --- /dev/null +++ b/src/main/java/com/eu/habbo/util/logback/SqlExceptionFilter.java @@ -0,0 +1,23 @@ +package com.eu.habbo.util.logback; + +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.classic.spi.ThrowableProxy; +import ch.qos.logback.core.filter.Filter; +import ch.qos.logback.core.spi.FilterReply; + +import java.sql.SQLException; + +public class SqlExceptionFilter extends Filter { + + @Override + public FilterReply decide(ILoggingEvent event) { + ThrowableProxy proxy = (ThrowableProxy) event.getThrowableProxy(); + + if (proxy.getThrowable() instanceof SQLException){ + return FilterReply.ACCEPT; + } + + return FilterReply.DENY; + } + +} diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index 7597aff6..6b298c13 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -9,14 +9,10 @@ logging/debug.txt - - - - e.level == DEBUG - - - DENY - NEUTRAL + + DEBUG + ACCEPT + DENY logging/debug.%d{yyyy-MM-dd}.%i.gz @@ -30,14 +26,10 @@ logging/errors/runtime.txt - - error - - - - java.sql.SQLException.class.isInstance(throwable) - - DENY + + ERROR + ACCEPT + DENY logging/errors/runtime.%d{yyyy-MM-dd}.%i.gz @@ -51,13 +43,7 @@ logging/errors/sql.txt - - - java.sql.SQLException.class.isInstance(throwable) - - DENY - NEUTRAL - + logging/errors/sql.%d{yyyy-MM-dd}.%i.gz 50MB From 2bc4bc34736b3b117c2bd5007f63c8755d83a61b Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Tue, 5 May 2020 03:56:21 +0200 Subject: [PATCH 062/215] Added stub for old logger so plugins don't break. --- src/main/java/com/eu/habbo/Emulator.java | 10 ++ src/main/java/com/eu/habbo/core/Logging.java | 97 ++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 src/main/java/com/eu/habbo/core/Logging.java diff --git a/src/main/java/com/eu/habbo/Emulator.java b/src/main/java/com/eu/habbo/Emulator.java index e361e1e5..e5ca801e 100644 --- a/src/main/java/com/eu/habbo/Emulator.java +++ b/src/main/java/com/eu/habbo/Emulator.java @@ -66,6 +66,7 @@ public final class Emulator { private static GameServer gameServer; private static RCONServer rconServer; private static CameraClient cameraClient; + private static Logging logging; private static Database database; private static DatabaseLogger databaseLogger; private static ThreadPooling threading; @@ -100,6 +101,7 @@ public final class Emulator { setBuild(); Emulator.stopped = false; ConsoleCommand.load(); + Emulator.logging = new Logging(); System.out.println(logo); @@ -319,6 +321,14 @@ public final class Emulator { return rconServer; } + /** + * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log. + */ + @Deprecated + public static Logging getLogging() { + return logging; + } + public static ThreadPooling getThreading() { return threading; } diff --git a/src/main/java/com/eu/habbo/core/Logging.java b/src/main/java/com/eu/habbo/core/Logging.java new file mode 100644 index 00000000..b1384a42 --- /dev/null +++ b/src/main/java/com/eu/habbo/core/Logging.java @@ -0,0 +1,97 @@ +package com.eu.habbo.core; + +import com.eu.habbo.Emulator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.sql.SQLException; + +public class Logging { + + private static final Logger LOGGER = LoggerFactory.getLogger("LegacyLogger"); + + /** + * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log. + */ + @Deprecated + public void logStart(Object line) { + LOGGER.info("[LOADING] {}", line); + } + + /** + * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log. + */ + @Deprecated + public void logShutdownLine(Object line) { + LOGGER.info("[SHUTDOWN] {}", line); + } + + /** + * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log. + */ + @Deprecated + public void logUserLine(Object line) { + LOGGER.info("[USER] {}", line); + } + + /** + * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log. + */ + @Deprecated + public void logDebugLine(Object line) { + LOGGER.debug("[DEBUG] {}", line); + } + + /** + * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log. + */ + @Deprecated + public void logPacketLine(Object line) { + if (Emulator.getConfig().getBoolean("debug.show.packets")) { + LOGGER.debug("[PACKET] {}", line); + } + } + + /** + * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log. + */ + @Deprecated + public void logUndefinedPacketLine(Object line) { + if (Emulator.getConfig().getBoolean("debug.show.packets.undefined")) { + LOGGER.debug("[PACKET] [UNDEFINED] {}", line); + } + } + + /** + * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log. + */ + @Deprecated + public void logErrorLine(Object line) { + LOGGER.error("[ERROR] {}", line); + } + + /** + * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log. + */ + @Deprecated + public void logSQLException(SQLException e) { + LOGGER.error("[ERROR] SQLException", e); + } + + /** + * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log. + */ + @Deprecated + public void logPacketError(Object e) { + LOGGER.error("[ERROR] PacketError {}", e); + } + + /** + * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log. + */ + @Deprecated + public void handleException(Exception e) { + LOGGER.error("[ERROR] Exception", e); + } + +} From 401af627ffa328b7e9a38aee02260bf9e33dae22 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Tue, 5 May 2020 04:00:02 +0200 Subject: [PATCH 063/215] Fix exception spam on busy hotels. --- .../networking/gameserver/decoders/GameMessageHandler.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageHandler.java b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageHandler.java index 143b6c61..a0ba3112 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageHandler.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageHandler.java @@ -11,6 +11,8 @@ import io.netty.handler.codec.TooLongFrameException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.IOException; + @ChannelHandler.Sharable public class GameMessageHandler extends ChannelInboundHandlerAdapter { private static final Logger LOGGER = LoggerFactory.getLogger(GameMessageHandler.class); @@ -53,6 +55,11 @@ public class GameMessageHandler extends ChannelInboundHandlerAdapter { @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { + if (cause instanceof IOException) { + ctx.channel().close(); + return; + } + if (cause instanceof TooLongFrameException) { LOGGER.error("Disconnecting client, reason: \"" + cause.getMessage() + "\"."); } else { From 145c02681f12d792285eac17cb26a253dec3cca3 Mon Sep 17 00:00:00 2001 From: David Silva Date: Tue, 5 May 2020 12:57:18 +0200 Subject: [PATCH 064/215] fix(WiredEffectMoveFurniTowards): npe --- .../wired/effects/WiredEffectMoveFurniTowards.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java index f1c4166d..849a59b2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java @@ -107,6 +107,10 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect { RoomLayout layout = room.getLayout(); boolean collided = false; + if (layout == null) { + break; + } + for (int i = 0; i < 3; i++) { if (target != null) break; From 31c7ff7b6d06d7b9567e0f896481777681fd55d2 Mon Sep 17 00:00:00 2001 From: David Silva Date: Tue, 5 May 2020 13:59:12 +0200 Subject: [PATCH 065/215] fix(Room): pets CME --- .../com/eu/habbo/habbohotel/rooms/Room.java | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index c8de883e..c97288db 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -1992,23 +1992,15 @@ public class Room implements Comparable, ISerialize, Runnable { * @param excludeUserId Habbo id to keep pets */ public void removeAllPets(int excludeUserId) { + ArrayList toRemovePets = new ArrayList<>(); ArrayList removedPets = new ArrayList<>(); synchronized (this.currentPets) { for (Pet pet : this.currentPets.valueCollection()) { try { if (pet.getUserId() != excludeUserId) { - - pet.removeFromRoom(); - - Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(pet.getUserId()); - if (habbo != null) { - habbo.getInventory().getPetsComponent().addPet(pet); - habbo.getClient().sendResponse(new AddPetComposer(pet)); - } + toRemovePets.add(pet); } - pet.needsUpdate = true; - pet.run(); } catch (NoSuchElementException e) { Emulator.getLogging().logErrorLine(e); break; @@ -2016,6 +2008,21 @@ public class Room implements Comparable, ISerialize, Runnable { } } + for (Pet pet : toRemovePets) { + removedPets.add(pet); + + pet.removeFromRoom(); + + Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(pet.getUserId()); + if (habbo != null) { + habbo.getInventory().getPetsComponent().addPet(pet); + habbo.getClient().sendResponse(new AddPetComposer(pet)); + } + + pet.needsUpdate = true; + pet.run(); + } + for (Pet pet : removedPets) { this.currentPets.remove(pet.getId()); } From 2e40f295df67ec3179b9cbb4a2cbbfca5d8dd984 Mon Sep 17 00:00:00 2001 From: Swirny <140-Swirny@users.noreply.git.krews.org> Date: Fri, 8 May 2020 06:23:37 -0400 Subject: [PATCH 066/215] Chatlog ordered by timestamp --- .../java/com/eu/habbo/habbohotel/modtool/ModToolManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java index 8a10edbb..2a9860e3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java @@ -207,7 +207,7 @@ public class ModToolManager { public ArrayList getUserChatlog(int userId) { ArrayList chatlogs = new ArrayList<>(); - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.username, users.id, chatlogs_room.* FROM chatlogs_room INNER JOIN users ON users.id = chatlogs_room.user_from_id WHERE user_from_id = ? ORDER BY timestamp DESC LIMIT 150")) { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.username, users.id, chatlogs_room.* FROM chatlogs_room INNER JOIN users ON users.id = chatlogs_room.user_from_id WHERE user_from_id = ? ORDER BY chatlogs_room.timestamp DESC LIMIT 150")) { statement.setInt(1, userId); try (ResultSet set = statement.executeQuery()) { while (set.next()) { @@ -224,7 +224,7 @@ public class ModToolManager { public ArrayList getMessengerChatlog(int userOneId, int userTwoId) { ArrayList chatLogs = new ArrayList<>(); - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.username, chatlogs_private.* FROM chatlogs_private INNER JOIN users ON users.id = user_from_id WHERE (user_from_id = ? AND user_to_id = ?) OR (user_from_id = ? AND user_to_id = ?) ORDER BY timestamp DESC LIMIT 50")) { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.username, chatlogs_private.* FROM chatlogs_private INNER JOIN users ON users.id = user_from_id WHERE (user_from_id = ? AND user_to_id = ?) OR (user_from_id = ? AND user_to_id = ?) ORDER BY chatlogs_private.timestamp DESC LIMIT 50")) { statement.setInt(1, userOneId); statement.setInt(2, userTwoId); statement.setInt(3, userTwoId); From ea27e419bb9c930fd0c30c07d6026dd92ba766c9 Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Sat, 9 May 2020 17:31:09 +0100 Subject: [PATCH 067/215] revert timestamp commit by zGrav --- .../com/eu/habbo/habbohotel/catalog/CatalogManager.java | 4 ---- .../java/com/eu/habbo/habbohotel/users/HabboStats.java | 9 +++------ .../messages/incoming/catalog/CatalogBuyItemEvent.java | 3 +-- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java index 7a70a22a..47423eff 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java @@ -6,7 +6,6 @@ import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.catalog.layouts.*; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.guilds.Guild; -import com.eu.habbo.habbohotel.guilds.GuildManager; import com.eu.habbo.habbohotel.items.FurnitureType; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.SoundTrack; @@ -43,7 +42,6 @@ import gnu.trove.set.hash.THashSet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.lang.reflect.InvocationTargetException; import java.sql.*; import java.util.*; import java.util.stream.Collectors; @@ -1127,8 +1125,6 @@ public class CatalogManager { habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); } } finally { - habbo.getHabboStats().lastPurchaseTimestamp = Emulator.getIntUnixTimestamp(); - habbo.getHabboStats().run(); habbo.getHabboStats().isPurchasingFurniture = false; } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java index 99bf5650..9b71194b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java @@ -83,8 +83,8 @@ public class HabboStats implements Runnable { public int forumPostsCount; public THashMap> ltdPurchaseLog = new THashMap<>(0); public long lastTradeTimestamp = Emulator.getIntUnixTimestamp(); - public int lastPurchaseTimestamp; public long lastGiftTimestamp = Emulator.getIntUnixTimestamp(); + public long lastPurchaseTimestamp = Emulator.getIntUnixTimestamp(); public int uiFlags; public boolean hasGottenDefaultSavedSearches; private HabboInfo habboInfo; @@ -140,7 +140,6 @@ public class HabboStats implements Runnable { this.forumPostsCount = set.getInt("forums_post_count"); this.uiFlags = set.getInt("ui_flags"); this.hasGottenDefaultSavedSearches = set.getInt("has_gotten_default_saved_searches") == 1; - this.lastPurchaseTimestamp = set.getInt("last_purchase_timestamp"); this.nuxReward = this.nux; @@ -301,7 +300,7 @@ public class HabboStats implements Runnable { @Override public void run() { try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) { - try (PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET achievement_score = ?, respects_received = ?, respects_given = ?, daily_respect_points = ?, block_following = ?, block_friendrequests = ?, online_time = online_time + ?, guild_id = ?, daily_pet_respect_points = ?, club_expire_timestamp = ?, login_streak = ?, rent_space_id = ?, rent_space_endtime = ?, volume_system = ?, volume_furni = ?, volume_trax = ?, block_roominvites = ?, old_chat = ?, block_camera_follow = ?, chat_color = ?, hof_points = ?, block_alerts = ?, talent_track_citizenship_level = ?, talent_track_helpers_level = ?, ignore_bots = ?, ignore_pets = ?, nux = ?, mute_end_timestamp = ?, allow_name_change = ?, perk_trade = ?, can_trade = ?, `forums_post_count` = ?, ui_flags = ?, has_gotten_default_saved_searches = ?, last_purchase_timestamp = ? WHERE user_id = ? LIMIT 1")) { + try (PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET achievement_score = ?, respects_received = ?, respects_given = ?, daily_respect_points = ?, block_following = ?, block_friendrequests = ?, online_time = online_time + ?, guild_id = ?, daily_pet_respect_points = ?, club_expire_timestamp = ?, login_streak = ?, rent_space_id = ?, rent_space_endtime = ?, volume_system = ?, volume_furni = ?, volume_trax = ?, block_roominvites = ?, old_chat = ?, block_camera_follow = ?, chat_color = ?, hof_points = ?, block_alerts = ?, talent_track_citizenship_level = ?, talent_track_helpers_level = ?, ignore_bots = ?, ignore_pets = ?, nux = ?, mute_end_timestamp = ?, allow_name_change = ?, perk_trade = ?, can_trade = ?, `forums_post_count` = ?, ui_flags = ?, has_gotten_default_saved_searches = ? WHERE user_id = ? LIMIT 1")) { statement.setInt(1, this.achievementScore); statement.setInt(2, this.respectPointsReceived); statement.setInt(3, this.respectPointsGiven); @@ -336,9 +335,7 @@ public class HabboStats implements Runnable { statement.setInt(32, this.forumPostsCount); statement.setInt(33, this.uiFlags); statement.setInt(34, this.hasGottenDefaultSavedSearches ? 1 : 0); - statement.setInt(35, this.lastPurchaseTimestamp); - - statement.setInt(36, this.habboInfo.getId()); + statement.setInt(35, this.habboInfo.getId()); statement.executeUpdate(); } diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java index 6af3031a..a20ea1b8 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java @@ -178,8 +178,7 @@ public class CatalogBuyItemEvent extends MessageHandler { this.client.sendResponse(new PurchaseOKComposer(null)); this.client.sendResponse(new InventoryRefreshComposer()); - - this.client.getHabbo().getHabboStats().lastPurchaseTimestamp = Emulator.getIntUnixTimestamp(); + this.client.getHabbo().getHabboStats().run(); } return; From 95fab253d8b6043e794a01dc4b667ab1b1300cec Mon Sep 17 00:00:00 2001 From: harmonic Date: Sat, 9 May 2020 23:51:56 +0100 Subject: [PATCH 068/215] Reverted 2.4.0 sql. --- sqlupdates/2_3_1_TO_2_4_0-RC-1.sql | 2 -- 1 file changed, 2 deletions(-) diff --git a/sqlupdates/2_3_1_TO_2_4_0-RC-1.sql b/sqlupdates/2_3_1_TO_2_4_0-RC-1.sql index 561df6ff..5cebe121 100644 --- a/sqlupdates/2_3_1_TO_2_4_0-RC-1.sql +++ b/sqlupdates/2_3_1_TO_2_4_0-RC-1.sql @@ -1,5 +1,3 @@ INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.room.stickies.max', '200'); -ALTER TABLE `users_settings` ADD COLUMN `last_purchase_timestamp` int(11) NOT NULL DEFAULT UNIX_TIMESTAMP(); - INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('retro.style.homeroom', '1'); From 6345244ff38b5f6b8d227cc113c00aca6d8ef662 Mon Sep 17 00:00:00 2001 From: Swirny Date: Tue, 12 May 2020 18:14:27 +0200 Subject: [PATCH 069/215] Set marketplace limit like Habbo --- .../eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java index f18ad446..b3f05d3e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java @@ -153,7 +153,7 @@ public class MarketPlace { query += " AS B ON a.id = B.id"; - query += " LIMIT 100"; + query += " LIMIT 250"; try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement(query)) { statement.setInt(1, Emulator.getIntUnixTimestamp() - 172800); From f9d81ea19833eaa3d582ac7b7eeeabbb980eb54a Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Sat, 9 May 2020 21:29:49 +0200 Subject: [PATCH 070/215] Fix reference counting and repeated composer() calls. --- .../eu/habbo/core/RoomUserPetComposer.java | 2 +- .../eu/habbo/habbohotel/bots/BotManager.java | 1 - .../habbohotel/gameclients/GameClient.java | 9 +- .../gameclients/GameClientManager.java | 1 - .../items/interactions/InteractionFXBox.java | 1 - .../interactions/InteractionMultiHeight.java | 1 - .../interactions/InteractionPuzzleBox.java | 3 - .../InteractionVendingMachine.java | 2 - .../habbohotel/modtool/ModToolManager.java | 1 - .../com/eu/habbo/messages/ServerMessage.java | 90 ++++++++++++------- .../messages/ServerMessageException.java | 20 +++++ .../guilds/GuildRemoveFavoriteEvent.java | 1 - .../handshake/IsFirstLoginOfDayComposer.java | 2 +- .../incoming/handshake/UnknownComposer5.java | 2 +- .../youtube/YoutubeRequestStateChange.java | 1 - .../rooms/users/RoomUserLookAtPoint.java | 2 - .../messages/outgoing/MessageComposer.java | 14 ++- .../achievements/AchievementListComposer.java | 2 +- .../AchievementProgressComposer.java | 2 +- .../AchievementUnlockedComposer.java | 2 +- .../TalentLevelUpdateComposer.java | 2 +- .../talenttrack/TalentTrackComposer.java | 2 +- .../CameraCompetitionStatusComposer.java | 2 +- .../outgoing/camera/CameraPriceComposer.java | 2 +- .../CameraPublishWaitMessageComposer.java | 2 +- .../CameraPurchaseSuccesfullComposer.java | 2 +- .../CameraRoomThumbnailSavedComposer.java | 2 +- .../outgoing/camera/CameraURLComposer.java | 2 +- .../catalog/AlertLimitedSoldOutComposer.java | 2 +- .../catalog/AlertPurchaseFailedComposer.java | 2 +- .../AlertPurchaseUnavailableComposer.java | 2 +- .../outgoing/catalog/CatalogModeComposer.java | 2 +- .../outgoing/catalog/CatalogPageComposer.java | 2 +- .../catalog/CatalogPagesListComposer.java | 2 +- .../catalog/CatalogSearchResultComposer.java | 2 +- .../catalog/CatalogUpdatedComposer.java | 2 +- .../catalog/ClubCenterDataComposer.java | 2 +- .../outgoing/catalog/ClubDataComposer.java | 2 +- .../outgoing/catalog/ClubGiftsComposer.java | 2 +- .../outgoing/catalog/DiscountComposer.java | 2 +- .../catalog/GiftConfigurationComposer.java | 2 +- .../catalog/GiftReceiverNotFoundComposer.java | 2 +- .../catalog/NotEnoughPointsTypeComposer.java | 2 +- .../PetBoughtNotificationComposer.java | 2 +- .../outgoing/catalog/PetBreedsComposer.java | 2 +- .../catalog/PetNameErrorComposer.java | 2 +- .../outgoing/catalog/PurchaseOKComposer.java | 2 +- .../catalog/RecyclerCompleteComposer.java | 2 +- .../catalog/RecyclerLogicComposer.java | 2 +- .../catalog/RedeemVoucherErrorComposer.java | 2 +- .../catalog/RedeemVoucherOKComposer.java | 2 +- .../catalog/ReloadRecyclerComposer.java | 2 +- .../catalog/TargetedOfferComposer.java | 2 +- .../MarketplaceBuyErrorComposer.java | 2 +- .../MarketplaceCancelSaleComposer.java | 2 +- .../MarketplaceConfigComposer.java | 2 +- .../MarketplaceItemInfoComposer.java | 2 +- .../MarketplaceItemPostedComposer.java | 2 +- .../MarketplaceOffersComposer.java | 2 +- .../MarketplaceOwnItemsComposer.java | 2 +- .../MarketplaceSellItemComposer.java | 2 +- .../crafting/CraftableProductsComposer.java | 2 +- .../crafting/CraftingRecipeComposer.java | 2 +- .../CraftingRecipesAvailableComposer.java | 2 +- .../crafting/CraftingResultComposer.java | 2 +- .../calendar/AdventCalendarDataComposer.java | 2 +- .../AdventCalendarProductComposer.java | 2 +- .../mysticbox/MysticBoxCloseComposer.java | 2 +- .../mysticbox/MysticBoxPrizeComposer.java | 2 +- .../mysticbox/MysticBoxStartOpenComposer.java | 2 +- .../NewYearResolutionCompletedComposer.java | 2 +- .../resolution/NewYearResolutionComposer.java | 2 +- .../NewYearResolutionProgressComposer.java | 2 +- .../FloorPlanEditorBlockedTilesComposer.java | 2 +- .../FloorPlanEditorDoorSettingsComposer.java | 2 +- .../friends/FriendChatMessageComposer.java | 2 +- .../friends/FriendFindingRoomComposer.java | 2 +- .../friends/FriendNotificationComposer.java | 2 +- .../friends/FriendRequestComposer.java | 2 +- .../friends/FriendRequestErrorComposer.java | 2 +- .../outgoing/friends/FriendsComposer.java | 2 +- .../friends/LoadFriendRequestsComposer.java | 2 +- .../friends/MessengerInitComposer.java | 2 +- .../friends/RemoveFriendComposer.java | 2 +- .../outgoing/friends/RoomInviteComposer.java | 2 +- .../friends/RoomInviteErrorComposer.java | 2 +- .../outgoing/friends/StalkErrorComposer.java | 2 +- .../friends/UpdateFriendComposer.java | 2 +- .../friends/UserSearchResultComposer.java | 2 +- .../GameCenterAccountInfoComposer.java | 2 +- ...nterAchievementsConfigurationComposer.java | 2 +- .../gamecenter/GameCenterGameComposer.java | 2 +- .../GameCenterGameListComposer.java | 2 +- .../basejump/BaseJumpJoinQueueComposer.java | 2 +- .../basejump/BaseJumpLeaveQueueComposer.java | 2 +- .../basejump/BaseJumpLoadGameComposer.java | 2 +- .../basejump/BaseJumpLoadGameURLComposer.java | 2 +- .../basejump/BaseJumpUnloadGameComposer.java | 2 +- .../generic/MinimailCountComposer.java | 2 +- ...ckMonthlyClubGiftNotificationComposer.java | 2 +- .../generic/alerts/BotErrorComposer.java | 2 +- .../generic/alerts/BubbleAlertComposer.java | 2 +- .../alerts/CustomNotificationComposer.java | 2 +- .../generic/alerts/GenericAlertComposer.java | 2 +- .../alerts/GenericErrorMessagesComposer.java | 2 +- .../alerts/HotelClosedAndOpensComposer.java | 2 +- .../HotelClosesAndWillOpenAtComposer.java | 2 +- ...elWillCloseInMinutesAndBackInComposer.java | 2 +- .../HotelWillCloseInMinutesComposer.java | 2 +- .../alerts/MessagesForYouComposer.java | 2 +- .../generic/alerts/PetErrorComposer.java | 2 +- .../StaffAlertAndOpenHabboWayComposer.java | 2 +- ...fAlertWIthLinkAndOpenHabboWayComposer.java | 2 +- .../alerts/StaffAlertWithLinkComposer.java | 2 +- .../generic/alerts/UpdateFailedComposer.java | 2 +- .../outgoing/generic/testcomposer.java | 2 +- .../GuardianNewReportReceivedComposer.java | 2 +- .../GuardianVotingRequestedComposer.java | 2 +- .../GuardianVotingResultComposer.java | 2 +- .../guardians/GuardianVotingTimeEnded.java | 2 +- .../GuardianVotingVotesComposer.java | 2 +- .../guides/BullyReportClosedComposer.java | 2 +- .../guides/GuideSessionAttachedComposer.java | 2 +- .../guides/GuideSessionDetachedComposer.java | 2 +- .../guides/GuideSessionEndedComposer.java | 2 +- .../guides/GuideSessionErrorComposer.java | 2 +- ...uideSessionInvitedToGuideRoomComposer.java | 2 +- .../guides/GuideSessionMessageComposer.java | 2 +- .../GuideSessionPartnerIsPlayingComposer.java | 2 +- .../GuideSessionPartnerIsTypingComposer.java | 2 +- .../GuideSessionRequesterRoomComposer.java | 2 +- .../guides/GuideSessionStartedComposer.java | 2 +- .../outgoing/guides/GuideToolsComposer.java | 2 +- .../GuildAcceptMemberErrorComposer.java | 2 +- .../outgoing/guilds/GuildBoughtComposer.java | 2 +- .../guilds/GuildBuyRoomsComposer.java | 2 +- .../GuildConfirmRemoveMemberComposer.java | 2 +- .../guilds/GuildEditFailComposer.java | 2 +- .../GuildFavoriteRoomUserUpdateComposer.java | 2 +- .../guilds/GuildFurniWidgetComposer.java | 2 +- .../outgoing/guilds/GuildInfoComposer.java | 2 +- .../guilds/GuildJoinErrorComposer.java | 2 +- .../outgoing/guilds/GuildListComposer.java | 2 +- .../outgoing/guilds/GuildManageComposer.java | 2 +- .../guilds/GuildMemberUpdateComposer.java | 2 +- .../outgoing/guilds/GuildMembersComposer.java | 2 +- .../outgoing/guilds/GuildPartsComposer.java | 2 +- .../GuildRefreshMembersListComposer.java | 2 +- .../guilds/RemoveGuildFromRoomComposer.java | 2 +- .../forums/GuildForumAddCommentComposer.java | 2 +- .../forums/GuildForumCommentsComposer.java | 2 +- .../guilds/forums/GuildForumDataComposer.java | 2 +- .../guilds/forums/GuildForumListComposer.java | 2 +- .../GuildForumThreadMessagesComposer.java | 2 +- .../forums/GuildForumThreadsComposer.java | 2 +- ...uildForumsUnreadMessagesCountComposer.java | 2 +- .../forums/PostUpdateMessageComposer.java | 2 +- .../forums/ThreadUpdatedMessageComposer.java | 2 +- .../habboway/HabboWayQuizComposer1.java | 2 +- .../habboway/HabboWayQuizComposer2.java | 2 +- .../habboway/nux/NewUserGiftComposer.java | 2 +- .../habboway/nux/NewUserIdentityComposer.java | 2 +- .../habboway/nux/NuxAlertComposer.java | 2 +- .../CompleteDiffieHandshakeComposer.java | 2 +- .../handshake/ConnectionErrorComposer.java | 2 +- .../handshake/DebugConsoleComposer.java | 2 +- .../InitDiffieHandshakeComposer.java | 2 +- .../outgoing/handshake/MachineIDComposer.java | 2 +- .../outgoing/handshake/PongComposer.java | 2 +- .../handshake/SecureLoginOKComposer.java | 2 +- .../handshake/SessionRightsComposer.java | 2 +- .../handshake/SomeConnectionComposer.java | 2 +- .../outgoing/hotelview/BonusRareComposer.java | 2 +- .../hotelview/HallOfFameComposer.java | 2 +- .../HotelViewBadgeButtonConfigComposer.java | 2 +- .../HotelViewCatalogPageExpiringComposer.java | 2 +- .../HotelViewCommunityGoalComposer.java | 2 +- .../outgoing/hotelview/HotelViewComposer.java | 2 +- .../HotelViewConcurrentUsersComposer.java | 2 +- .../HotelViewCustomTimerComposer.java | 2 +- .../hotelview/HotelViewDataComposer.java | 2 +- ...HotelViewExpiringCatalogPageCommposer.java | 2 +- ...elViewHideCommunityVoteButtonComposer.java | 2 +- .../HotelViewNextLTDAvailableComposer.java | 2 +- .../HotelViewSecondsUntilComposer.java | 2 +- .../outgoing/hotelview/NewsListComposer.java | 2 +- .../outgoing/inventory/AddBotComposer.java | 2 +- .../inventory/AddHabboItemComposer.java | 2 +- .../outgoing/inventory/AddPetComposer.java | 2 +- .../inventory/EffectsListAddComposer.java | 2 +- .../EffectsListEffectEnableComposer.java | 2 +- .../inventory/EffectsListRemoveComposer.java | 2 +- .../InventoryAchievementsComposer.java | 2 +- .../inventory/InventoryBadgesComposer.java | 2 +- .../inventory/InventoryBotsComposer.java | 2 +- .../inventory/InventoryItemsComposer.java | 2 +- .../inventory/InventoryPetsComposer.java | 2 +- .../inventory/InventoryRefreshComposer.java | 2 +- .../InventoryUpdateItemComposer.java | 2 +- .../outgoing/inventory/RemoveBotComposer.java | 2 +- .../inventory/RemoveHabboItemComposer.java | 2 +- .../outgoing/inventory/RemovePetComposer.java | 2 +- .../inventory/UserEffectsListComposer.java | 2 +- .../modtool/BullyReportRequestComposer.java | 2 +- .../modtool/BullyReportedMessageComposer.java | 2 +- .../modtool/CfhTopicsMessageComposer.java | 2 +- .../HelperRequestDisabledComposer.java | 2 +- .../outgoing/modtool/ModToolComposer.java | 2 +- .../modtool/ModToolIssueChatlogComposer.java | 2 +- .../modtool/ModToolIssueHandledComposer.java | 2 +- ...ModToolIssueHandlerDimensionsComposer.java | 2 +- .../modtool/ModToolIssueInfoComposer.java | 2 +- .../ModToolIssueResponseAlertComposer.java | 2 +- .../modtool/ModToolIssueUpdateComposer.java | 2 +- .../ModToolReportReceivedAlertComposer.java | 2 +- .../modtool/ModToolRoomChatlogComposer.java | 2 +- .../modtool/ModToolRoomInfoComposer.java | 2 +- .../modtool/ModToolSanctionInfoComposer.java | 2 +- .../modtool/ModToolUserChatlogComposer.java | 2 +- .../modtool/ModToolUserInfoComposer.java | 2 +- .../ModToolUserRoomVisitsComposer.java | 2 +- .../modtool/ReportRoomFormComposer.java | 2 +- .../navigator/CanCreateEventComposer.java | 2 +- .../navigator/CanCreateRoomComposer.java | 2 +- ...NewNavigatorCategoryUserCountComposer.java | 2 +- ...wNavigatorCollapsedCategoriesComposer.java | 2 +- .../NewNavigatorEventCategoriesComposer.java | 2 +- .../NewNavigatorLiftedRoomsComposer.java | 2 +- .../NewNavigatorMetaDataComposer.java | 2 +- .../NewNavigatorSavedSearchesComposer.java | 2 +- .../NewNavigatorSearchResultsComposer.java | 2 +- .../NewNavigatorSettingsComposer.java | 2 +- .../OpenRoomCreationWindowComposer.java | 2 +- .../navigator/PrivateRoomsComposer.java | 2 +- .../navigator/RoomCategoriesComposer.java | 2 +- .../navigator/RoomCreatedComposer.java | 2 +- .../outgoing/navigator/TagsComposer.java | 2 +- .../outgoing/polls/PollQuestionsComposer.java | 2 +- .../outgoing/polls/PollStartComposer.java | 2 +- .../infobus/SimplePollAnswerComposer.java | 2 +- .../infobus/SimplePollAnswersComposer.java | 2 +- .../infobus/SimplePollStartComposer.java | 2 +- .../quests/QuestCompletedComposer.java | 2 +- .../outgoing/quests/QuestComposer.java | 2 +- .../outgoing/quests/QuestExpiredComposer.java | 2 +- .../outgoing/quests/QuestionInfoComposer.java | 2 +- .../outgoing/quests/QuestsComposer.java | 2 +- .../BotForceOpenContextMenuComposer.java | 2 +- .../outgoing/rooms/BotSettingsComposer.java | 2 +- .../rooms/DoorbellAddUserComposer.java | 2 +- .../rooms/FavoriteRoomChangedComposer.java | 2 +- .../outgoing/rooms/FloodCounterComposer.java | 2 +- .../outgoing/rooms/ForwardToRoomComposer.java | 2 +- .../outgoing/rooms/FreezeLivesComposer.java | 2 +- .../outgoing/rooms/HideDoorbellComposer.java | 2 +- .../rooms/KnockKnockUnknownComposer.java | 2 +- .../rooms/RoomAccessDeniedComposer.java | 2 +- .../rooms/RoomAddRightsListComposer.java | 2 +- .../rooms/RoomBannedUsersComposer.java | 2 +- .../rooms/RoomChatSettingsComposer.java | 2 +- .../outgoing/rooms/RoomDataComposer.java | 2 +- .../rooms/RoomEditSettingsErrorComposer.java | 2 +- .../rooms/RoomEnterErrorComposer.java | 2 +- .../outgoing/rooms/RoomEntryInfoComposer.java | 2 +- .../rooms/RoomFilterWordsComposer.java | 2 +- .../RoomFloorThicknessUpdatedComposer.java | 2 +- .../outgoing/rooms/RoomHeightMapComposer.java | 2 +- .../outgoing/rooms/RoomModelComposer.java | 2 +- .../outgoing/rooms/RoomMutedComposer.java | 2 +- .../outgoing/rooms/RoomNoRightsComposer.java | 2 +- .../outgoing/rooms/RoomOpenComposer.java | 2 +- .../outgoing/rooms/RoomOwnerComposer.java | 2 +- .../outgoing/rooms/RoomPaintComposer.java | 2 +- .../outgoing/rooms/RoomPaneComposer.java | 2 +- .../rooms/RoomQueueStatusMessage.java | 2 +- .../rooms/RoomRelativeMapComposer.java | 2 +- .../rooms/RoomRemoveRightsListComposer.java | 2 +- .../outgoing/rooms/RoomRightsComposer.java | 2 +- .../rooms/RoomRightsListComposer.java | 2 +- .../outgoing/rooms/RoomScoreComposer.java | 2 +- .../outgoing/rooms/RoomSettingsComposer.java | 2 +- .../rooms/RoomSettingsSavedComposer.java | 2 +- .../rooms/RoomSettingsUpdatedComposer.java | 2 +- .../outgoing/rooms/RoomThicknessComposer.java | 2 +- .../rooms/UpdateStackHeightComposer.java | 2 +- .../rooms/items/AddFloorItemComposer.java | 2 +- .../rooms/items/AddWallItemComposer.java | 2 +- .../items/FloorItemOnRollerComposer.java | 2 +- .../rooms/items/FloorItemUpdateComposer.java | 2 +- .../rooms/items/ItemExtraDataComposer.java | 2 +- .../rooms/items/ItemIntStateComposer.java | 2 +- .../rooms/items/ItemStateComposer.java | 2 +- .../rooms/items/ItemsDataUpdateComposer.java | 2 +- .../rooms/items/MoodLightDataComposer.java | 2 +- .../rooms/items/PostItDataComposer.java | 2 +- .../items/PostItStickyPoleOpenComposer.java | 2 +- .../items/PresentItemOpenedComposer.java | 2 +- .../rooms/items/RemoveFloorItemComposer.java | 2 +- .../rooms/items/RemoveWallItemComposer.java | 2 +- .../rooms/items/RoomFloorItemsComposer.java | 2 +- .../rooms/items/RoomWallItemsComposer.java | 2 +- .../UpdateStackHeightTileHeightComposer.java | 2 +- .../rooms/items/WallItemUpdateComposer.java | 2 +- .../items/jukebox/JukeBoxMySongsComposer.java | 2 +- .../JukeBoxNowPlayingMessageComposer.java | 2 +- .../JukeBoxPlayListAddSongComposer.java | 2 +- .../jukebox/JukeBoxPlayListComposer.java | 2 +- .../JukeBoxPlayListUpdatedComposer.java | 2 +- .../jukebox/JukeBoxPlaylistFullComposer.java | 2 +- .../jukebox/JukeBoxTrackCodeComposer.java | 2 +- .../jukebox/JukeBoxTrackDataComposer.java | 2 +- .../LoveLockFurniFinishedComposer.java | 2 +- .../LoveLockFurniFriendConfirmedComposer.java | 2 +- .../lovelock/LoveLockFurniStartComposer.java | 2 +- .../RentableSpaceInfoComposer.java | 2 +- .../RentableSpaceUnknown2Composer.java | 2 +- .../RentableSpaceUnknownComposer.java | 2 +- .../youtube/YoutubeDisplayListComposer.java | 2 +- .../youtube/YoutubeStateChangeComposer.java | 2 +- .../items/youtube/YoutubeVideoComposer.java | 2 +- .../CantScratchPetNotOldEnoughComposer.java | 2 +- .../rooms/pets/PetInformationComposer.java | 2 +- .../rooms/pets/PetLevelUpComposer.java | 2 +- .../rooms/pets/PetLevelUpdatedComposer.java | 2 +- .../rooms/pets/PetPackageComposer.java | 2 +- .../PetPackageNameValidationComposer.java | 2 +- .../rooms/pets/PetStatusUpdateComposer.java | 2 +- .../rooms/pets/PetTrainingPanelComposer.java | 2 +- .../outgoing/rooms/pets/RoomPetComposer.java | 2 +- .../rooms/pets/RoomPetExperienceComposer.java | 2 +- .../pets/RoomPetHorseFigureComposer.java | 2 +- .../rooms/pets/RoomPetRespectComposer.java | 2 +- .../pets/breeding/PetBreedingCompleted.java | 2 +- .../breeding/PetBreedingFailedComposer.java | 2 +- .../breeding/PetBreedingResultComposer.java | 2 +- .../breeding/PetBreedingStartComposer.java | 2 +- .../PetBreedingStartFailedComposer.java | 2 +- .../PromoteOwnRoomsListComposer.java | 2 +- .../RoomPromotionMessageComposer.java | 2 +- .../users/ChangeNameUpdatedComposer.java | 2 +- .../rooms/users/RoomUnitIdleComposer.java | 2 +- .../rooms/users/RoomUnitOnRollerComposer.java | 2 +- .../rooms/users/RoomUserActionComposer.java | 2 +- .../rooms/users/RoomUserDanceComposer.java | 2 +- .../rooms/users/RoomUserDataComposer.java | 2 +- .../rooms/users/RoomUserEffectComposer.java | 2 +- .../rooms/users/RoomUserHandItemComposer.java | 2 +- .../rooms/users/RoomUserIgnoredComposer.java | 2 +- .../users/RoomUserNameChangedComposer.java | 2 +- .../RoomUserReceivedHandItemComposer.java | 2 +- .../rooms/users/RoomUserRemoveComposer.java | 2 +- .../users/RoomUserRemoveRightsComposer.java | 2 +- .../rooms/users/RoomUserRespectComposer.java | 2 +- .../rooms/users/RoomUserShoutComposer.java | 2 +- .../rooms/users/RoomUserStatusComposer.java | 2 +- .../rooms/users/RoomUserTagsComposer.java | 2 +- .../rooms/users/RoomUserTalkComposer.java | 2 +- .../rooms/users/RoomUserTypingComposer.java | 2 +- .../rooms/users/RoomUserUnbannedComposer.java | 2 +- .../rooms/users/RoomUserWhisperComposer.java | 2 +- .../users/RoomUsersAddGuildBadgeComposer.java | 2 +- .../rooms/users/RoomUsersComposer.java | 2 +- .../users/RoomUsersGuildBadgesComposer.java | 2 +- .../trading/OtherTradingDisabledComposer.java | 2 +- .../trading/TradeAcceptedComposer.java | 2 +- .../trading/TradeCloseWindowComposer.java | 2 +- .../outgoing/trading/TradeClosedComposer.java | 2 +- .../trading/TradeCompleteComposer.java | 2 +- .../outgoing/trading/TradeStartComposer.java | 2 +- .../trading/TradeStartFailComposer.java | 2 +- .../outgoing/trading/TradeUpdateComposer.java | 2 +- .../TradingWaitingConfirmComposer.java | 2 +- .../trading/YouTradingDisabledComposer.java | 2 +- .../unknown/BuildersClubExpiredComposer.java | 2 +- .../unknown/CloseWebPageComposer.java | 2 +- .../CompetitionEntrySubmitResultComposer.java | 2 +- .../ConvertedForwardToRoomComposer.java | 2 +- .../unknown/EpicPopupFrameComposer.java | 2 +- .../outgoing/unknown/ErrorLoginComposer.java | 2 +- .../unknown/ExtendClubMessageComposer.java | 2 +- .../outgoing/unknown/HabboMallComposer.java | 2 +- .../unknown/IgnoredUsersComposer.java | 2 +- .../unknown/MessengerErrorComposer.java | 2 +- .../unknown/MinimailNewMessageComposer.java | 2 +- .../outgoing/unknown/ModToolComposerOne.java | 2 +- .../unknown/ModToolSanctionDataComposer.java | 2 +- .../MostUselessErrorAlertComposer.java | 2 +- .../unknown/MysteryPrizeComposer.java | 2 +- .../unknown/RemoveRoomEventComposer.java | 2 +- .../RentableItemBuyOutPriceComposer.java | 2 +- .../outgoing/unknown/RoomAdErrorComposer.java | 2 +- .../RoomCategoryUpdateMessageComposer.java | 2 +- .../RoomMessagesPostedCountComposer.java | 2 +- .../unknown/RoomUnknown3Composer.java | 2 +- .../RoomUserQuestionAnsweredComposer.java | 2 +- .../unknown/SnowWarsAddUserComposer.java | 2 +- .../outgoing/unknown/SnowWarsCompose1.java | 2 +- .../SnowWarsFullGameStatusComposer.java | 2 +- .../SnowWarsGameStartedErrorComposer.java | 2 +- .../unknown/SnowWarsGenericErrorComposer.java | 2 +- .../unknown/SnowWarsInitGameArena.java | 2 +- .../unknown/SnowWarsJoinErrorComposer.java | 2 +- .../unknown/SnowWarsLevelDataComposer.java | 2 +- .../unknown/SnowWarsLoadingArenaComposer.java | 2 +- .../unknown/SnowWarsLongDataComposer.java | 2 +- .../unknown/SnowWarsOnGameEnding.java | 2 +- .../unknown/SnowWarsOnStageEnding.java | 2 +- .../SnowWarsOnStageRunningComposer.java | 2 +- .../unknown/SnowWarsOnStageStartComposer.java | 2 +- .../SnowWarsPlayNowWindowComposer.java | 2 +- .../unknown/SnowWarsPreviousRoomComposer.java | 2 +- .../unknown/SnowWarsQuePositionComposer.java | 2 +- .../unknown/SnowWarsQuickJoinComposer.java | 2 +- .../unknown/SnowWarsRemoveUserComposer.java | 2 +- .../unknown/SnowWarsResetTimerComposer.java | 2 +- .../unknown/SnowWarsStartLobbyCounter.java | 2 +- .../unknown/SnowWarsUnknownComposer.java | 2 +- .../unknown/SnowWarsUserChatComposer.java | 2 +- .../SnowWarsUserEnteredArenaComposer.java | 2 +- .../SnowWarsUserExitArenaComposer.java | 2 +- .../TalentTrackEmailFailedComposer.java | 2 +- .../TalentTrackEmailVerifiedComposer.java | 2 +- .../unknown/UnknownAdManagerComposer.java | 2 +- .../unknown/UnknownAvatarEditorComposer.java | 2 +- .../UnknownCatalogPageOfferComposer.java | 2 +- .../unknown/UnknownCompetitionComposer.java | 2 +- .../outgoing/unknown/UnknownComposer4.java | 2 +- .../outgoing/unknown/UnknownComposer5.java | 2 +- .../outgoing/unknown/UnknownComposer8.java | 2 +- .../unknown/UnknownFurniModelComposer.java | 2 +- .../unknown/UnknownGuild2Composer.java | 2 +- .../unknown/UnknownGuildComposer3.java | 2 +- .../unknown/UnknownHabboWayQuizComposer.java | 2 +- .../unknown/UnknownHelperComposer.java | 2 +- .../outgoing/unknown/UnknownHintComposer.java | 2 +- .../UnknownMessengerErrorComposer.java | 2 +- .../unknown/UnknownPollQuestionComposer.java | 2 +- .../unknown/UnknownRoomDesktopComposer.java | 2 +- .../unknown/UnknownRoomViewerComposer.java | 2 +- .../unknown/UnknownStatusComposer.java | 2 +- .../unknown/UnknownTradeComposer.java | 2 +- .../unknown/UnkownPetPackageComposer.java | 2 +- .../unknown/UserClassificationComposer.java | 2 +- .../unknown/VipTutorialsStartComposer.java | 2 +- .../unknown/WatchAndEarnRewardComposer.java | 2 +- .../outgoing/unknown/WelcomeGiftComposer.java | 2 +- .../unknown/WelcomeGiftErrorComposer.java | 2 +- .../outgoing/users/AddUserBadgeComposer.java | 2 +- .../users/ChangeNameCheckResultComposer.java | 2 +- .../users/ClubGiftReceivedComposer.java | 2 +- .../users/FavoriteRoomsCountComposer.java | 2 +- .../users/MeMenuSettingsComposer.java | 2 +- .../outgoing/users/MutedWhisperComposer.java | 2 +- .../users/ProfileFriendsComposer.java | 2 +- .../users/UpdateUserLookComposer.java | 2 +- .../users/UserAchievementScoreComposer.java | 2 +- .../outgoing/users/UserBCLimitsComposer.java | 2 +- .../outgoing/users/UserBadgesComposer.java | 2 +- .../users/UserCitizinShipComposer.java | 2 +- .../outgoing/users/UserClothesComposer.java | 2 +- .../outgoing/users/UserClubComposer.java | 2 +- .../outgoing/users/UserCreditsComposer.java | 2 +- .../outgoing/users/UserCurrencyComposer.java | 2 +- .../outgoing/users/UserDataComposer.java | 2 +- .../outgoing/users/UserHomeRoomComposer.java | 2 +- .../outgoing/users/UserPerksComposer.java | 2 +- .../users/UserPermissionsComposer.java | 2 +- .../outgoing/users/UserPointsComposer.java | 2 +- .../outgoing/users/UserProfileComposer.java | 2 +- .../outgoing/users/UserWardrobeComposer.java | 2 +- .../VerifyMobileNumberComposer.java | 2 +- .../VerifyMobilePhoneCodeWindowComposer.java | 2 +- .../VerifyMobilePhoneDoneComposer.java | 2 +- .../VerifyMobilePhoneWindowComposer.java | 2 +- .../wired/WiredConditionDataComposer.java | 2 +- .../wired/WiredEffectDataComposer.java | 2 +- .../outgoing/wired/WiredOpenComposer.java | 2 +- .../wired/WiredRewardAlertComposer.java | 2 +- .../outgoing/wired/WiredSavedComposer.java | 2 +- .../wired/WiredTriggerDataComposer.java | 2 +- .../eu/habbo/messages/rcon/FriendRequest.java | 2 +- .../encoders/GameServerMessageEncoder.java | 1 + .../java/com/eu/habbo/util/DebugUtils.java | 22 +++++ 483 files changed, 582 insertions(+), 522 deletions(-) create mode 100644 src/main/java/com/eu/habbo/messages/ServerMessageException.java create mode 100644 src/main/java/com/eu/habbo/util/DebugUtils.java diff --git a/src/main/java/com/eu/habbo/core/RoomUserPetComposer.java b/src/main/java/com/eu/habbo/core/RoomUserPetComposer.java index 9799350d..d593d1ff 100644 --- a/src/main/java/com/eu/habbo/core/RoomUserPetComposer.java +++ b/src/main/java/com/eu/habbo/core/RoomUserPetComposer.java @@ -19,7 +19,7 @@ public class RoomUserPetComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUsersComposer); this.response.appendInt(1); this.response.appendInt(this.habbo.getHabboInfo().getId()); diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java index e1b88271..d948c332 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java @@ -6,7 +6,6 @@ import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.*; import com.eu.habbo.habbohotel.users.Habbo; 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.BubbleAlertComposer; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys; diff --git a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java index b9b81e4d..4242467d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java +++ b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java @@ -87,14 +87,7 @@ public class GameClient { } public void sendResponse(MessageComposer composer) { - if (this.channel.isOpen()) { - try { - this.channel.write(composer.compose().retain(), this.channel.voidPromise()); - this.channel.flush(); - } catch (Exception e) { - LOGGER.error("Caught exception", e); - } - } + this.sendResponse(composer.compose()); } public void sendResponse(ServerMessage response) { diff --git a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java index c8460d57..ad9b28ff 100644 --- a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java @@ -5,7 +5,6 @@ import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.networking.gameserver.GameServerAttributes; import io.netty.channel.*; -import io.netty.util.AttributeKey; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFXBox.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFXBox.java index a645676e..ca92ccf4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFXBox.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFXBox.java @@ -7,7 +7,6 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.HabboGender; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.inventory.EffectsComponent; -import com.eu.habbo.messages.outgoing.inventory.UserEffectsListComposer; import com.eu.habbo.messages.outgoing.rooms.items.RemoveFloorItemComposer; import com.eu.habbo.threading.runnables.QueryDeleteHabboItem; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMultiHeight.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMultiHeight.java index efce0c5a..765b6e3b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMultiHeight.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMultiHeight.java @@ -11,7 +11,6 @@ import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer; import gnu.trove.set.hash.THashSet; -import org.apache.commons.math3.util.Pair; import java.sql.ResultSet; import java.sql.SQLException; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPuzzleBox.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPuzzleBox.java index daff0b5d..a23586ba 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPuzzleBox.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPuzzleBox.java @@ -9,9 +9,6 @@ import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer; import java.sql.ResultSet; import java.sql.SQLException; -import java.util.Arrays; -import java.util.Comparator; -import java.util.Optional; public class InteractionPuzzleBox extends HabboItem { public InteractionPuzzleBox(ResultSet set, Item baseItem) throws SQLException { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java index 55b96e98..33e0679d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java @@ -16,8 +16,6 @@ import com.eu.habbo.util.pathfinding.Rotation; import java.sql.ResultSet; import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; import java.util.concurrent.ExecutionException; public class InteractionVendingMachine extends HabboItem { diff --git a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java index 1653fcee..c891286e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java @@ -1,7 +1,6 @@ package com.eu.habbo.habbohotel.modtool; import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.bots.BotManager; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; diff --git a/src/main/java/com/eu/habbo/messages/ServerMessage.java b/src/main/java/com/eu/habbo/messages/ServerMessage.java index b6e5a840..f43831d1 100644 --- a/src/main/java/com/eu/habbo/messages/ServerMessage.java +++ b/src/main/java/com/eu/habbo/messages/ServerMessage.java @@ -1,42 +1,43 @@ package com.eu.habbo.messages; +import com.eu.habbo.util.DebugUtils; import com.eu.habbo.util.PacketUtils; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufOutputStream; import io.netty.buffer.Unpooled; +import io.netty.util.IllegalReferenceCountException; import io.netty.util.ReferenceCounted; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; +import java.util.concurrent.atomic.AtomicInteger; public class ServerMessage implements ReferenceCounted { private static final Logger LOGGER = LoggerFactory.getLogger(ServerMessage.class); + private boolean initialized; private int header; + private AtomicInteger refs; private ByteBufOutputStream stream; private ByteBuf channelBuffer; public ServerMessage() { - this.channelBuffer = Unpooled.buffer(); - this.stream = new ByteBufOutputStream(this.channelBuffer); + } public ServerMessage(int header) { - this.header = header; - this.channelBuffer = Unpooled.buffer(); - this.stream = new ByteBufOutputStream(this.channelBuffer); - try { - this.stream.writeInt(0); - this.stream.writeShort(header); - } catch (Exception e) { - LOGGER.error("ServerMessage exception", e); - } + this.init(header); } public ServerMessage init(int id) { + if (this.initialized) { + throw new ServerMessageException("ServerMessage was already initialized."); + } + this.header = id; + this.refs = new AtomicInteger(0); this.channelBuffer = Unpooled.buffer(); this.stream = new ByteBufOutputStream(this.channelBuffer); @@ -44,8 +45,9 @@ public class ServerMessage implements ReferenceCounted { this.stream.writeInt(0); this.stream.writeShort(id); } catch (Exception e) { - LOGGER.error("ServerMessage exception", e); + throw new ServerMessageException(e); } + return this; } @@ -53,7 +55,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.write(bytes); } catch (IOException e) { - LOGGER.error("ServerMessage exception", e); + throw new ServerMessageException(e); } } @@ -68,7 +70,7 @@ public class ServerMessage implements ReferenceCounted { this.stream.writeShort(data.length); this.stream.write(data); } catch (IOException e) { - LOGGER.error("ServerMessage exception", e); + throw new ServerMessageException(e); } } @@ -76,7 +78,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.writeChar(obj); } catch (IOException e) { - LOGGER.error("ServerMessage exception", e); + throw new ServerMessageException(e); } } @@ -84,7 +86,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.writeChars(obj.toString()); } catch (IOException e) { - LOGGER.error("ServerMessage exception", e); + throw new ServerMessageException(e); } } @@ -92,7 +94,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.writeInt(obj); } catch (IOException e) { - LOGGER.error("ServerMessage exception", e); + throw new ServerMessageException(e); } } @@ -105,7 +107,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.writeInt((int) obj); } catch (IOException e) { - LOGGER.error("ServerMessage exception", e); + throw new ServerMessageException(e); } } @@ -113,7 +115,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.writeInt(obj ? 1 : 0); } catch (IOException e) { - LOGGER.error("ServerMessage exception", e); + throw new ServerMessageException(e); } } @@ -121,7 +123,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.writeShort((short) obj); } catch (IOException e) { - LOGGER.error("ServerMessage exception", e); + throw new ServerMessageException(e); } } @@ -129,7 +131,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.writeByte(b); } catch (IOException e) { - LOGGER.error("ServerMessage exception", e); + throw new ServerMessageException(e); } } @@ -137,7 +139,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.writeBoolean(obj); } catch (IOException e) { - LOGGER.error("ServerMessage exception", e); + throw new ServerMessageException(e); } } @@ -145,7 +147,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.writeDouble(d); } catch (IOException e) { - LOGGER.error("ServerMessage exception", e); + throw new ServerMessageException(e); } } @@ -153,7 +155,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.writeDouble(obj); } catch (IOException e) { - LOGGER.error("ServerMessage exception", e); + throw new ServerMessageException(e); } } @@ -161,7 +163,7 @@ public class ServerMessage implements ReferenceCounted { try { this.stream.write(obj.get().array()); } catch (IOException e) { - LOGGER.error("ServerMessage exception", e); + throw new ServerMessageException(e); } return this; @@ -187,40 +189,64 @@ public class ServerMessage implements ReferenceCounted { @Override public int refCnt() { - return this.channelBuffer.refCnt(); + return this.refs.get(); } @Override public ReferenceCounted retain() { - this.channelBuffer.retain(); + int result = this.refs.incrementAndGet(); + + if (this.header == 1167 || this.header == 2024 || this.header == 2505) { + System.out.printf("retain Packet: %d Count: %d From: %s%n", this.header, result, DebugUtils.getCallerCallerStacktrace()); + } + return this; } @Override public ReferenceCounted retain(int i) { - this.channelBuffer.retain(i); + int result = this.refs.addAndGet(i); + + if (this.header == 1167 || this.header == 2024 || this.header == 2505) { + System.out.printf("retain Packet: %d Count: %d From: %s%n", this.header, result, DebugUtils.getCallerCallerStacktrace()); + } + return this; } @Override public ReferenceCounted touch() { - this.channelBuffer.touch(); return this; } @Override public ReferenceCounted touch(Object o) { - this.channelBuffer.touch(o); return this; } + @Override public boolean release() { - return this.channelBuffer.release(); + return this.release(1); } @Override public boolean release(int i) { - return this.channelBuffer.release(i); + int value = this.refs.addAndGet(-i); + + if (this.header == 1167 || this.header == 2024 || this.header == 2505) { + System.out.printf("release Packet: %d Count: %d From: %s%n", this.header, value, DebugUtils.getCallerCallerStacktrace()); + } + + if (value < 0) { + throw new IllegalReferenceCountException("Decremented below 0 (packet " + this.header + " value " + value + ")."); + } + + if (value == 0) { + this.channelBuffer.release(); + return true; + } + + return false; } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/ServerMessageException.java b/src/main/java/com/eu/habbo/messages/ServerMessageException.java new file mode 100644 index 00000000..17e5ecbb --- /dev/null +++ b/src/main/java/com/eu/habbo/messages/ServerMessageException.java @@ -0,0 +1,20 @@ +package com.eu.habbo.messages; + +public class ServerMessageException extends RuntimeException { + + public ServerMessageException() { + } + + public ServerMessageException(String message) { + super(message); + } + + public ServerMessageException(String message, Throwable cause) { + super(message, cause); + } + + public ServerMessageException(Throwable cause) { + super(cause); + } + +} diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildRemoveFavoriteEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildRemoveFavoriteEvent.java index 9f92df68..cd97c727 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildRemoveFavoriteEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildRemoveFavoriteEvent.java @@ -4,7 +4,6 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.guilds.Guild; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.guilds.GuildFavoriteRoomUserUpdateComposer; -import com.eu.habbo.messages.outgoing.rooms.users.RoomUsersAddGuildBadgeComposer; import com.eu.habbo.messages.outgoing.users.UserProfileComposer; import com.eu.habbo.plugin.events.guilds.GuildRemovedFavoriteEvent; diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/IsFirstLoginOfDayComposer.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/IsFirstLoginOfDayComposer.java index 33410ab0..39fa17ee 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/handshake/IsFirstLoginOfDayComposer.java +++ b/src/main/java/com/eu/habbo/messages/incoming/handshake/IsFirstLoginOfDayComposer.java @@ -12,7 +12,7 @@ public class IsFirstLoginOfDayComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.IsFirstLoginOfDayComposer); this.response.appendBoolean(this.isFirstLoginOfDay); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/UnknownComposer5.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/UnknownComposer5.java index d9940903..7cea96ee 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/handshake/UnknownComposer5.java +++ b/src/main/java/com/eu/habbo/messages/incoming/handshake/UnknownComposer5.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class UnknownComposer5 extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UnknownComposer5); this.response.appendString(""); //Box color this.response.appendString(""); //Key color diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/youtube/YoutubeRequestStateChange.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/youtube/YoutubeRequestStateChange.java index c0f23ebf..f212e698 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/youtube/YoutubeRequestStateChange.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/youtube/YoutubeRequestStateChange.java @@ -1,7 +1,6 @@ package com.eu.habbo.messages.incoming.rooms.items.youtube; import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.items.YoutubeManager; import com.eu.habbo.habbohotel.items.interactions.InteractionYoutubeTV; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserLookAtPoint.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserLookAtPoint.java index 2a50be89..24e8004c 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserLookAtPoint.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserLookAtPoint.java @@ -1,6 +1,5 @@ package com.eu.habbo.messages.incoming.rooms.users; -import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomUnit; @@ -8,7 +7,6 @@ import com.eu.habbo.habbohotel.rooms.RoomUnitStatus; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer; -import com.eu.habbo.plugin.events.users.UserIdleEvent; public class RoomUserLookAtPoint extends MessageHandler { @Override diff --git a/src/main/java/com/eu/habbo/messages/outgoing/MessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/MessageComposer.java index 1afb84ce..d55e8db8 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/MessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/MessageComposer.java @@ -3,11 +3,23 @@ package com.eu.habbo.messages.outgoing; import com.eu.habbo.messages.ServerMessage; public abstract class MessageComposer { + + private ServerMessage composed; protected final ServerMessage response; protected MessageComposer() { + this.composed = null; this.response = new ServerMessage(); } - public abstract ServerMessage compose(); + protected abstract ServerMessage composeInternal(); + + public ServerMessage compose() { + if (this.composed == null) { + this.composed = this.composeInternal(); + } + + return this.composed; + } + } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/outgoing/achievements/AchievementListComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/achievements/AchievementListComposer.java index 54418f38..be1660fe 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/achievements/AchievementListComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/achievements/AchievementListComposer.java @@ -21,7 +21,7 @@ public class AchievementListComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.AchievementListComposer); try { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/achievements/AchievementProgressComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/achievements/AchievementProgressComposer.java index 28d41bbb..8cf649b7 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/achievements/AchievementProgressComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/achievements/AchievementProgressComposer.java @@ -18,7 +18,7 @@ public class AchievementProgressComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.AchievementProgressComposer); int achievementProgress; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/achievements/AchievementUnlockedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/achievements/AchievementUnlockedComposer.java index 71489157..ca2449f3 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/achievements/AchievementUnlockedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/achievements/AchievementUnlockedComposer.java @@ -17,7 +17,7 @@ public class AchievementUnlockedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.AchievementUnlockedComposer); AchievementLevel level = this.achievement.getLevelForProgress(this.habbo.getHabboStats().getAchievementProgress(this.achievement)); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/achievements/talenttrack/TalentLevelUpdateComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/achievements/talenttrack/TalentLevelUpdateComposer.java index 6f954e4e..3a515350 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/achievements/talenttrack/TalentLevelUpdateComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/achievements/talenttrack/TalentLevelUpdateComposer.java @@ -17,7 +17,7 @@ public class TalentLevelUpdateComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.TalentLevelUpdateComposer); this.response.appendString(this.talentTrackType.name()); this.response.appendInt(this.talentTrackLevel.level); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/achievements/talenttrack/TalentTrackComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/achievements/talenttrack/TalentTrackComposer.java index d9a00946..87515a2b 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/achievements/talenttrack/TalentTrackComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/achievements/talenttrack/TalentTrackComposer.java @@ -23,7 +23,7 @@ public class TalentTrackComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.TalentTrackComposer); this.response.appendString(this.type.name().toLowerCase()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraCompetitionStatusComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraCompetitionStatusComposer.java index e013614d..31d4ef68 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraCompetitionStatusComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraCompetitionStatusComposer.java @@ -14,7 +14,7 @@ public class CameraCompetitionStatusComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.CameraCompetitionStatusComposer); this.response.appendBoolean(this.unknownBoolean); this.response.appendString(this.unknownString); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraPriceComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraPriceComposer.java index 15932016..133352c9 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraPriceComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraPriceComposer.java @@ -16,7 +16,7 @@ public class CameraPriceComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.CameraPriceComposer); this.response.appendInt(this.credits); this.response.appendInt(this.points); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraPublishWaitMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraPublishWaitMessageComposer.java index defe9a68..9c012410 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraPublishWaitMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraPublishWaitMessageComposer.java @@ -16,7 +16,7 @@ public class CameraPublishWaitMessageComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.CameraPublishWaitMessageComposer); this.response.appendBoolean(this.isOk); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraPurchaseSuccesfullComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraPurchaseSuccesfullComposer.java index ffc6b17b..293f840a 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraPurchaseSuccesfullComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraPurchaseSuccesfullComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class CameraPurchaseSuccesfullComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.CameraPurchaseSuccesfullComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraRoomThumbnailSavedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraRoomThumbnailSavedComposer.java index ab037eee..39279844 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraRoomThumbnailSavedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraRoomThumbnailSavedComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class CameraRoomThumbnailSavedComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.CameraRoomThumbnailSavedComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraURLComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraURLComposer.java index 6096f59a..414f6f57 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraURLComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/camera/CameraURLComposer.java @@ -12,7 +12,7 @@ public class CameraURLComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.CameraURLComposer); this.response.appendString(this.URL); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/AlertLimitedSoldOutComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/AlertLimitedSoldOutComposer.java index bea4faca..d6688e42 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/AlertLimitedSoldOutComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/AlertLimitedSoldOutComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class AlertLimitedSoldOutComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.AlertLimitedSoldOutComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/AlertPurchaseFailedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/AlertPurchaseFailedComposer.java index 4a1ad45d..4a8a456a 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/AlertPurchaseFailedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/AlertPurchaseFailedComposer.java @@ -15,7 +15,7 @@ public class AlertPurchaseFailedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.AlertPurchaseFailedComposer); this.response.appendInt(this.error); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/AlertPurchaseUnavailableComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/AlertPurchaseUnavailableComposer.java index 5d426976..fb4f8095 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/AlertPurchaseUnavailableComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/AlertPurchaseUnavailableComposer.java @@ -15,7 +15,7 @@ public class AlertPurchaseUnavailableComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.AlertPurchaseUnavailableComposer); this.response.appendInt(this.code); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogModeComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogModeComposer.java index 1fdf629e..4c45a1db 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogModeComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogModeComposer.java @@ -12,7 +12,7 @@ public class CatalogModeComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.CatalogModeComposer); this.response.appendInt(this.mode); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPageComposer.java index 82962855..9c0c682f 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPageComposer.java @@ -29,7 +29,7 @@ public class CatalogPageComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.CatalogPageComposer); this.response.appendInt(this.page.getId()); this.response.appendString(this.mode); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPagesListComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPagesListComposer.java index 1a23cd62..a6bb52ca 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPagesListComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPagesListComposer.java @@ -25,7 +25,7 @@ public class CatalogPagesListComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { try { List pages = Emulator.getGameEnvironment().getCatalogManager().getCatalogPages(-1, this.habbo); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogSearchResultComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogSearchResultComposer.java index 397e61cd..640683db 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogSearchResultComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogSearchResultComposer.java @@ -13,7 +13,7 @@ public class CatalogSearchResultComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.CatalogSearchResultComposer); this.item.serialize(this.response); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogUpdatedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogUpdatedComposer.java index 10eeffa7..8c82f2c7 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogUpdatedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogUpdatedComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class CatalogUpdatedComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.CatalogUpdatedComposer); this.response.appendBoolean(false); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/ClubCenterDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/ClubCenterDataComposer.java index 800b9df8..28b1472c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/ClubCenterDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/ClubCenterDataComposer.java @@ -24,7 +24,7 @@ public class ClubCenterDataComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ClubCenterDataComposer); this.response.appendInt(this.streakDuration); //streakduration in days this.response.appendString(this.joinDate); //joindate diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/ClubDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/ClubDataComposer.java index 787c6eed..6d44e75d 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/ClubDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/ClubDataComposer.java @@ -20,7 +20,7 @@ public class ClubDataComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ClubDataComposer); List offers = Emulator.getGameEnvironment().getCatalogManager().getClubOffers(); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/ClubGiftsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/ClubGiftsComposer.java index eb51719b..f4e1161d 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/ClubGiftsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/ClubGiftsComposer.java @@ -12,7 +12,7 @@ import java.util.NoSuchElementException; public class ClubGiftsComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ClubGiftsComposer); this.response.appendInt(0); //Days Until Next Gift diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/DiscountComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/DiscountComposer.java index 966bfa96..387e2a2e 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/DiscountComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/DiscountComposer.java @@ -12,7 +12,7 @@ public class DiscountComposer extends MessageComposer { public static int[] ADDITIONAL_DISCOUNT_THRESHOLDS = new int[]{40, 99}; @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.DiscountComposer); this.response.appendInt(MAXIMUM_ALLOWED_ITEMS); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/GiftConfigurationComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/GiftConfigurationComposer.java index 466d97a9..cf66be10 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/GiftConfigurationComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/GiftConfigurationComposer.java @@ -9,7 +9,7 @@ import java.util.Map; public class GiftConfigurationComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GiftConfigurationComposer); this.response.appendBoolean(true); this.response.appendInt(Emulator.getConfig().getInt("hotel.gifts.special.price", 2)); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/GiftReceiverNotFoundComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/GiftReceiverNotFoundComposer.java index c848b083..27ee4e34 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/GiftReceiverNotFoundComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/GiftReceiverNotFoundComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class GiftReceiverNotFoundComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GiftReceiverNotFoundComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/NotEnoughPointsTypeComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/NotEnoughPointsTypeComposer.java index b395ec71..ec20a8ae 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/NotEnoughPointsTypeComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/NotEnoughPointsTypeComposer.java @@ -16,7 +16,7 @@ public class NotEnoughPointsTypeComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.NotEnoughPointsTypeComposer); this.response.appendBoolean(this.isCredits); this.response.appendBoolean(this.isPixels); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/PetBoughtNotificationComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/PetBoughtNotificationComposer.java index a44503db..f2ed562e 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/PetBoughtNotificationComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/PetBoughtNotificationComposer.java @@ -15,7 +15,7 @@ public class PetBoughtNotificationComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.PetBoughtNotificationComposer); this.response.appendBoolean(this.gift); this.pet.serialize(this.response); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/PetBreedsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/PetBreedsComposer.java index 50ee6de8..a469dfa0 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/PetBreedsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/PetBreedsComposer.java @@ -16,7 +16,7 @@ public class PetBreedsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { if (this.petRaces == null) return null; this.response.init(Outgoing.PetBreedsComposer); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/PetNameErrorComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/PetNameErrorComposer.java index 089d0569..c392c97e 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/PetNameErrorComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/PetNameErrorComposer.java @@ -20,7 +20,7 @@ public class PetNameErrorComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.PetNameErrorComposer); this.response.appendInt(this.type); this.response.appendString(this.value); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/PurchaseOKComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/PurchaseOKComposer.java index 26098398..1750480a 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/PurchaseOKComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/PurchaseOKComposer.java @@ -17,7 +17,7 @@ public class PurchaseOKComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.PurchaseOKComposer); if (this.catalogItem != null) { this.catalogItem.serialize(this.response); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/RecyclerCompleteComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/RecyclerCompleteComposer.java index 22c1e5ba..54cfc606 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/RecyclerCompleteComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/RecyclerCompleteComposer.java @@ -15,7 +15,7 @@ public class RecyclerCompleteComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RecyclerCompleteComposer); this.response.appendInt(this.code); this.response.appendInt(0); //prize ID. diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/RecyclerLogicComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/RecyclerLogicComposer.java index 4f1acbcd..8d1890a2 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/RecyclerLogicComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/RecyclerLogicComposer.java @@ -11,7 +11,7 @@ import java.util.Map; public class RecyclerLogicComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RecyclerLogicComposer); this.response.appendInt(Emulator.getGameEnvironment().getCatalogManager().prizes.size()); for (Map.Entry> map : Emulator.getGameEnvironment().getCatalogManager().prizes.entrySet()) { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/RedeemVoucherErrorComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/RedeemVoucherErrorComposer.java index 3071affb..1632021f 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/RedeemVoucherErrorComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/RedeemVoucherErrorComposer.java @@ -15,7 +15,7 @@ public class RedeemVoucherErrorComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RedeemVoucherErrorComposer); this.response.appendString(this.code + ""); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/RedeemVoucherOKComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/RedeemVoucherOKComposer.java index 3458f781..b1988773 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/RedeemVoucherOKComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/RedeemVoucherOKComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class RedeemVoucherOKComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RedeemVoucherOKComposer); this.response.appendString(""); this.response.appendString(""); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/ReloadRecyclerComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/ReloadRecyclerComposer.java index 2aacdfa9..a6432eeb 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/ReloadRecyclerComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/ReloadRecyclerComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class ReloadRecyclerComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ReloadRecyclerComposer); this.response.appendInt(1); this.response.appendInt(0); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/TargetedOfferComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/TargetedOfferComposer.java index 67f8cfa7..ee8cbb66 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/TargetedOfferComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/TargetedOfferComposer.java @@ -17,7 +17,7 @@ public class TargetedOfferComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.TargetedOfferComposer); HabboOfferPurchase purchase = HabboOfferPurchase.getOrCreate(this.habbo, this.offer.getId()); this.offer.serialize(this.response, purchase); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceBuyErrorComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceBuyErrorComposer.java index d8281ad4..800bd4ca 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceBuyErrorComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceBuyErrorComposer.java @@ -23,7 +23,7 @@ public class MarketplaceBuyErrorComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.MarketplaceBuyErrorComposer); this.response.appendInt(this.errorCode); //result this.response.appendInt(this.unknown); //newOfferId diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceCancelSaleComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceCancelSaleComposer.java index 2676297a..97d24627 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceCancelSaleComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceCancelSaleComposer.java @@ -15,7 +15,7 @@ public class MarketplaceCancelSaleComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.MarketplaceCancelSaleComposer); this.response.appendInt(this.offer.getOfferId()); this.response.appendBoolean(this.success); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceConfigComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceConfigComposer.java index 9e52ecbd..1ee4ac18 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceConfigComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceConfigComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class MarketplaceConfigComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.MarketplaceConfigComposer); this.response.appendBoolean(true); this.response.appendInt(1); //Commision Percentage. diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceItemInfoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceItemInfoComposer.java index 896ad5ea..f9f5f6ec 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceItemInfoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceItemInfoComposer.java @@ -13,7 +13,7 @@ public class MarketplaceItemInfoComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.MarketplaceItemInfoComposer); MarketPlace.serializeItemInfo(this.itemId, this.response); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceItemPostedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceItemPostedComposer.java index 0f76450f..2489af8b 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceItemPostedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceItemPostedComposer.java @@ -17,7 +17,7 @@ public class MarketplaceItemPostedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.MarketplaceItemPostedComposer); this.response.appendInt(this.code); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceOffersComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceOffersComposer.java index dca0d0d8..e2e28d34 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceOffersComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceOffersComposer.java @@ -16,7 +16,7 @@ public class MarketplaceOffersComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.MarketplaceOffersComposer); int total = 0; this.response.appendInt(this.offers.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceOwnItemsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceOwnItemsComposer.java index d230697b..b02c1c0e 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceOwnItemsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceOwnItemsComposer.java @@ -20,7 +20,7 @@ public class MarketplaceOwnItemsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.MarketplaceOwnItemsComposer); this.response.appendInt(this.habbo.getInventory().getSoldPriceTotal()); this.response.appendInt(this.habbo.getInventory().getMarketplaceItems().size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceSellItemComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceSellItemComposer.java index 9c87a6e4..0834ed4c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceSellItemComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/marketplace/MarketplaceSellItemComposer.java @@ -20,7 +20,7 @@ public class MarketplaceSellItemComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.MarketplaceSellItemComposer); this.response.appendInt(this.errorCode); this.response.appendInt(this.valueA); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/crafting/CraftableProductsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/crafting/CraftableProductsComposer.java index a47a92e5..0c2254e3 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/crafting/CraftableProductsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/crafting/CraftableProductsComposer.java @@ -19,7 +19,7 @@ public class CraftableProductsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.CraftableProductsComposer); this.response.appendInt(this.recipes.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/crafting/CraftingRecipeComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/crafting/CraftingRecipeComposer.java index 42630413..a8db6787 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/crafting/CraftingRecipeComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/crafting/CraftingRecipeComposer.java @@ -16,7 +16,7 @@ public class CraftingRecipeComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.CraftingRecipeComposer); this.response.appendInt(this.recipe.getIngredients().size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/crafting/CraftingRecipesAvailableComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/crafting/CraftingRecipesAvailableComposer.java index 7da993a9..5f0c7739 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/crafting/CraftingRecipesAvailableComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/crafting/CraftingRecipesAvailableComposer.java @@ -14,7 +14,7 @@ public class CraftingRecipesAvailableComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.CraftingComposerFour); this.response.appendInt((this.found ? -1 : 0) + this.count); this.response.appendBoolean(this.found); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/crafting/CraftingResultComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/crafting/CraftingResultComposer.java index 0bc63cde..d7967e80 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/crafting/CraftingResultComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/crafting/CraftingResultComposer.java @@ -20,7 +20,7 @@ public class CraftingResultComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.CraftingResultComposer); this.response.appendBoolean(this.succes); //succes diff --git a/src/main/java/com/eu/habbo/messages/outgoing/events/calendar/AdventCalendarDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/events/calendar/AdventCalendarDataComposer.java index d171c3b2..82c512f2 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/events/calendar/AdventCalendarDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/events/calendar/AdventCalendarDataComposer.java @@ -22,7 +22,7 @@ public class AdventCalendarDataComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.AdventCalendarDataComposer); this.response.appendString(this.eventName); this.response.appendString(""); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/events/calendar/AdventCalendarProductComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/events/calendar/AdventCalendarProductComposer.java index 15c08771..999eefbb 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/events/calendar/AdventCalendarProductComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/events/calendar/AdventCalendarProductComposer.java @@ -16,7 +16,7 @@ public class AdventCalendarProductComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.AdventCalendarProductComposer); this.response.appendBoolean(this.visible); this.response.appendString(this.rewardObject.getItem().getName()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/events/mysticbox/MysticBoxCloseComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/events/mysticbox/MysticBoxCloseComposer.java index 1955ab93..c1593cea 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/events/mysticbox/MysticBoxCloseComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/events/mysticbox/MysticBoxCloseComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class MysticBoxCloseComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.MysticBoxCloseComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/events/mysticbox/MysticBoxPrizeComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/events/mysticbox/MysticBoxPrizeComposer.java index ff450fe2..f5e95b3d 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/events/mysticbox/MysticBoxPrizeComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/events/mysticbox/MysticBoxPrizeComposer.java @@ -14,7 +14,7 @@ public class MysticBoxPrizeComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.MysticBoxPrizeComposer); this.response.appendString(this.type); this.response.appendInt(this.itemId); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/events/mysticbox/MysticBoxStartOpenComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/events/mysticbox/MysticBoxStartOpenComposer.java index 99b826dd..b88c73cc 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/events/mysticbox/MysticBoxStartOpenComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/events/mysticbox/MysticBoxStartOpenComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class MysticBoxStartOpenComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.MysticBoxStartOpenComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/events/resolution/NewYearResolutionCompletedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/events/resolution/NewYearResolutionCompletedComposer.java index 4bc4be89..741b9443 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/events/resolution/NewYearResolutionCompletedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/events/resolution/NewYearResolutionCompletedComposer.java @@ -12,7 +12,7 @@ public class NewYearResolutionCompletedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.NewYearResolutionCompletedComposer); this.response.appendString(this.badge); this.response.appendString(this.badge); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/events/resolution/NewYearResolutionComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/events/resolution/NewYearResolutionComposer.java index 7cf0b693..7b2a4252 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/events/resolution/NewYearResolutionComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/events/resolution/NewYearResolutionComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class NewYearResolutionComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { //:test 817 i:230 i:1 i:1 i:1 s:NY2013RES i:3 i:0 i:60000000 this.response.init(Outgoing.NewYearResolutionComposer); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/events/resolution/NewYearResolutionProgressComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/events/resolution/NewYearResolutionProgressComposer.java index 8b90878f..c478f2e8 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/events/resolution/NewYearResolutionProgressComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/events/resolution/NewYearResolutionProgressComposer.java @@ -22,7 +22,7 @@ public class NewYearResolutionProgressComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.NewYearResolutionProgressComposer); this.response.appendInt(this.stuffId); this.response.appendInt(this.achievementId); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/floorplaneditor/FloorPlanEditorBlockedTilesComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/floorplaneditor/FloorPlanEditorBlockedTilesComposer.java index 48635c9f..3cccbe14 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/floorplaneditor/FloorPlanEditorBlockedTilesComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/floorplaneditor/FloorPlanEditorBlockedTilesComposer.java @@ -15,7 +15,7 @@ public class FloorPlanEditorBlockedTilesComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.FloorPlanEditorBlockedTilesComposer); THashSet tileList = this.room.getLockedTiles(); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/floorplaneditor/FloorPlanEditorDoorSettingsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/floorplaneditor/FloorPlanEditorDoorSettingsComposer.java index 0753f323..21874ea4 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/floorplaneditor/FloorPlanEditorDoorSettingsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/floorplaneditor/FloorPlanEditorDoorSettingsComposer.java @@ -13,7 +13,7 @@ public class FloorPlanEditorDoorSettingsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.FloorPlanEditorDoorSettingsComposer); this.response.appendInt(this.room.getLayout().getDoorX()); this.response.appendInt(this.room.getLayout().getDoorY()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendChatMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendChatMessageComposer.java index 168153ae..4806b437 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendChatMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendChatMessageComposer.java @@ -25,7 +25,7 @@ public class FriendChatMessageComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.FriendChatMessageComposer); this.response.appendInt(this.toId); this.response.appendString(this.message.getMessage()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendFindingRoomComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendFindingRoomComposer.java index 226f906d..8c100a69 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendFindingRoomComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendFindingRoomComposer.java @@ -15,7 +15,7 @@ public class FriendFindingRoomComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.FriendFindingRoomComposer); this.response.appendInt(this.errorCode); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendNotificationComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendNotificationComposer.java index 47847c34..9e9ed2fb 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendNotificationComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendNotificationComposer.java @@ -24,7 +24,7 @@ public class FriendNotificationComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.FriendToolbarNotificationComposer); this.response.appendString(this.userId + ""); this.response.appendInt(this.type); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendRequestComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendRequestComposer.java index 66188f6e..005ac3d8 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendRequestComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendRequestComposer.java @@ -13,7 +13,7 @@ public class FriendRequestComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.FriendRequestComposer); this.response.appendInt(this.habbo.getHabboInfo().getId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendRequestErrorComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendRequestErrorComposer.java index 37385c35..751dbc77 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendRequestErrorComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendRequestErrorComposer.java @@ -16,7 +16,7 @@ public class FriendRequestErrorComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.FriendRequestErrorComposer); this.response.appendInt(0); this.response.appendInt(this.errorCode); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendsComposer.java index 6832ff9e..0253f33f 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendsComposer.java @@ -22,7 +22,7 @@ public class FriendsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { try { this.response.init(Outgoing.FriendsComposer); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/friends/LoadFriendRequestsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/friends/LoadFriendRequestsComposer.java index b77206c5..fb3314b4 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/friends/LoadFriendRequestsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/friends/LoadFriendRequestsComposer.java @@ -14,7 +14,7 @@ public class LoadFriendRequestsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.LoadFriendRequestsComposer); synchronized (this.habbo.getMessenger().getFriendRequests()) { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/friends/MessengerInitComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/friends/MessengerInitComposer.java index 948bfe35..a48e6e65 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/friends/MessengerInitComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/friends/MessengerInitComposer.java @@ -14,7 +14,7 @@ public class MessengerInitComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.MessengerInitComposer); if (this.habbo.hasPermission("acc_infinite_friends")) { this.response.appendInt(Integer.MAX_VALUE); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/friends/RemoveFriendComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/friends/RemoveFriendComposer.java index a9c10163..34cbe1b4 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/friends/RemoveFriendComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/friends/RemoveFriendComposer.java @@ -18,7 +18,7 @@ public class RemoveFriendComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UpdateFriendComposer); this.response.appendInt(0); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/friends/RoomInviteComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/friends/RoomInviteComposer.java index 3aba1888..1b761a51 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/friends/RoomInviteComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/friends/RoomInviteComposer.java @@ -14,7 +14,7 @@ public class RoomInviteComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomInviteComposer); this.response.appendInt(this.userId); this.response.appendString(this.message); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/friends/RoomInviteErrorComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/friends/RoomInviteErrorComposer.java index 1543d09c..b2d3c54c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/friends/RoomInviteErrorComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/friends/RoomInviteErrorComposer.java @@ -17,7 +17,7 @@ public class RoomInviteErrorComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomInviteErrorComposer); this.response.appendInt(this.errorCode); this.response.appendInt(this.buddies.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/friends/StalkErrorComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/friends/StalkErrorComposer.java index cecf26a1..7eac0a99 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/friends/StalkErrorComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/friends/StalkErrorComposer.java @@ -17,7 +17,7 @@ public class StalkErrorComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.StalkErrorComposer); this.response.appendInt(this.errorCode); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/friends/UpdateFriendComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/friends/UpdateFriendComposer.java index 7f96aab7..907fa9a0 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/friends/UpdateFriendComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/friends/UpdateFriendComposer.java @@ -22,7 +22,7 @@ public class UpdateFriendComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UpdateFriendComposer); if (this.buddy != null) { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/friends/UserSearchResultComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/friends/UserSearchResultComposer.java index 0bb07e6b..7c66c3de 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/friends/UserSearchResultComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/friends/UserSearchResultComposer.java @@ -25,7 +25,7 @@ public class UserSearchResultComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UserSearchResultComposer); List u = new ArrayList<>(); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/GameCenterAccountInfoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/GameCenterAccountInfoComposer.java index f44d06ab..fd8760fa 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/GameCenterAccountInfoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/GameCenterAccountInfoComposer.java @@ -14,7 +14,7 @@ public class GameCenterAccountInfoComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GameCenterAccountInfoComposer); this.response.appendInt(this.gameId); this.response.appendInt(this.gamesLeft); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/GameCenterAchievementsConfigurationComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/GameCenterAchievementsConfigurationComposer.java index 1d7455b5..6a78ec90 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/GameCenterAchievementsConfigurationComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/GameCenterAchievementsConfigurationComposer.java @@ -5,7 +5,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class GameCenterAchievementsConfigurationComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(2265); this.response.appendInt(0); this.response.appendInt(0); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/GameCenterGameComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/GameCenterGameComposer.java index c805811d..2d28e932 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/GameCenterGameComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/GameCenterGameComposer.java @@ -17,7 +17,7 @@ public class GameCenterGameComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GameCenterGameComposer); this.response.appendInt(this.gameId); this.response.appendInt(this.status); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/GameCenterGameListComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/GameCenterGameListComposer.java index a63dd771..f8f1e25c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/GameCenterGameListComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/GameCenterGameListComposer.java @@ -7,7 +7,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class GameCenterGameListComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GameCenterGameListComposer); this.response.appendInt(2);//Count diff --git a/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/basejump/BaseJumpJoinQueueComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/basejump/BaseJumpJoinQueueComposer.java index c47d8520..6df404f1 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/basejump/BaseJumpJoinQueueComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/basejump/BaseJumpJoinQueueComposer.java @@ -12,7 +12,7 @@ public class BaseJumpJoinQueueComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.BaseJumpJoinQueueComposer); this.response.appendInt(this.gameId); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/basejump/BaseJumpLeaveQueueComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/basejump/BaseJumpLeaveQueueComposer.java index 423c85e3..11a5ea15 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/basejump/BaseJumpLeaveQueueComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/basejump/BaseJumpLeaveQueueComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class BaseJumpLeaveQueueComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.BaseJumpLeaveQueueComposer); this.response.appendInt(3); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/basejump/BaseJumpLoadGameComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/basejump/BaseJumpLoadGameComposer.java index 1a9f998d..99d4c66e 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/basejump/BaseJumpLoadGameComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/basejump/BaseJumpLoadGameComposer.java @@ -18,7 +18,7 @@ public class BaseJumpLoadGameComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.BaseJumpLoadGameComposer); if (this.game == 3) { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/basejump/BaseJumpLoadGameURLComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/basejump/BaseJumpLoadGameURLComposer.java index 15caff06..906ee305 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/basejump/BaseJumpLoadGameURLComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/basejump/BaseJumpLoadGameURLComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class BaseJumpLoadGameURLComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.BaseJumpLoadGameURLComposer); this.response.appendInt(4); this.response.appendString("1351418858673"); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/basejump/BaseJumpUnloadGameComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/basejump/BaseJumpUnloadGameComposer.java index 42b44ba2..1e2df090 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/basejump/BaseJumpUnloadGameComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/gamecenter/basejump/BaseJumpUnloadGameComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class BaseJumpUnloadGameComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.BaseJumpUnloadGameComposer); this.response.appendInt(3); this.response.appendString("basejump"); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/generic/MinimailCountComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/generic/MinimailCountComposer.java index 6245ffb6..34edf5a0 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/generic/MinimailCountComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/generic/MinimailCountComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class MinimailCountComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.MinimailCountComposer); this.response.appendInt(0); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/generic/PickMonthlyClubGiftNotificationComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/generic/PickMonthlyClubGiftNotificationComposer.java index 86b194d0..bae14e70 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/generic/PickMonthlyClubGiftNotificationComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/generic/PickMonthlyClubGiftNotificationComposer.java @@ -12,7 +12,7 @@ public class PickMonthlyClubGiftNotificationComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.PickMonthlyClubGiftNotificationComposer); this.response.appendInt(this.count); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/BotErrorComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/BotErrorComposer.java index 8eca297a..8773d9c8 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/BotErrorComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/BotErrorComposer.java @@ -18,7 +18,7 @@ public class BotErrorComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.BotErrorComposer); this.response.appendInt(this.errorCode); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/BubbleAlertComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/BubbleAlertComposer.java index 4e8cfb46..391cd6e3 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/BubbleAlertComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/BubbleAlertComposer.java @@ -28,7 +28,7 @@ public class BubbleAlertComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.BubbleAlertComposer); this.response.appendString(this.errorKey); this.response.appendInt(this.keys.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/CustomNotificationComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/CustomNotificationComposer.java index 9d68bdf4..2e1a52de 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/CustomNotificationComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/CustomNotificationComposer.java @@ -18,7 +18,7 @@ public class CustomNotificationComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.CustomNotificationComposer); this.response.appendInt(this.type); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/GenericAlertComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/GenericAlertComposer.java index 4b98c4ea..2b4d597a 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/GenericAlertComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/GenericAlertComposer.java @@ -17,7 +17,7 @@ public class GenericAlertComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GenericAlertComposer); this.response.appendString(this.message); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/GenericErrorMessagesComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/GenericErrorMessagesComposer.java index 198b1556..2674f7d0 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/GenericErrorMessagesComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/GenericErrorMessagesComposer.java @@ -19,7 +19,7 @@ public class GenericErrorMessagesComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GenericErrorMessages); this.response.appendInt(this.errorCode); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/HotelClosedAndOpensComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/HotelClosedAndOpensComposer.java index 123183eb..fc7cc923 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/HotelClosedAndOpensComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/HotelClosedAndOpensComposer.java @@ -14,7 +14,7 @@ public class HotelClosedAndOpensComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.HotelClosedAndOpensComposer); this.response.appendInt(this.hour); this.response.appendInt(this.minute); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/HotelClosesAndWillOpenAtComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/HotelClosesAndWillOpenAtComposer.java index 44c51ca9..d92497f6 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/HotelClosesAndWillOpenAtComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/HotelClosesAndWillOpenAtComposer.java @@ -16,7 +16,7 @@ public class HotelClosesAndWillOpenAtComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.HotelClosesAndWillOpenAtComposer); this.response.appendInt(this.hour); this.response.appendInt(this.minute); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/HotelWillCloseInMinutesAndBackInComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/HotelWillCloseInMinutesAndBackInComposer.java index 0c7b29b8..3e9d3ad1 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/HotelWillCloseInMinutesAndBackInComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/HotelWillCloseInMinutesAndBackInComposer.java @@ -14,7 +14,7 @@ public class HotelWillCloseInMinutesAndBackInComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.HotelWillCloseInMinutesAndBackInComposer); this.response.appendBoolean(true); this.response.appendInt(this.closeInMinutes); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/HotelWillCloseInMinutesComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/HotelWillCloseInMinutesComposer.java index 30811bec..0a4f1a94 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/HotelWillCloseInMinutesComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/HotelWillCloseInMinutesComposer.java @@ -12,7 +12,7 @@ public class HotelWillCloseInMinutesComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.HotelWillCloseInMinutesComposer); this.response.appendInt(this.minutes); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/MessagesForYouComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/MessagesForYouComposer.java index cdb7e3b7..0003c638 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/MessagesForYouComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/MessagesForYouComposer.java @@ -22,7 +22,7 @@ public class MessagesForYouComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.MessagesForYouComposer); this.response.appendInt(this.messages.length + this.newMessages.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/PetErrorComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/PetErrorComposer.java index ccffcdfe..7318ff2f 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/PetErrorComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/PetErrorComposer.java @@ -19,7 +19,7 @@ public class PetErrorComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.PetErrorComposer); this.response.appendInt(this.errorCode); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/StaffAlertAndOpenHabboWayComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/StaffAlertAndOpenHabboWayComposer.java index 438af967..687b43ec 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/StaffAlertAndOpenHabboWayComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/StaffAlertAndOpenHabboWayComposer.java @@ -12,7 +12,7 @@ public class StaffAlertAndOpenHabboWayComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.StaffAlertAndOpenHabboWayComposer); this.response.appendString(this.message); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/StaffAlertWIthLinkAndOpenHabboWayComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/StaffAlertWIthLinkAndOpenHabboWayComposer.java index 3df101ef..7a7686cc 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/StaffAlertWIthLinkAndOpenHabboWayComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/StaffAlertWIthLinkAndOpenHabboWayComposer.java @@ -14,7 +14,7 @@ public class StaffAlertWIthLinkAndOpenHabboWayComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.StaffAlertWIthLinkAndOpenHabboWayComposer); this.response.appendString(this.message); this.response.appendString(this.link); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/StaffAlertWithLinkComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/StaffAlertWithLinkComposer.java index ce52ba79..82447982 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/StaffAlertWithLinkComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/StaffAlertWithLinkComposer.java @@ -14,7 +14,7 @@ public class StaffAlertWithLinkComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.StaffAlertWithLinkComposer); this.response.appendString(this.message); this.response.appendString(this.link); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/UpdateFailedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/UpdateFailedComposer.java index 21094a88..5a0e70a1 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/UpdateFailedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/UpdateFailedComposer.java @@ -12,7 +12,7 @@ public class UpdateFailedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UpdateFailedComposer); this.response.appendString(this.message); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/generic/testcomposer.java b/src/main/java/com/eu/habbo/messages/outgoing/generic/testcomposer.java index 49caea29..74f1301c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/generic/testcomposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/generic/testcomposer.java @@ -5,7 +5,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class testcomposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(3019); this.response.appendInt(3); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guardians/GuardianNewReportReceivedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guardians/GuardianNewReportReceivedComposer.java index e5323e30..02d23875 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guardians/GuardianNewReportReceivedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guardians/GuardianNewReportReceivedComposer.java @@ -7,7 +7,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class GuardianNewReportReceivedComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuardianNewReportReceivedComposer); this.response.appendInt(Emulator.getConfig().getInt("guardians.accept.timer")); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guardians/GuardianVotingRequestedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guardians/GuardianVotingRequestedComposer.java index 9365c4d3..e4209713 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guardians/GuardianVotingRequestedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guardians/GuardianVotingRequestedComposer.java @@ -17,7 +17,7 @@ public class GuardianVotingRequestedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { TIntIntHashMap mappedUsers = new TIntIntHashMap(); mappedUsers.put(this.ticket.getReported().getHabboInfo().getId(), 0); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guardians/GuardianVotingResultComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guardians/GuardianVotingResultComposer.java index 684d0a12..a0f50fc6 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guardians/GuardianVotingResultComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guardians/GuardianVotingResultComposer.java @@ -19,7 +19,7 @@ public class GuardianVotingResultComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuardianVotingResultComposer); this.response.appendInt(this.ticket.getVerdict().getType()); //Final Verdict this.response.appendInt(this.vote.type.getType()); //Your vote diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guardians/GuardianVotingTimeEnded.java b/src/main/java/com/eu/habbo/messages/outgoing/guardians/GuardianVotingTimeEnded.java index 32527594..d210c04b 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guardians/GuardianVotingTimeEnded.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guardians/GuardianVotingTimeEnded.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class GuardianVotingTimeEnded extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuardianVotingTimeEnded); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guardians/GuardianVotingVotesComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guardians/GuardianVotingVotesComposer.java index feeea391..82138a81 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guardians/GuardianVotingVotesComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guardians/GuardianVotingVotesComposer.java @@ -19,7 +19,7 @@ public class GuardianVotingVotesComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuardianVotingVotesComposer); ArrayList votes = this.ticket.getSortedVotes(this.guardian); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guides/BullyReportClosedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guides/BullyReportClosedComposer.java index e8a048ef..f89afe9c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guides/BullyReportClosedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guides/BullyReportClosedComposer.java @@ -15,7 +15,7 @@ public class BullyReportClosedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.BullyReportClosedComposer); this.response.appendInt(this.code); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionAttachedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionAttachedComposer.java index 60ff434e..999ccc78 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionAttachedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionAttachedComposer.java @@ -16,7 +16,7 @@ public class GuideSessionAttachedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { //:test 3549 b:1 i:1 s:abcd i:100 this.response.init(Outgoing.GuideSessionAttachedComposer); this.response.appendBoolean(this.isHelper); //? //isHelper diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionDetachedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionDetachedComposer.java index 8db0a8ac..d68aa2a3 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionDetachedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionDetachedComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class GuideSessionDetachedComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuideSessionDetachedComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionEndedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionEndedComposer.java index 7ed37fdc..a08c3951 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionEndedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionEndedComposer.java @@ -15,7 +15,7 @@ public class GuideSessionEndedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuideSessionEndedComposer); this.response.appendInt(this.errorCode); //? return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionErrorComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionErrorComposer.java index 4f8da806..1776a3e4 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionErrorComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionErrorComposer.java @@ -16,7 +16,7 @@ public class GuideSessionErrorComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuideSessionErrorComposer); this.response.appendInt(this.errorCode); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionInvitedToGuideRoomComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionInvitedToGuideRoomComposer.java index d4641448..15a7fd32 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionInvitedToGuideRoomComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionInvitedToGuideRoomComposer.java @@ -14,7 +14,7 @@ public class GuideSessionInvitedToGuideRoomComposer extends MessageComposer { //Helper invites noob @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuideSessionInvitedToGuideRoomComposer); this.response.appendInt(this.room != null ? this.room.getId() : 0); this.response.appendString(this.room != null ? this.room.getName() : ""); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionMessageComposer.java index 1dc03b79..fdf74f78 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionMessageComposer.java @@ -13,7 +13,7 @@ public class GuideSessionMessageComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuideSessionMessageComposer); this.response.appendString(this.message.message); //Message this.response.appendInt(this.message.userId); //Sender ID diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionPartnerIsPlayingComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionPartnerIsPlayingComposer.java index 43ef1793..496368a7 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionPartnerIsPlayingComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionPartnerIsPlayingComposer.java @@ -12,7 +12,7 @@ public class GuideSessionPartnerIsPlayingComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuideSessionPartnerIsPlayingComposer); this.response.appendBoolean(this.isPlaying); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionPartnerIsTypingComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionPartnerIsTypingComposer.java index c587f548..3781c455 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionPartnerIsTypingComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionPartnerIsTypingComposer.java @@ -12,7 +12,7 @@ public class GuideSessionPartnerIsTypingComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuideSessionPartnerIsTypingComposer); this.response.appendBoolean(this.typing); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionRequesterRoomComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionRequesterRoomComposer.java index c0b4ead6..cd6e5b85 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionRequesterRoomComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionRequesterRoomComposer.java @@ -13,7 +13,7 @@ public class GuideSessionRequesterRoomComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuideSessionRequesterRoomComposer); this.response.appendInt(this.room != null ? this.room.getId() : 0); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionStartedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionStartedComposer.java index d0e0ae64..dd1ce315 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionStartedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideSessionStartedComposer.java @@ -13,7 +13,7 @@ public class GuideSessionStartedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuideSessionStartedComposer); this.response.appendInt(this.tour.getNoob().getHabboInfo().getId()); this.response.appendString(this.tour.getNoob().getHabboInfo().getUsername()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideToolsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideToolsComposer.java index cd4da1ff..dbcc32e7 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideToolsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guides/GuideToolsComposer.java @@ -13,7 +13,7 @@ public class GuideToolsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuideToolsComposer); this.response.appendBoolean(this.onDuty); //OnDuty this.response.appendInt(0); //Guides On Duty diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildAcceptMemberErrorComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildAcceptMemberErrorComposer.java index fdd2e4ba..460e6da8 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildAcceptMemberErrorComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildAcceptMemberErrorComposer.java @@ -18,7 +18,7 @@ public class GuildAcceptMemberErrorComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuildAcceptMemberErrorComposer); this.response.appendInt(this.guildId); this.response.appendInt(this.errorCode); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildBoughtComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildBoughtComposer.java index e8c3ed71..8c5f1ac6 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildBoughtComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildBoughtComposer.java @@ -13,7 +13,7 @@ public class GuildBoughtComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuildBoughtComposer); this.response.appendInt(this.guild.getRoomId()); this.response.appendInt(this.guild.getId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildBuyRoomsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildBuyRoomsComposer.java index fe038f26..e55f9135 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildBuyRoomsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildBuyRoomsComposer.java @@ -15,7 +15,7 @@ public class GuildBuyRoomsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuildBuyRoomsComposer); this.response.appendInt(Emulator.getConfig().getInt("catalog.guild.price")); this.response.appendInt(this.rooms.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildConfirmRemoveMemberComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildConfirmRemoveMemberComposer.java index cba6099f..798fcf3c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildConfirmRemoveMemberComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildConfirmRemoveMemberComposer.java @@ -14,7 +14,7 @@ public class GuildConfirmRemoveMemberComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuildConfirmRemoveMemberComposer); this.response.appendInt(this.userId); this.response.appendInt(this.furniCount); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildEditFailComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildEditFailComposer.java index eea708f8..17780d84 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildEditFailComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildEditFailComposer.java @@ -17,7 +17,7 @@ public class GuildEditFailComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuildEditFailComposer); this.response.appendInt(this.errorCode); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildFavoriteRoomUserUpdateComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildFavoriteRoomUserUpdateComposer.java index 118a57d7..48d9c556 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildFavoriteRoomUserUpdateComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildFavoriteRoomUserUpdateComposer.java @@ -16,7 +16,7 @@ public class GuildFavoriteRoomUserUpdateComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuildFavoriteRoomUserUpdateComposer); this.response.appendInt(this.roomUnit.getId()); this.response.appendInt(this.guild.getId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildFurniWidgetComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildFurniWidgetComposer.java index 4b75f522..e4373209 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildFurniWidgetComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildFurniWidgetComposer.java @@ -20,7 +20,7 @@ public class GuildFurniWidgetComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuildFurniWidgetComposer); this.response.appendInt(item.getId()); this.response.appendInt(this.guild.getId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildInfoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildInfoComposer.java index edfdaa08..a4d2206f 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildInfoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildInfoComposer.java @@ -26,7 +26,7 @@ public class GuildInfoComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { boolean adminPermissions = this.client.getHabbo().getHabboStats().hasGuild(this.guild.getId()) && this.client.getHabbo().hasPermission("acc_guild_admin"); this.response.init(Outgoing.GuildInfoComposer); this.response.appendInt(this.guild.getId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildJoinErrorComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildJoinErrorComposer.java index d7b12c31..00716bfb 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildJoinErrorComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildJoinErrorComposer.java @@ -20,7 +20,7 @@ public class GuildJoinErrorComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuildJoinErrorComposer); this.response.appendInt(this.code); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildListComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildListComposer.java index 7793c232..82965f0b 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildListComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildListComposer.java @@ -18,7 +18,7 @@ public class GuildListComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuildListComposer); this.response.appendInt(this.guilds.size()); for (Guild guild : this.guilds) { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildManageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildManageComposer.java index 893d4e12..7983974b 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildManageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildManageComposer.java @@ -13,7 +13,7 @@ public class GuildManageComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuildManageComposer); this.response.appendInt(1); this.response.appendInt(guild.getRoomId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildMemberUpdateComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildMemberUpdateComposer.java index f4979b51..e5a1290c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildMemberUpdateComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildMemberUpdateComposer.java @@ -16,7 +16,7 @@ public class GuildMemberUpdateComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuildMemberUpdateComposer); this.response.appendInt(this.guild.getId()); this.response.appendInt(this.guildMember.getRank().type); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildMembersComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildMembersComposer.java index 73e98a26..8bacc764 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildMembersComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildMembersComposer.java @@ -33,7 +33,7 @@ public class GuildMembersComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuildMembersComposer); this.response.appendInt(this.guild.getId()); this.response.appendString(this.guild.getName()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildPartsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildPartsComposer.java index 348bbd19..01cf5cf7 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildPartsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildPartsComposer.java @@ -8,7 +8,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class GuildPartsComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GroupPartsComposer); this.response.appendInt(Emulator.getGameEnvironment().getGuildManager().getBases().size()); for (GuildPart part : Emulator.getGameEnvironment().getGuildManager().getBases()) { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildRefreshMembersListComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildRefreshMembersListComposer.java index b66be090..4a0f124e 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildRefreshMembersListComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildRefreshMembersListComposer.java @@ -13,7 +13,7 @@ public class GuildRefreshMembersListComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuildRefreshMembersListComposer); this.response.appendInt(this.guild.getId()); this.response.appendInt(0); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/RemoveGuildFromRoomComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/RemoveGuildFromRoomComposer.java index 1d06750f..47a86dad 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/RemoveGuildFromRoomComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/RemoveGuildFromRoomComposer.java @@ -12,7 +12,7 @@ public class RemoveGuildFromRoomComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RemoveGuildFromRoomComposer); this.response.appendInt(this.guildId); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumAddCommentComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumAddCommentComposer.java index 8f267d61..3570f860 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumAddCommentComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumAddCommentComposer.java @@ -13,7 +13,7 @@ public class GuildForumAddCommentComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuildForumAddCommentComposer); this.response.appendInt(this.comment.getThread().getGuildId()); //guild_id this.response.appendInt(this.comment.getThreadId()); //thread_id diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumCommentsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumCommentsComposer.java index 688480c9..ecafc480 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumCommentsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumCommentsComposer.java @@ -21,7 +21,7 @@ public class GuildForumCommentsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuildForumCommentsComposer); this.response.appendInt(this.guildId); //guild_id diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumDataComposer.java index 3a64640a..db555561 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumDataComposer.java @@ -99,7 +99,7 @@ public class GuildForumDataComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { try { this.response.init(Outgoing.GuildForumDataComposer); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumListComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumListComposer.java index 4700bc13..ebe1d96a 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumListComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumListComposer.java @@ -24,7 +24,7 @@ public class GuildForumListComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuildForumListComposer); this.response.appendInt(this.mode); this.response.appendInt(this.guilds.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumThreadMessagesComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumThreadMessagesComposer.java index 7fff374c..c1d77bbe 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumThreadMessagesComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumThreadMessagesComposer.java @@ -13,7 +13,7 @@ public class GuildForumThreadMessagesComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuildForumThreadMessagesComposer); this.response.appendInt(this.thread.getGuildId()); this.thread.serialize(this.response); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumThreadsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumThreadsComposer.java index 1a48b688..e5750b8e 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumThreadsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumThreadsComposer.java @@ -22,7 +22,7 @@ public class GuildForumThreadsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { ArrayList threads; try { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumsUnreadMessagesCountComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumsUnreadMessagesCountComposer.java index 7adce912..e9897471 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumsUnreadMessagesCountComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumsUnreadMessagesCountComposer.java @@ -12,7 +12,7 @@ public class GuildForumsUnreadMessagesCountComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.GuildForumsUnreadMessagesCountComposer); this.response.appendInt(this.count); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/PostUpdateMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/PostUpdateMessageComposer.java index a825a44c..bdf20b7c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/PostUpdateMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/PostUpdateMessageComposer.java @@ -17,7 +17,7 @@ public class PostUpdateMessageComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.PostUpdateMessageComposer); this.response.appendInt(this.guildId); //guild_id diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/ThreadUpdatedMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/ThreadUpdatedMessageComposer.java index 4476859a..96ab2eab 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/ThreadUpdatedMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/ThreadUpdatedMessageComposer.java @@ -28,7 +28,7 @@ public class ThreadUpdatedMessageComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ThreadUpdateMessageComposer); this.response.appendInt(this.thread.getGuildId()); this.thread.serialize(this.response); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/habboway/HabboWayQuizComposer1.java b/src/main/java/com/eu/habbo/messages/outgoing/habboway/HabboWayQuizComposer1.java index e790df29..d2f73e4d 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/habboway/HabboWayQuizComposer1.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/habboway/HabboWayQuizComposer1.java @@ -14,7 +14,7 @@ public class HabboWayQuizComposer1 extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.HabboWayQuizComposer1); this.response.appendString(this.name); this.response.appendInt(this.items.length); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/habboway/HabboWayQuizComposer2.java b/src/main/java/com/eu/habbo/messages/outgoing/habboway/HabboWayQuizComposer2.java index d7af917a..dd3086e5 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/habboway/HabboWayQuizComposer2.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/habboway/HabboWayQuizComposer2.java @@ -14,7 +14,7 @@ public class HabboWayQuizComposer2 extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.HabboWayQuizComposer2); this.response.appendString(this.name); this.response.appendInt(this.items.length); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/habboway/nux/NewUserGiftComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/habboway/nux/NewUserGiftComposer.java index 3dcdb902..ec2a8b49 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/habboway/nux/NewUserGiftComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/habboway/nux/NewUserGiftComposer.java @@ -15,7 +15,7 @@ public class NewUserGiftComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.NewUserGiftComposer); this.response.appendInt(this.options.size()); for (List option : this.options) { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/habboway/nux/NewUserIdentityComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/habboway/nux/NewUserIdentityComposer.java index ab33e8c5..13c03ace 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/habboway/nux/NewUserIdentityComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/habboway/nux/NewUserIdentityComposer.java @@ -13,7 +13,7 @@ public class NewUserIdentityComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.NewUserIdentityComposer); this.response.appendInt(this.habbo.noobStatus()); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/habboway/nux/NuxAlertComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/habboway/nux/NuxAlertComposer.java index 6f77c800..02188a04 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/habboway/nux/NuxAlertComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/habboway/nux/NuxAlertComposer.java @@ -12,7 +12,7 @@ public class NuxAlertComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.NuxAlertComposer); this.response.appendString(this.link); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/handshake/CompleteDiffieHandshakeComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/handshake/CompleteDiffieHandshakeComposer.java index 96dfda3b..dc2c5fbc 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/handshake/CompleteDiffieHandshakeComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/handshake/CompleteDiffieHandshakeComposer.java @@ -19,7 +19,7 @@ public class CompleteDiffieHandshakeComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.CompleteDiffieHandshakeComposer); this.response.appendString(this.publicKey); this.response.appendBoolean(this.clientEncryption); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/handshake/ConnectionErrorComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/handshake/ConnectionErrorComposer.java index 6548dbe1..fb01eff7 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/handshake/ConnectionErrorComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/handshake/ConnectionErrorComposer.java @@ -22,7 +22,7 @@ public class ConnectionErrorComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ConnectionErrorComposer); this.response.appendInt(this.messageId); this.response.appendInt(this.errorCode); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/handshake/DebugConsoleComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/handshake/DebugConsoleComposer.java index d55249a9..4ea035af 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/handshake/DebugConsoleComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/handshake/DebugConsoleComposer.java @@ -12,7 +12,7 @@ public class DebugConsoleComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.DebugConsoleComposer); this.response.appendBoolean(this.debugging); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/handshake/InitDiffieHandshakeComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/handshake/InitDiffieHandshakeComposer.java index 2952edde..72ffdb0e 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/handshake/InitDiffieHandshakeComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/handshake/InitDiffieHandshakeComposer.java @@ -15,7 +15,7 @@ public class InitDiffieHandshakeComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.InitDiffieHandshakeComposer); this.response.appendString(this.signedPrime); this.response.appendString(this.signedGenerator); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/handshake/MachineIDComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/handshake/MachineIDComposer.java index 136ba08c..3e5736b2 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/handshake/MachineIDComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/handshake/MachineIDComposer.java @@ -13,7 +13,7 @@ public class MachineIDComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.MachineIDComposer); this.response.appendString(this.client.getMachineId()); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/handshake/PongComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/handshake/PongComposer.java index a3f793aa..c30c6afd 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/handshake/PongComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/handshake/PongComposer.java @@ -12,7 +12,7 @@ public class PongComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.PongComposer); this.response.appendInt(this.id); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/handshake/SecureLoginOKComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/handshake/SecureLoginOKComposer.java index f744fea0..03ec75fe 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/handshake/SecureLoginOKComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/handshake/SecureLoginOKComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class SecureLoginOKComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.SecureLoginOKComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/handshake/SessionRightsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/handshake/SessionRightsComposer.java index a015de24..b442e4e0 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/handshake/SessionRightsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/handshake/SessionRightsComposer.java @@ -9,7 +9,7 @@ public class SessionRightsComposer extends MessageComposer { private static final boolean unknownBooleanTwo = false; @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.SessionRightsComposer); this.response.appendBoolean(unknownBooleanOne); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/handshake/SomeConnectionComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/handshake/SomeConnectionComposer.java index 1214e126..5a1e6724 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/handshake/SomeConnectionComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/handshake/SomeConnectionComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class SomeConnectionComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.SomeConnectionComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/BonusRareComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/BonusRareComposer.java index 183a66b5..1c38778c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/BonusRareComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/BonusRareComposer.java @@ -14,7 +14,7 @@ public class BonusRareComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.BonusRareComposer); this.response.appendString(Emulator.getConfig().getValue("hotelview.promotional.reward.name", "prizetrophy_breed_gold")); //Furniture Name. Note: Image is in external_variables.txt this.response.appendInt(Emulator.getConfig().getInt("hotelview.promotional.reward.id", 0)); //Furniture ID diff --git a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HallOfFameComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HallOfFameComposer.java index 4fd87102..ef796dbd 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HallOfFameComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HallOfFameComposer.java @@ -18,7 +18,7 @@ public class HallOfFameComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.HallOfFameComposer); this.response.appendString(this.hallOfFame.getCompetitionName()); this.response.appendInt(this.hallOfFame.getWinners().size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewBadgeButtonConfigComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewBadgeButtonConfigComposer.java index 8fea5e48..501103db 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewBadgeButtonConfigComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewBadgeButtonConfigComposer.java @@ -14,7 +14,7 @@ public class HotelViewBadgeButtonConfigComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.HotelViewBadgeButtonConfigComposer); this.response.appendString(this.badge); this.response.appendBoolean(this.enabled); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewCatalogPageExpiringComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewCatalogPageExpiringComposer.java index d7078845..bc98a0c4 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewCatalogPageExpiringComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewCatalogPageExpiringComposer.java @@ -16,7 +16,7 @@ public class HotelViewCatalogPageExpiringComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.HotelViewCatalogPageExpiringComposer); this.response.appendString(this.name); this.response.appendInt(this.time); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewCommunityGoalComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewCommunityGoalComposer.java index 29d2be40..f1614f5c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewCommunityGoalComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewCommunityGoalComposer.java @@ -40,7 +40,7 @@ public class HotelViewCommunityGoalComposer extends MessageComposer { //:test 1579 b:1 i:0 i:1 i:2 i:3 i:4 i:5 s:a i:6 i:1 i:1 @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.HotelViewCommunityGoalComposer); this.response.appendBoolean(this.achieved); //Achieved? this.response.appendInt(this.personalContributionScore); //User Amount diff --git a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewComposer.java index 7fe5d3d6..26dd8cb8 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class HotelViewComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.HotelViewComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewConcurrentUsersComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewConcurrentUsersComposer.java index 78185a7a..87a90fca 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewConcurrentUsersComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewConcurrentUsersComposer.java @@ -20,7 +20,7 @@ public class HotelViewConcurrentUsersComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.HotelViewConcurrentUsersComposer); this.response.appendInt(this.state); this.response.appendInt(this.userCount); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewCustomTimerComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewCustomTimerComposer.java index 656a4b14..f31e3203 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewCustomTimerComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewCustomTimerComposer.java @@ -14,7 +14,7 @@ public class HotelViewCustomTimerComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.HotelViewCustomTimerComposer); this.response.appendString(this.name); //Send by the client. this.response.appendInt(this.seconds); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewDataComposer.java index c6ca95ce..1271d5f8 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewDataComposer.java @@ -14,7 +14,7 @@ public class HotelViewDataComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.HotelViewDataComposer); this.response.appendString(this.data); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewExpiringCatalogPageCommposer.java b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewExpiringCatalogPageCommposer.java index 7421e972..bc0b082c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewExpiringCatalogPageCommposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewExpiringCatalogPageCommposer.java @@ -15,7 +15,7 @@ public class HotelViewExpiringCatalogPageCommposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.HotelViewExpiringCatalogPageCommposer); this.response.appendString(this.page.getCaption()); this.response.appendInt(this.page.getId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewHideCommunityVoteButtonComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewHideCommunityVoteButtonComposer.java index 149568c4..6a32b5d7 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewHideCommunityVoteButtonComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewHideCommunityVoteButtonComposer.java @@ -12,7 +12,7 @@ public class HotelViewHideCommunityVoteButtonComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.HotelViewHideCommunityVoteButtonComposer); this.response.appendBoolean(this.unknownBoolean); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewNextLTDAvailableComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewNextLTDAvailableComposer.java index f4c78872..d922cebf 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewNextLTDAvailableComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewNextLTDAvailableComposer.java @@ -18,7 +18,7 @@ public class HotelViewNextLTDAvailableComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.HotelViewNextLTDAvailableComposer); this.response.appendInt(this.time); this.response.appendInt(this.pageId); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewSecondsUntilComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewSecondsUntilComposer.java index d258dc2a..91538dcc 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewSecondsUntilComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/HotelViewSecondsUntilComposer.java @@ -14,7 +14,7 @@ public class HotelViewSecondsUntilComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.HotelViewSecondsUntilComposer); this.response.appendString(this.dateString); this.response.appendInt(this.seconds); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/NewsListComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/NewsListComposer.java index 5e3a029c..bdb6e594 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/hotelview/NewsListComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/hotelview/NewsListComposer.java @@ -9,7 +9,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class NewsListComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.NewsWidgetsComposer); NewsList newsList = Emulator.getGameEnvironment().getHotelViewManager().getNewsList(); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/inventory/AddBotComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/inventory/AddBotComposer.java index 7f618642..fc64df03 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/inventory/AddBotComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/inventory/AddBotComposer.java @@ -13,7 +13,7 @@ public class AddBotComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.AddBotComposer); this.response.appendInt(this.bot.getId()); this.response.appendString(this.bot.getName()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/inventory/AddHabboItemComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/inventory/AddHabboItemComposer.java index 841f4307..266d413d 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/inventory/AddHabboItemComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/inventory/AddHabboItemComposer.java @@ -41,7 +41,7 @@ public class AddHabboItemComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.AddHabboItemComposer); if (this.ids != null) { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/inventory/AddPetComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/inventory/AddPetComposer.java index 616a5167..150d6782 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/inventory/AddPetComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/inventory/AddPetComposer.java @@ -13,7 +13,7 @@ public class AddPetComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.AddPetComposer); this.pet.serialize(this.response); this.response.appendBoolean(false); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/inventory/EffectsListAddComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/inventory/EffectsListAddComposer.java index dfb76d6b..f5187607 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/inventory/EffectsListAddComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/inventory/EffectsListAddComposer.java @@ -14,7 +14,7 @@ public class EffectsListAddComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.EffectsListAddComposer); this.response.appendInt(this.effect.effect); //Type this.response.appendInt(0); //Unknown Costume? diff --git a/src/main/java/com/eu/habbo/messages/outgoing/inventory/EffectsListEffectEnableComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/inventory/EffectsListEffectEnableComposer.java index c3408a6f..8b107b53 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/inventory/EffectsListEffectEnableComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/inventory/EffectsListEffectEnableComposer.java @@ -13,7 +13,7 @@ public class EffectsListEffectEnableComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.EffectsListEffectEnableComposer); this.response.appendInt(this.effect.effect); //Type this.response.appendInt(this.effect.duration); //Duration diff --git a/src/main/java/com/eu/habbo/messages/outgoing/inventory/EffectsListRemoveComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/inventory/EffectsListRemoveComposer.java index a142fa52..f9d8020c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/inventory/EffectsListRemoveComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/inventory/EffectsListRemoveComposer.java @@ -13,7 +13,7 @@ public class EffectsListRemoveComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.EffectsListRemoveComposer); this.response.appendInt(this.effect.effect); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryAchievementsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryAchievementsComposer.java index 0e25b703..40c66bb8 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryAchievementsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryAchievementsComposer.java @@ -11,7 +11,7 @@ import gnu.trove.procedure.TObjectProcedure; public class InventoryAchievementsComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.InventoryAchievementsComposer); synchronized (Emulator.getGameEnvironment().getAchievementManager().getAchievements()) { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryBadgesComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryBadgesComposer.java index b5fc6e45..e9dd505c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryBadgesComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryBadgesComposer.java @@ -15,7 +15,7 @@ public class InventoryBadgesComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { if (this.habbo == null) return null; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryBotsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryBotsComposer.java index a44772bf..fe3b04ef 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryBotsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryBotsComposer.java @@ -15,7 +15,7 @@ public class InventoryBotsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.InventoryBotsComposer); THashMap userBots = this.habbo.getInventory().getBotsComponent().getBots(); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryItemsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryItemsComposer.java index 6fb8a0cd..258ce1a9 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryItemsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryItemsComposer.java @@ -25,7 +25,7 @@ public class InventoryItemsComposer extends MessageComposer implements TIntObjec } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { try { this.response.init(Outgoing.InventoryItemsComposer); this.response.appendInt(this.out); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryPetsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryPetsComposer.java index 696fbad1..a0f97408 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryPetsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryPetsComposer.java @@ -17,7 +17,7 @@ public class InventoryPetsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.InventoryPetsComposer); this.response.appendInt(1); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryRefreshComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryRefreshComposer.java index 97f2c099..9bafa3dd 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryRefreshComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryRefreshComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class InventoryRefreshComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.InventoryRefreshComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryUpdateItemComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryUpdateItemComposer.java index d7971230..c558f986 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryUpdateItemComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryUpdateItemComposer.java @@ -14,7 +14,7 @@ public class InventoryUpdateItemComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.InventoryItemUpdateComposer); this.response.appendInt(this.habboItem.getGiftAdjustedId()); this.response.appendString(this.habboItem.getBaseItem().getType().code); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/inventory/RemoveBotComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/inventory/RemoveBotComposer.java index 040de015..cda6dc61 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/inventory/RemoveBotComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/inventory/RemoveBotComposer.java @@ -13,7 +13,7 @@ public class RemoveBotComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RemoveBotComposer); this.response.appendInt(this.bot.getId()); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/inventory/RemoveHabboItemComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/inventory/RemoveHabboItemComposer.java index c28bc240..c9855e9d 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/inventory/RemoveHabboItemComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/inventory/RemoveHabboItemComposer.java @@ -12,7 +12,7 @@ public class RemoveHabboItemComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RemoveHabboItemComposer); this.response.appendInt(this.itemId); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/inventory/RemovePetComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/inventory/RemovePetComposer.java index 72a6928a..af495d2e 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/inventory/RemovePetComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/inventory/RemovePetComposer.java @@ -13,7 +13,7 @@ public class RemovePetComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RemovePetComposer); this.response.appendInt(this.petId); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/inventory/UserEffectsListComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/inventory/UserEffectsListComposer.java index 2c09b324..13e42b52 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/inventory/UserEffectsListComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/inventory/UserEffectsListComposer.java @@ -20,7 +20,7 @@ public class UserEffectsListComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UserEffectsListComposer); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/BullyReportRequestComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/BullyReportRequestComposer.java index 6dea5de4..9d648542 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/BullyReportRequestComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/BullyReportRequestComposer.java @@ -19,7 +19,7 @@ public class BullyReportRequestComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.BullyReportRequestComposer); this.response.appendInt(this.errorCode); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/BullyReportedMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/BullyReportedMessageComposer.java index e77e4492..bca14d5c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/BullyReportedMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/BullyReportedMessageComposer.java @@ -18,7 +18,7 @@ public class BullyReportedMessageComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.BullyReportedMessageComposer); this.response.appendInt(this.code); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/CfhTopicsMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/CfhTopicsMessageComposer.java index 73694a4b..5a7f3eea 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/CfhTopicsMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/CfhTopicsMessageComposer.java @@ -10,7 +10,7 @@ import gnu.trove.procedure.TObjectProcedure; public class CfhTopicsMessageComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.CfhTopicsMessageComposer); this.response.appendInt(Emulator.getGameEnvironment().getModToolManager().getCfhCategories().valueCollection().size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/HelperRequestDisabledComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/HelperRequestDisabledComposer.java index aa136701..8c8a1d2b 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/HelperRequestDisabledComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/HelperRequestDisabledComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class HelperRequestDisabledComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.HelperRequestDisabledComposer); this.response.appendString(""); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolComposer.java index 0e05c84f..d534ffef 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolComposer.java @@ -22,7 +22,7 @@ public class ModToolComposer extends MessageComposer implements TObjectProcedure } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ModToolComposer); if (this.habbo.hasPermission("acc_modtool_ticket_q")) { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueChatlogComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueChatlogComposer.java index ee8b3830..fbbc23ac 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueChatlogComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueChatlogComposer.java @@ -32,7 +32,7 @@ public class ModToolIssueChatlogComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ModToolIssueChatlogComposer); this.response.appendInt(this.issue.id); this.response.appendInt(this.issue.senderId); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueHandledComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueHandledComposer.java index 5dd301c0..0cdc7ee3 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueHandledComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueHandledComposer.java @@ -23,7 +23,7 @@ public class ModToolIssueHandledComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ModToolIssueHandledComposer); this.response.appendInt(this.code); this.response.appendString(this.message); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueHandlerDimensionsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueHandlerDimensionsComposer.java index b30e5d0f..225c212a 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueHandlerDimensionsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueHandlerDimensionsComposer.java @@ -18,7 +18,7 @@ public class ModToolIssueHandlerDimensionsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ModToolIssueHandlerDimensionsComposer); this.response.appendInt(this.x); this.response.appendInt(this.y); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueInfoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueInfoComposer.java index ce57afa3..6abe7b2e 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueInfoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueInfoComposer.java @@ -13,7 +13,7 @@ public class ModToolIssueInfoComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ModToolIssueInfoComposer); this.issue.serialize(this.response); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueResponseAlertComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueResponseAlertComposer.java index 8f22f10c..3be76632 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueResponseAlertComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueResponseAlertComposer.java @@ -12,7 +12,7 @@ public class ModToolIssueResponseAlertComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ModToolIssueResponseAlertComposer); this.response.appendString(this.message); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueUpdateComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueUpdateComposer.java index 5034b424..e3756e71 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueUpdateComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolIssueUpdateComposer.java @@ -13,7 +13,7 @@ public class ModToolIssueUpdateComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ModToolIssueUpdateComposer); this.issue.serialize(this.response); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolReportReceivedAlertComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolReportReceivedAlertComposer.java index 064385b9..6f6315e8 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolReportReceivedAlertComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolReportReceivedAlertComposer.java @@ -18,7 +18,7 @@ public class ModToolReportReceivedAlertComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ModToolReportReceivedAlertComposer); this.response.appendInt(this.errorCode); this.response.appendString(this.message); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolRoomChatlogComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolRoomChatlogComposer.java index 1be09ca0..50ec9796 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolRoomChatlogComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolRoomChatlogComposer.java @@ -20,7 +20,7 @@ public class ModToolRoomChatlogComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ModToolRoomChatlogComposer); this.response.appendByte(1); this.response.appendShort(2); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolRoomInfoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolRoomInfoComposer.java index 883b058d..17303cb7 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolRoomInfoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolRoomInfoComposer.java @@ -13,7 +13,7 @@ public class ModToolRoomInfoComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ModToolRoomInfoComposer); this.response.appendInt(this.room.getId()); this.response.appendInt(this.room.getCurrentHabbos().size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolSanctionInfoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolSanctionInfoComposer.java index ca323066..e343f675 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolSanctionInfoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolSanctionInfoComposer.java @@ -24,7 +24,7 @@ public class ModToolSanctionInfoComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { ModToolSanctions modToolSanctions = Emulator.getGameEnvironment().getModToolSanctions(); Date probationEndTime; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserChatlogComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserChatlogComposer.java index 1c8c9ac9..19ed914d 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserChatlogComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserChatlogComposer.java @@ -22,7 +22,7 @@ public class ModToolUserChatlogComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ModToolUserChatlogComposer); this.response.appendInt(this.userId); this.response.appendString(this.username); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java index 36e63b84..e8ab502e 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java @@ -25,7 +25,7 @@ public class ModToolUserInfoComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ModToolUserInfoComposer); try { this.response.appendInt(this.set.getInt("user_id")); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserRoomVisitsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserRoomVisitsComposer.java index 1ccc19a3..91e4b476 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserRoomVisitsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserRoomVisitsComposer.java @@ -20,7 +20,7 @@ public class ModToolUserRoomVisitsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ModToolUserRoomVisitsComposer); this.response.appendInt(this.habboInfo.getId()); this.response.appendString(this.habboInfo.getUsername()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ReportRoomFormComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ReportRoomFormComposer.java index 63601f50..5498e45d 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ReportRoomFormComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ReportRoomFormComposer.java @@ -15,7 +15,7 @@ public class ReportRoomFormComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ReportRoomFormComposer); this.response.appendInt(this.pendingIssues.size()); //Current standing help request(s) amount: diff --git a/src/main/java/com/eu/habbo/messages/outgoing/navigator/CanCreateEventComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/navigator/CanCreateEventComposer.java index 0df277ba..61b268ca 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/navigator/CanCreateEventComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/navigator/CanCreateEventComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class CanCreateEventComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.CanCreateEventComposer); this.response.appendBoolean(true); this.response.appendInt(0); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/navigator/CanCreateRoomComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/navigator/CanCreateRoomComposer.java index 4bd0ffc0..051d651b 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/navigator/CanCreateRoomComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/navigator/CanCreateRoomComposer.java @@ -14,7 +14,7 @@ public class CanCreateRoomComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.CanCreateRoomComposer); this.response.appendInt(this.count >= this.max ? 1 : 0); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorCategoryUserCountComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorCategoryUserCountComposer.java index 311cd900..119d15f7 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorCategoryUserCountComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorCategoryUserCountComposer.java @@ -15,7 +15,7 @@ public class NewNavigatorCategoryUserCountComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.NewNavigatorCategoryUserCountComposer); this.response.appendInt(this.roomCategories.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorCollapsedCategoriesComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorCollapsedCategoriesComposer.java index c075460d..129cf75f 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorCollapsedCategoriesComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorCollapsedCategoriesComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class NewNavigatorCollapsedCategoriesComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.NewNavigatorCollapsedCategoriesComposer); this.response.appendInt(46); this.response.appendString("new_ads"); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorEventCategoriesComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorEventCategoriesComposer.java index baff726f..8537682d 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorEventCategoriesComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorEventCategoriesComposer.java @@ -12,7 +12,7 @@ public class NewNavigatorEventCategoriesComposer extends MessageComposer { public static List CATEGORIES = new ArrayList<>(); @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.NewNavigatorEventCategoriesComposer); this.response.appendInt(NewNavigatorEventCategoriesComposer.CATEGORIES.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorLiftedRoomsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorLiftedRoomsComposer.java index 63c1eff3..6a7dc062 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorLiftedRoomsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorLiftedRoomsComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class NewNavigatorLiftedRoomsComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.NewNavigatorLiftedRoomsComposer); this.response.appendInt(0); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorMetaDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorMetaDataComposer.java index ae8617f2..2f8eabac 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorMetaDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorMetaDataComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class NewNavigatorMetaDataComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.NewNavigatorMetaDataComposer); this.response.appendInt(4); this.response.appendString("official_view"); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorSavedSearchesComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorSavedSearchesComposer.java index 93845f71..2f613c69 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorSavedSearchesComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorSavedSearchesComposer.java @@ -16,7 +16,7 @@ public class NewNavigatorSavedSearchesComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.NewNavigatorSavedSearchesComposer); this.response.appendInt(this.searches.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorSearchResultsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorSearchResultsComposer.java index 83c4bcb1..0db11261 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorSearchResultsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorSearchResultsComposer.java @@ -19,7 +19,7 @@ public class NewNavigatorSearchResultsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.NewNavigatorSearchResultsComposer); this.response.appendString(this.searchCode); this.response.appendString(this.searchQuery); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorSettingsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorSettingsComposer.java index a893e5af..da4025a4 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorSettingsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/navigator/NewNavigatorSettingsComposer.java @@ -13,7 +13,7 @@ public class NewNavigatorSettingsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.NewNavigatorSettingsComposer); this.response.appendInt(this.windowSettings.x); this.response.appendInt(this.windowSettings.y); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/navigator/OpenRoomCreationWindowComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/navigator/OpenRoomCreationWindowComposer.java index ba7bc5f8..1b84ba17 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/navigator/OpenRoomCreationWindowComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/navigator/OpenRoomCreationWindowComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class OpenRoomCreationWindowComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.OpenRoomCreationWindowComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/navigator/PrivateRoomsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/navigator/PrivateRoomsComposer.java index 36a13e8c..41682c85 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/navigator/PrivateRoomsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/navigator/PrivateRoomsComposer.java @@ -19,7 +19,7 @@ public class PrivateRoomsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { try { this.response.init(Outgoing.PrivateRoomsComposer); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/navigator/RoomCategoriesComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/navigator/RoomCategoriesComposer.java index 4291d38b..93137911 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/navigator/RoomCategoriesComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/navigator/RoomCategoriesComposer.java @@ -15,7 +15,7 @@ public class RoomCategoriesComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomCategoriesComposer); this.response.appendInt(this.categories.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/navigator/RoomCreatedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/navigator/RoomCreatedComposer.java index f152f939..266b5fcf 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/navigator/RoomCreatedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/navigator/RoomCreatedComposer.java @@ -13,7 +13,7 @@ public class RoomCreatedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomCreatedComposer); this.response.appendInt(this.room.getId()); this.response.appendString(this.room.getName()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/navigator/TagsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/navigator/TagsComposer.java index ec875fbf..cc966717 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/navigator/TagsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/navigator/TagsComposer.java @@ -14,7 +14,7 @@ public class TagsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.TagsComposer); this.response.appendInt(this.tags.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/polls/PollQuestionsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/polls/PollQuestionsComposer.java index b0c39a8d..02ff9583 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/polls/PollQuestionsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/polls/PollQuestionsComposer.java @@ -14,7 +14,7 @@ public class PollQuestionsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.PollQuestionsComposer); this.response.appendInt(this.poll.id); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/polls/PollStartComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/polls/PollStartComposer.java index 5842b2e6..3486d2f6 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/polls/PollStartComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/polls/PollStartComposer.java @@ -13,7 +13,7 @@ public class PollStartComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.PollStartComposer); this.response.appendInt(this.poll.id); this.response.appendString(this.poll.title); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/polls/infobus/SimplePollAnswerComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/polls/infobus/SimplePollAnswerComposer.java index e352e07c..faee66d9 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/polls/infobus/SimplePollAnswerComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/polls/infobus/SimplePollAnswerComposer.java @@ -18,7 +18,7 @@ public class SimplePollAnswerComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.SimplePollAnswerComposer); this.response.appendInt(this.userId); this.response.appendString(this.choice); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/polls/infobus/SimplePollAnswersComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/polls/infobus/SimplePollAnswersComposer.java index a41a7172..18ab4680 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/polls/infobus/SimplePollAnswersComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/polls/infobus/SimplePollAnswersComposer.java @@ -14,7 +14,7 @@ public class SimplePollAnswersComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.SimplePollAnswersComposer); this.response.appendInt(-1); this.response.appendInt(2); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/polls/infobus/SimplePollStartComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/polls/infobus/SimplePollStartComposer.java index 2fc95000..efa720b3 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/polls/infobus/SimplePollStartComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/polls/infobus/SimplePollStartComposer.java @@ -15,7 +15,7 @@ public class SimplePollStartComposer extends MessageComposer { //:test 3047 s:a i:10 i:20 i:10000 i:1 i:1 i:3 s:abcdefghijklmnopqrstuvwxyz12345678901234? i:1 s:a s:b @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.SimplePollStartComposer); this.response.appendString(this.question); this.response.appendInt(0); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/quests/QuestCompletedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/quests/QuestCompletedComposer.java index 3f83ab2b..dddf6a81 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/quests/QuestCompletedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/quests/QuestCompletedComposer.java @@ -15,7 +15,7 @@ public class QuestCompletedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.QuestCompletedComposer); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/quests/QuestComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/quests/QuestComposer.java index c75e990c..f95a4056 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/quests/QuestComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/quests/QuestComposer.java @@ -12,7 +12,7 @@ public class QuestComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.QuestComposer); this.response.append(this.quest); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/quests/QuestExpiredComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/quests/QuestExpiredComposer.java index 8bdf6fd5..479e150f 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/quests/QuestExpiredComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/quests/QuestExpiredComposer.java @@ -12,7 +12,7 @@ public class QuestExpiredComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.QuestExpiredComposer); this.response.appendBoolean(this.expired); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/quests/QuestionInfoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/quests/QuestionInfoComposer.java index 3703c854..1aa05743 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/quests/QuestionInfoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/quests/QuestionInfoComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class QuestionInfoComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.QuestionInfoComposer); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/quests/QuestsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/quests/QuestsComposer.java index fd154fc3..60d877e3 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/quests/QuestsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/quests/QuestsComposer.java @@ -17,7 +17,7 @@ public class QuestsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.QuestsComposer); this.response.appendInt(this.quests.size()); for (Quest quest : this.quests) { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/BotForceOpenContextMenuComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/BotForceOpenContextMenuComposer.java index 50fccff8..3e7a7bf3 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/BotForceOpenContextMenuComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/BotForceOpenContextMenuComposer.java @@ -12,7 +12,7 @@ public class BotForceOpenContextMenuComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.BotForceOpenContextMenuComposer); this.response.appendInt(this.botId); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/BotSettingsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/BotSettingsComposer.java index ff53e34e..655e5a1c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/BotSettingsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/BotSettingsComposer.java @@ -15,7 +15,7 @@ public class BotSettingsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.BotSettingsComposer); this.response.appendInt(-this.bot.getId()); this.response.appendInt(this.settingId); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/DoorbellAddUserComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/DoorbellAddUserComposer.java index 9188f1fc..0f678902 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/DoorbellAddUserComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/DoorbellAddUserComposer.java @@ -12,7 +12,7 @@ public class DoorbellAddUserComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.DoorbellAddUserComposer); this.response.appendString(this.habbo); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/FavoriteRoomChangedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/FavoriteRoomChangedComposer.java index f0407a7d..af2ce192 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/FavoriteRoomChangedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/FavoriteRoomChangedComposer.java @@ -14,7 +14,7 @@ public class FavoriteRoomChangedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.FavoriteRoomChangedComposer); this.response.appendInt(this.roomId); this.response.appendBoolean(this.favorite); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/FloodCounterComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/FloodCounterComposer.java index 5f32a7a6..90f747bd 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/FloodCounterComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/FloodCounterComposer.java @@ -12,7 +12,7 @@ public class FloodCounterComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.FloodCounterComposer); this.response.appendInt(this.time); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/ForwardToRoomComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/ForwardToRoomComposer.java index 16a3f8af..7d758d26 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/ForwardToRoomComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/ForwardToRoomComposer.java @@ -12,7 +12,7 @@ public class ForwardToRoomComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ForwardToRoomComposer); this.response.appendInt(this.roomId); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/FreezeLivesComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/FreezeLivesComposer.java index 8801555e..1afbc939 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/FreezeLivesComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/FreezeLivesComposer.java @@ -13,7 +13,7 @@ public class FreezeLivesComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.FreezeLivesComposer); this.response.appendInt(this.gamePlayer.getHabbo().getHabboInfo().getId()); this.response.appendInt(this.gamePlayer.getLives()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/HideDoorbellComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/HideDoorbellComposer.java index 65dd5d38..e9a49ee7 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/HideDoorbellComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/HideDoorbellComposer.java @@ -12,7 +12,7 @@ public class HideDoorbellComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.HideDoorbellComposer); this.response.appendString(this.username); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/KnockKnockUnknownComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/KnockKnockUnknownComposer.java index 68106528..67518055 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/KnockKnockUnknownComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/KnockKnockUnknownComposer.java @@ -12,7 +12,7 @@ public class KnockKnockUnknownComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(478); //TODO Hardcoded header this.response.appendString(this.habbo.getHabboInfo().getUsername()); this.response.appendInt(this.habbo.getHabboInfo().getId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomAccessDeniedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomAccessDeniedComposer.java index 16fab654..728a23b1 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomAccessDeniedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomAccessDeniedComposer.java @@ -12,7 +12,7 @@ public class RoomAccessDeniedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomAccessDeniedComposer); this.response.appendString(this.habbo); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomAddRightsListComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomAddRightsListComposer.java index 2220e376..6829f5f8 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomAddRightsListComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomAddRightsListComposer.java @@ -17,7 +17,7 @@ public class RoomAddRightsListComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomAddRightsListComposer); this.response.appendInt(this.room.getId()); this.response.appendInt(this.userId); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomBannedUsersComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomBannedUsersComposer.java index 98482671..763e5a77 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomBannedUsersComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomBannedUsersComposer.java @@ -19,7 +19,7 @@ public class RoomBannedUsersComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { int timeStamp = Emulator.getIntUnixTimestamp(); THashSet roomBans = new THashSet<>(); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomChatSettingsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomChatSettingsComposer.java index c9f5effa..43a971a4 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomChatSettingsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomChatSettingsComposer.java @@ -13,7 +13,7 @@ public class RoomChatSettingsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomChatSettingsComposer); this.response.appendInt(this.room.getChatMode()); this.response.appendInt(this.room.getChatWeight()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomDataComposer.java index 7d3c455c..7dea5e9f 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomDataComposer.java @@ -22,7 +22,7 @@ public class RoomDataComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomDataComposer); this.response.appendBoolean(this.enterRoom); this.response.appendInt(this.room.getId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomEditSettingsErrorComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomEditSettingsErrorComposer.java index 8dd880bf..f53bef2c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomEditSettingsErrorComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomEditSettingsErrorComposer.java @@ -24,7 +24,7 @@ public class RoomEditSettingsErrorComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomEditSettingsErrorComposer); this.response.appendInt(this.roomId); this.response.appendInt(this.errorCode); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomEnterErrorComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomEnterErrorComposer.java index e4e16cff..a2ec60e7 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomEnterErrorComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomEnterErrorComposer.java @@ -29,7 +29,7 @@ public class RoomEnterErrorComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomEnterErrorComposer); this.response.appendInt(this.errorCode); this.response.appendString(this.queError); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomEntryInfoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomEntryInfoComposer.java index 77392500..be3d1185 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomEntryInfoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomEntryInfoComposer.java @@ -13,7 +13,7 @@ public class RoomEntryInfoComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomEntryInfoComposer); this.response.appendInt(this.room.getId()); this.response.appendString(this.room.getOwnerName()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomFilterWordsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomFilterWordsComposer.java index 167e0267..85b379d9 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomFilterWordsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomFilterWordsComposer.java @@ -13,7 +13,7 @@ public class RoomFilterWordsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomFilterWordsComposer); this.response.appendInt(this.room.getWordFilterWords().size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomFloorThicknessUpdatedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomFloorThicknessUpdatedComposer.java index eadff8b5..9d8c46c8 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomFloorThicknessUpdatedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomFloorThicknessUpdatedComposer.java @@ -13,7 +13,7 @@ public class RoomFloorThicknessUpdatedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomFloorThicknessUpdatedComposer); this.response.appendBoolean(this.room.isHideWall()); //Hide walls? this.response.appendInt(this.room.getFloorSize()); //Floor Thickness diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomHeightMapComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomHeightMapComposer.java index ca879d5e..bfe4220d 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomHeightMapComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomHeightMapComposer.java @@ -13,7 +13,7 @@ public class RoomHeightMapComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomHeightMapComposer); this.response.appendBoolean(true); this.response.appendInt(this.room.getWallHeight()); //FixedWallsHeight diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomModelComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomModelComposer.java index eb4526fe..d845f545 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomModelComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomModelComposer.java @@ -13,7 +13,7 @@ public class RoomModelComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomModelComposer); this.response.appendString(this.room.getLayout().getName()); this.response.appendInt(this.room.getId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomMutedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomMutedComposer.java index 0166cfed..7e038cc8 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomMutedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomMutedComposer.java @@ -13,7 +13,7 @@ public class RoomMutedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomMutedComposer); this.response.appendBoolean(this.room.isMuted()); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomNoRightsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomNoRightsComposer.java index 49cd1543..6f4fc613 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomNoRightsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomNoRightsComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class RoomNoRightsComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomNoRightsComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomOpenComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomOpenComposer.java index 10141d45..b695c747 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomOpenComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomOpenComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class RoomOpenComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomOpenComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomOwnerComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomOwnerComposer.java index b1d1976e..ccdc6316 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomOwnerComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomOwnerComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class RoomOwnerComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomOwnerComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomPaintComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomPaintComposer.java index 72f7b741..6961fa62 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomPaintComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomPaintComposer.java @@ -14,7 +14,7 @@ public class RoomPaintComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomPaintComposer); this.response.appendString(this.type); this.response.appendString(this.value); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomPaneComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomPaneComposer.java index 3d0e6810..db8e3929 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomPaneComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomPaneComposer.java @@ -15,7 +15,7 @@ public class RoomPaneComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomPaneComposer); this.response.appendInt(this.room.getId()); this.response.appendBoolean(this.roomOwner); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomQueueStatusMessage.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomQueueStatusMessage.java index 7257b7ad..4425c29d 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomQueueStatusMessage.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomQueueStatusMessage.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class RoomQueueStatusMessage extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomQueueStatusMessage); this.response.appendInt(1); //Count { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomRelativeMapComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomRelativeMapComposer.java index c500b5b2..1b31cb35 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomRelativeMapComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomRelativeMapComposer.java @@ -14,7 +14,7 @@ public class RoomRelativeMapComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomRelativeMapComposer); this.response.appendInt(this.room.getLayout().getMapSize() / this.room.getLayout().getMapSizeY()); this.response.appendInt(this.room.getLayout().getMapSize()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomRemoveRightsListComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomRemoveRightsListComposer.java index 3b4e7d4f..cf12bdec 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomRemoveRightsListComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomRemoveRightsListComposer.java @@ -16,7 +16,7 @@ public class RoomRemoveRightsListComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomRemoveRightsListComposer); this.response.appendInt(this.room.getId()); this.response.appendInt(this.userId); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomRightsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomRightsComposer.java index f24039f8..23e5e4cc 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomRightsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomRightsComposer.java @@ -13,7 +13,7 @@ public class RoomRightsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomRightsComposer); this.response.appendInt(this.type.level); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomRightsListComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomRightsListComposer.java index 531eafa0..7a08a9d4 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomRightsListComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomRightsListComposer.java @@ -16,7 +16,7 @@ public class RoomRightsListComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomRightsListComposer); this.response.appendInt(this.room.getId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomScoreComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomScoreComposer.java index c48b5197..e3e7eb7d 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomScoreComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomScoreComposer.java @@ -14,7 +14,7 @@ public class RoomScoreComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomScoreComposer); this.response.appendInt(this.score); this.response.appendBoolean(this.canVote); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomSettingsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomSettingsComposer.java index d0b55acf..f37dce64 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomSettingsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomSettingsComposer.java @@ -13,7 +13,7 @@ public class RoomSettingsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomSettingsComposer); this.response.appendInt(this.room.getId()); this.response.appendString(this.room.getName()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomSettingsSavedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomSettingsSavedComposer.java index d1e17aea..b6c6ac42 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomSettingsSavedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomSettingsSavedComposer.java @@ -13,7 +13,7 @@ public class RoomSettingsSavedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomSettingsSavedComposer); this.response.appendInt(this.room.getId()); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomSettingsUpdatedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomSettingsUpdatedComposer.java index 9dc3bd9c..7e1041b6 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomSettingsUpdatedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomSettingsUpdatedComposer.java @@ -13,7 +13,7 @@ public class RoomSettingsUpdatedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomSettingsUpdatedComposer); this.response.appendInt(this.room.getId()); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomThicknessComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomThicknessComposer.java index 8225a28a..9a1c9ea0 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomThicknessComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomThicknessComposer.java @@ -13,7 +13,7 @@ public class RoomThicknessComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomThicknessComposer); this.response.appendBoolean(this.room.isHideWall()); this.response.appendInt(this.room.getWallSize()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/UpdateStackHeightComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/UpdateStackHeightComposer.java index b01a6369..334581c6 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/UpdateStackHeightComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/UpdateStackHeightComposer.java @@ -27,7 +27,7 @@ public class UpdateStackHeightComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { //TODO: maybe do this another way? doesn't seem to be very clean but gets the job done this.response.init(Outgoing.UpdateStackHeightComposer); if (this.updateTiles != null) { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/AddFloorItemComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/AddFloorItemComposer.java index b1ca2d01..b27e75d9 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/AddFloorItemComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/AddFloorItemComposer.java @@ -17,7 +17,7 @@ public class AddFloorItemComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.AddFloorItemComposer); this.item.serializeFloorData(this.response); this.response.appendInt(this.item instanceof InteractionGift ? ((((InteractionGift) this.item).getColorId() * 1000) + ((InteractionGift) this.item).getRibbonId()) : (this.item instanceof InteractionMusicDisc ? ((InteractionMusicDisc) this.item).getSongId() : 1)); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/AddWallItemComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/AddWallItemComposer.java index e026993e..300eec19 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/AddWallItemComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/AddWallItemComposer.java @@ -15,7 +15,7 @@ public class AddWallItemComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.AddWallItemComposer); this.item.serializeWallData(this.response); this.response.appendString(this.itemOwnerName); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/FloorItemOnRollerComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/FloorItemOnRollerComposer.java index 9b867a23..abf2eee4 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/FloorItemOnRollerComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/FloorItemOnRollerComposer.java @@ -25,7 +25,7 @@ public class FloorItemOnRollerComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { short oldX = this.item.getX(); short oldY = this.item.getY(); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/FloorItemUpdateComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/FloorItemUpdateComposer.java index 9e611ef4..df9cf6f2 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/FloorItemUpdateComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/FloorItemUpdateComposer.java @@ -15,7 +15,7 @@ public class FloorItemUpdateComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.FloorItemUpdateComposer); this.item.serializeFloorData(this.response); this.response.appendInt(this.item instanceof InteractionGift ? ((((InteractionGift) this.item).getColorId() * 1000) + ((InteractionGift) this.item).getRibbonId()) : (this.item instanceof InteractionMusicDisc ? ((InteractionMusicDisc) this.item).getSongId() : item.isUsable() ? 0 : 0)); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemExtraDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemExtraDataComposer.java index 8474dc57..1fe1ebfc 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemExtraDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemExtraDataComposer.java @@ -13,7 +13,7 @@ public class ItemExtraDataComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ItemExtraDataComposer); this.response.appendString(this.item.getId() + ""); this.item.serializeExtradata(this.response); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemIntStateComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemIntStateComposer.java index 7ed2f844..af739f27 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemIntStateComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemIntStateComposer.java @@ -14,7 +14,7 @@ public class ItemIntStateComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ItemStateComposer2); this.response.appendInt(this.id); this.response.appendInt(this.value); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemStateComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemStateComposer.java index eed094b1..792b96a3 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemStateComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemStateComposer.java @@ -13,7 +13,7 @@ public class ItemStateComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ItemStateComposer); this.response.appendInt(this.item.getId()); try { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemsDataUpdateComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemsDataUpdateComposer.java index 0dddc403..3e5fb517 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemsDataUpdateComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemsDataUpdateComposer.java @@ -16,7 +16,7 @@ public class ItemsDataUpdateComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ItemsDataUpdateComposer); this.response.appendInt(this.items.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/MoodLightDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/MoodLightDataComposer.java index 9306b6f9..45c934cc 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/MoodLightDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/MoodLightDataComposer.java @@ -14,7 +14,7 @@ public class MoodLightDataComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.MoodLightDataComposer); this.response.appendInt(3); //PresetCount diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/PostItDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/PostItDataComposer.java index f281234c..497317af 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/PostItDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/PostItDataComposer.java @@ -13,7 +13,7 @@ public class PostItDataComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { if (this.postIt.getExtradata().isEmpty() || this.postIt.getExtradata().length() < 6) { this.postIt.setExtradata("FFFF33"); } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/PostItStickyPoleOpenComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/PostItStickyPoleOpenComposer.java index 89490e5b..e4151744 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/PostItStickyPoleOpenComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/PostItStickyPoleOpenComposer.java @@ -13,7 +13,7 @@ public class PostItStickyPoleOpenComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.PostItStickyPoleOpenComposer); this.response.appendInt(this.item == null ? -1234 : this.item.getId()); this.response.appendString(""); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/PresentItemOpenedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/PresentItemOpenedComposer.java index e5df5b8d..fea440e1 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/PresentItemOpenedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/PresentItemOpenedComposer.java @@ -17,7 +17,7 @@ public class PresentItemOpenedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.PresentItemOpenedComposer); this.response.appendString(this.item.getBaseItem().getType().code.toLowerCase()); this.response.appendInt(this.item.getBaseItem().getSpriteId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RemoveFloorItemComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RemoveFloorItemComposer.java index 689a1db7..9050674c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RemoveFloorItemComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RemoveFloorItemComposer.java @@ -20,7 +20,7 @@ public class RemoveFloorItemComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RemoveFloorItemComposer); this.response.appendString(this.item.getId() + ""); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RemoveWallItemComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RemoveWallItemComposer.java index a5f73fa9..eb926801 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RemoveWallItemComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RemoveWallItemComposer.java @@ -13,7 +13,7 @@ public class RemoveWallItemComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RemoveWallItemComposer); this.response.appendString(this.item.getId() + ""); this.response.appendInt(this.item.getUserId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RoomFloorItemsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RoomFloorItemsComposer.java index 69fd12f2..35210fa2 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RoomFloorItemsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RoomFloorItemsComposer.java @@ -22,7 +22,7 @@ public class RoomFloorItemsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomFloorItemsComposer); TIntObjectIterator iterator = this.furniOwnerNames.iterator(); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RoomWallItemsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RoomWallItemsComposer.java index f20f8a39..0f8a6696 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RoomWallItemsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RoomWallItemsComposer.java @@ -21,7 +21,7 @@ public class RoomWallItemsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomWallItemsComposer); THashMap userNames = new THashMap<>(); TIntObjectMap furniOwnerNames = this.room.getFurniOwnerNames(); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/UpdateStackHeightTileHeightComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/UpdateStackHeightTileHeightComposer.java index 85163e3f..2b378c95 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/UpdateStackHeightTileHeightComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/UpdateStackHeightTileHeightComposer.java @@ -16,7 +16,7 @@ public class UpdateStackHeightTileHeightComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UpdateStackHeightTileHeightComposer); this.response.appendInt(this.item.getId()); this.response.appendInt(this.height); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/WallItemUpdateComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/WallItemUpdateComposer.java index 06378799..2a009599 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/WallItemUpdateComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/WallItemUpdateComposer.java @@ -13,7 +13,7 @@ public class WallItemUpdateComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.WallItemUpdateComposer); this.item.serializeWallData(this.response); this.response.appendString(this.item.getUserId() + ""); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxMySongsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxMySongsComposer.java index ecb18c5b..e9a61572 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxMySongsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxMySongsComposer.java @@ -16,7 +16,7 @@ public class JukeBoxMySongsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.JukeBoxMySongsComposer); this.response.appendInt(this.items.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxNowPlayingMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxNowPlayingMessageComposer.java index feb27aee..9e8f0c64 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxNowPlayingMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxNowPlayingMessageComposer.java @@ -17,7 +17,7 @@ public class JukeBoxNowPlayingMessageComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.JukeBoxNowPlayingMessageComposer); if (this.track != null) { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxPlayListAddSongComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxPlayListAddSongComposer.java index 2b47a767..ec65f396 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxPlayListAddSongComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxPlayListAddSongComposer.java @@ -13,7 +13,7 @@ public class JukeBoxPlayListAddSongComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.JukeBoxPlayListAddSongComposer); this.response.appendInt(this.track.getId()); this.response.appendInt(this.track.getLength() * 1000); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxPlayListComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxPlayListComposer.java index 770ebf47..29c82b72 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxPlayListComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxPlayListComposer.java @@ -17,7 +17,7 @@ public class JukeBoxPlayListComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.JukeBoxPlayListComposer); this.response.appendInt(this.totalLength); //Dunno //TODO Total play length? this.response.appendInt(this.songs.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxPlayListUpdatedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxPlayListUpdatedComposer.java index ec12fcac..c4a0ceb4 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxPlayListUpdatedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxPlayListUpdatedComposer.java @@ -14,7 +14,7 @@ public class JukeBoxPlayListUpdatedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.JukeBoxPlayListUpdatedComposer); int length = 0; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxPlaylistFullComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxPlaylistFullComposer.java index 2f558194..18511105 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxPlaylistFullComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxPlaylistFullComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class JukeBoxPlaylistFullComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.JukeBoxPlaylistFullComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxTrackCodeComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxTrackCodeComposer.java index e72738d6..3759c337 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxTrackCodeComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxTrackCodeComposer.java @@ -13,7 +13,7 @@ public class JukeBoxTrackCodeComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.JukeBoxTrackCodeComposer); this.response.appendString(this.track.getCode()); this.response.appendInt(this.track.getId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxTrackDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxTrackDataComposer.java index 989b412f..77fbb08e 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxTrackDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/jukebox/JukeBoxTrackDataComposer.java @@ -15,7 +15,7 @@ public class JukeBoxTrackDataComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.JukeBoxTrackDataComposer); this.response.appendInt(this.tracks.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/lovelock/LoveLockFurniFinishedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/lovelock/LoveLockFurniFinishedComposer.java index 98a1fe74..ddeb2ff1 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/lovelock/LoveLockFurniFinishedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/lovelock/LoveLockFurniFinishedComposer.java @@ -13,7 +13,7 @@ public class LoveLockFurniFinishedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.LoveLockFurniFinishedComposer); this.response.appendInt(this.loveLock.getId()); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/lovelock/LoveLockFurniFriendConfirmedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/lovelock/LoveLockFurniFriendConfirmedComposer.java index c0e2b8ae..660fbe95 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/lovelock/LoveLockFurniFriendConfirmedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/lovelock/LoveLockFurniFriendConfirmedComposer.java @@ -13,7 +13,7 @@ public class LoveLockFurniFriendConfirmedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.LoveLockFurniFriendConfirmedComposer); this.response.appendInt(this.loveLock.getId()); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/lovelock/LoveLockFurniStartComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/lovelock/LoveLockFurniStartComposer.java index c20d72e0..20cb7c90 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/lovelock/LoveLockFurniStartComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/lovelock/LoveLockFurniStartComposer.java @@ -13,7 +13,7 @@ public class LoveLockFurniStartComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.LoveLockFurniStartComposer); this.response.appendInt(this.loveLock.getId()); this.response.appendBoolean(true); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/rentablespaces/RentableSpaceInfoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/rentablespaces/RentableSpaceInfoComposer.java index 4287a9fb..cbefc155 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/rentablespaces/RentableSpaceInfoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/rentablespaces/RentableSpaceInfoComposer.java @@ -38,7 +38,7 @@ public class RentableSpaceInfoComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { if (!(this.item instanceof InteractionRentableSpace)) return null; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/rentablespaces/RentableSpaceUnknown2Composer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/rentablespaces/RentableSpaceUnknown2Composer.java index 01d43170..81ce6b29 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/rentablespaces/RentableSpaceUnknown2Composer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/rentablespaces/RentableSpaceUnknown2Composer.java @@ -12,7 +12,7 @@ public class RentableSpaceUnknown2Composer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RentableSpaceUnknown2Composer); this.response.appendInt(this.itemId); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/rentablespaces/RentableSpaceUnknownComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/rentablespaces/RentableSpaceUnknownComposer.java index d8a69db3..af042c18 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/rentablespaces/RentableSpaceUnknownComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/rentablespaces/RentableSpaceUnknownComposer.java @@ -12,7 +12,7 @@ public class RentableSpaceUnknownComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RentableSpaceUnknownComposer); this.response.appendInt(this.itemId); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/youtube/YoutubeDisplayListComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/youtube/YoutubeDisplayListComposer.java index 9cab7508..11c6773c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/youtube/YoutubeDisplayListComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/youtube/YoutubeDisplayListComposer.java @@ -19,7 +19,7 @@ public class YoutubeDisplayListComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.YoutubeDisplayListComposer); this.response.appendInt(this.itemId); this.response.appendInt(this.playlists.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/youtube/YoutubeStateChangeComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/youtube/YoutubeStateChangeComposer.java index 1014715e..762a5021 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/youtube/YoutubeStateChangeComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/youtube/YoutubeStateChangeComposer.java @@ -14,7 +14,7 @@ public class YoutubeStateChangeComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.YoutubeMessageComposer3); this.response.appendInt(this.furniId); this.response.appendInt(this.state); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/youtube/YoutubeVideoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/youtube/YoutubeVideoComposer.java index 62a56781..225220e1 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/youtube/YoutubeVideoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/youtube/YoutubeVideoComposer.java @@ -19,7 +19,7 @@ public class YoutubeVideoComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.YoutubeMessageComposer2); this.response.appendInt(this.itemId); this.response.appendString(this.video.getId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/CantScratchPetNotOldEnoughComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/CantScratchPetNotOldEnoughComposer.java index 8d3059e9..b3e33e30 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/CantScratchPetNotOldEnoughComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/CantScratchPetNotOldEnoughComposer.java @@ -14,7 +14,7 @@ public class CantScratchPetNotOldEnoughComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.CantScratchPetNotOldEnoughComposer); this.response.appendInt(this.currentAge); this.response.appendInt(this.requiredAge); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetInformationComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetInformationComposer.java index cdef5e5b..06a05b4a 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetInformationComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetInformationComposer.java @@ -23,7 +23,7 @@ public class PetInformationComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { double days = Math.floor((Emulator.getIntUnixTimestamp() - this.pet.getCreated()) / (3600 * 24)); this.response.init(Outgoing.PetInformationComposer); this.response.appendInt(this.pet.getId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetLevelUpComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetLevelUpComposer.java index 03c44e51..f3bf2bf9 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetLevelUpComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetLevelUpComposer.java @@ -13,7 +13,7 @@ public class PetLevelUpComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.PetLevelUpComposer); this.response.appendInt(this.pet.getId()); this.response.appendString(this.pet.getName()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetLevelUpdatedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetLevelUpdatedComposer.java index 72810ce9..46f76ae0 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetLevelUpdatedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetLevelUpdatedComposer.java @@ -13,7 +13,7 @@ public class PetLevelUpdatedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.PetLevelUpdatedComposer); this.response.appendInt(this.pet.getRoomUnit().getId()); this.response.appendInt(this.pet.getId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetPackageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetPackageComposer.java index cb1eff93..70f8d918 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetPackageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetPackageComposer.java @@ -13,7 +13,7 @@ public class PetPackageComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.LeprechaunStarterBundleComposer); this.response.appendInt(this.item.getId()); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetPackageNameValidationComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetPackageNameValidationComposer.java index a3e8e277..9d99ade4 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetPackageNameValidationComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetPackageNameValidationComposer.java @@ -22,7 +22,7 @@ public class PetPackageNameValidationComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.PetPackageNameValidationComposer); this.response.appendInt(this.itemId); this.response.appendInt(this.errorCode); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetStatusUpdateComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetStatusUpdateComposer.java index 4c21820d..37549fe6 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetStatusUpdateComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetStatusUpdateComposer.java @@ -15,7 +15,7 @@ public class PetStatusUpdateComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.PetStatusUpdateComposer); this.response.appendInt(this.pet.getRoomUnit().getId()); this.response.appendInt(this.pet instanceof RideablePet && ((RideablePet) this.pet).anyoneCanRide() ? 1 : 0); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetTrainingPanelComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetTrainingPanelComposer.java index 184cd32e..f9254269 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetTrainingPanelComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetTrainingPanelComposer.java @@ -18,7 +18,7 @@ public class PetTrainingPanelComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { List enabled = new ArrayList<>(); Collections.sort(this.pet.getPetData().getPetCommands()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/RoomPetComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/RoomPetComposer.java index d8ecdf1e..c515a694 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/RoomPetComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/RoomPetComposer.java @@ -21,7 +21,7 @@ public class RoomPetComposer extends MessageComposer implements TIntObjectProced } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUsersComposer); this.response.appendInt(this.pets.size()); this.pets.forEachEntry(this); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/RoomPetExperienceComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/RoomPetExperienceComposer.java index dab4bf05..60983021 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/RoomPetExperienceComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/RoomPetExperienceComposer.java @@ -15,7 +15,7 @@ public class RoomPetExperienceComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomPetExperienceComposer); this.response.appendInt(this.pet.getId()); this.response.appendInt(this.pet.getRoomUnit().getId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/RoomPetHorseFigureComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/RoomPetHorseFigureComposer.java index 09495a3c..e8f066f7 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/RoomPetHorseFigureComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/RoomPetHorseFigureComposer.java @@ -13,7 +13,7 @@ public class RoomPetHorseFigureComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomPetHorseFigureComposer); this.response.appendInt(this.pet.getRoomUnit().getId()); this.response.appendInt(this.pet.getId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/RoomPetRespectComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/RoomPetRespectComposer.java index 0ef38a0c..59f939ed 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/RoomPetRespectComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/RoomPetRespectComposer.java @@ -23,7 +23,7 @@ public class RoomPetRespectComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomPetRespectComposer); this.response.appendInt(this.type); this.response.appendInt(100); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingCompleted.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingCompleted.java index 8dece8c9..2cd37d06 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingCompleted.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingCompleted.java @@ -14,7 +14,7 @@ public class PetBreedingCompleted extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.PetBreedingCompleted); this.response.appendInt(this.type); this.response.appendInt(this.race); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingFailedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingFailedComposer.java index 556b1f8c..b39a16a0 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingFailedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingFailedComposer.java @@ -14,7 +14,7 @@ public class PetBreedingFailedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.PetBreedingFailedComposer); this.response.appendInt(this.anInt1); this.response.appendInt(this.anInt2); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingResultComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingResultComposer.java index 42145b6a..035e83c3 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingResultComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingResultComposer.java @@ -27,7 +27,7 @@ public class PetBreedingResultComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.PetBreedingResultComposer); this.response.appendInt(this.boxId); this.petOne.serialize(this.response); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingStartComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingStartComposer.java index da164f26..55647113 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingStartComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingStartComposer.java @@ -17,7 +17,7 @@ public class PetBreedingStartComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.PetBreedingStartComposer); this.response.appendInt(this.state); this.response.appendInt(this.anInt1); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingStartFailedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingStartFailedComposer.java index 2df336c9..6f1e51ce 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingStartFailedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingStartFailedComposer.java @@ -20,7 +20,7 @@ public class PetBreedingStartFailedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.PetBreedingStartFailedComposer); this.response.appendInt(this.reason); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/promotions/PromoteOwnRoomsListComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/promotions/PromoteOwnRoomsListComposer.java index 45e42070..f791a26d 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/promotions/PromoteOwnRoomsListComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/promotions/PromoteOwnRoomsListComposer.java @@ -19,7 +19,7 @@ public class PromoteOwnRoomsListComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.PromoteOwnRoomsListComposer); this.response.appendBoolean(true); this.response.appendInt(this.rooms.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/promotions/RoomPromotionMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/promotions/RoomPromotionMessageComposer.java index 12403e90..6167e61c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/promotions/RoomPromotionMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/promotions/RoomPromotionMessageComposer.java @@ -17,7 +17,7 @@ public class RoomPromotionMessageComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomEventMessageComposer); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/ChangeNameUpdatedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/ChangeNameUpdatedComposer.java index 7713461f..cb72a29c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/ChangeNameUpdatedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/ChangeNameUpdatedComposer.java @@ -13,7 +13,7 @@ public class ChangeNameUpdatedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ChangeNameUpdateComposer); this.response.appendInt(0); this.response.appendString(this.habbo.getHabboInfo().getUsername()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUnitIdleComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUnitIdleComposer.java index 3c947c5b..9a018261 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUnitIdleComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUnitIdleComposer.java @@ -13,7 +13,7 @@ public class RoomUnitIdleComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUnitIdleComposer); this.response.appendInt(this.roomUnit.getId()); this.response.appendBoolean(this.roomUnit.isIdle()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUnitOnRollerComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUnitOnRollerComposer.java index f77d520c..856e7a69 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUnitOnRollerComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUnitOnRollerComposer.java @@ -40,7 +40,7 @@ public class RoomUnitOnRollerComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { if (!this.room.isLoaded()) return null; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserActionComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserActionComposer.java index 88acc03d..ec54fda0 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserActionComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserActionComposer.java @@ -16,7 +16,7 @@ public class RoomUserActionComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUserActionComposer); this.response.appendInt(this.roomUnit.getId()); this.response.appendInt(this.action.getAction()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserDanceComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserDanceComposer.java index 1487658c..f0900df7 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserDanceComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserDanceComposer.java @@ -13,7 +13,7 @@ public class RoomUserDanceComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUserDanceComposer); this.response.appendInt(this.roomUnit.getId()); this.response.appendInt(this.roomUnit.getDanceType().getType()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserDataComposer.java index 87b3c2f2..322a7ac7 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserDataComposer.java @@ -13,7 +13,7 @@ public class RoomUserDataComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUserDataComposer); this.response.appendInt(this.habbo.getRoomUnit() == null ? -1 : this.habbo.getRoomUnit().getId()); this.response.appendString(this.habbo.getHabboInfo().getLook()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserEffectComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserEffectComposer.java index fc0a5641..8053b35e 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserEffectComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserEffectComposer.java @@ -20,7 +20,7 @@ public class RoomUserEffectComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUserEffectComposer); this.response.appendInt(this.roomUnit.getId()); this.response.appendInt(this.effectId == -1 ? this.roomUnit.getEffectId() : this.effectId); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserHandItemComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserHandItemComposer.java index 4a953730..2c74c8f2 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserHandItemComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserHandItemComposer.java @@ -13,7 +13,7 @@ public class RoomUserHandItemComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUserHandItemComposer); this.response.appendInt(this.roomUnit.getId()); this.response.appendInt(this.roomUnit.getHandItem()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserIgnoredComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserIgnoredComposer.java index e88a953b..51f7482b 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserIgnoredComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserIgnoredComposer.java @@ -19,7 +19,7 @@ public class RoomUserIgnoredComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUserIgnoredComposer); this.response.appendInt(this.state); this.response.appendString(this.habbo.getHabboInfo().getUsername()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserNameChangedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserNameChangedComposer.java index f62b4d2e..3e43c471 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserNameChangedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserNameChangedComposer.java @@ -29,7 +29,7 @@ public class RoomUserNameChangedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUserNameChangedComposer); this.response.appendInt(this.userId); this.response.appendInt(this.roomId); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserReceivedHandItemComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserReceivedHandItemComposer.java index 65a10440..121ca4ea 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserReceivedHandItemComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserReceivedHandItemComposer.java @@ -15,7 +15,7 @@ public class RoomUserReceivedHandItemComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUserReceivedHandItemComposer); this.response.appendInt(this.from.getId()); this.response.appendInt(this.handItem); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserRemoveComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserRemoveComposer.java index d270b294..9981b5b9 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserRemoveComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserRemoveComposer.java @@ -13,7 +13,7 @@ public class RoomUserRemoveComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUserRemoveComposer); this.response.appendString(this.roomUnit.getId() + ""); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserRemoveRightsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserRemoveRightsComposer.java index c942df8d..ccf56264 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserRemoveRightsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserRemoveRightsComposer.java @@ -15,7 +15,7 @@ public class RoomUserRemoveRightsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUserRemoveRightsComposer); this.response.appendInt(this.room.getId()); this.response.appendInt(this.habboId); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserRespectComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserRespectComposer.java index 850d4a50..4e807eef 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserRespectComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserRespectComposer.java @@ -13,7 +13,7 @@ public class RoomUserRespectComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUserRespectComposer); this.response.appendInt(this.habbo.getHabboInfo().getId()); this.response.appendInt(this.habbo.getHabboStats().respectPointsReceived); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserShoutComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserShoutComposer.java index b50a2cc8..6c8945bf 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserShoutComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserShoutComposer.java @@ -13,7 +13,7 @@ public class RoomUserShoutComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { if (this.roomChatMessage.getMessage().isEmpty()) return null; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserStatusComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserStatusComposer.java index 28f89597..4aedd6bb 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserStatusComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserStatusComposer.java @@ -35,7 +35,7 @@ public class RoomUserStatusComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUserStatusComposer); if (this.roomUnits != null) { this.response.appendInt(this.roomUnits.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserTagsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserTagsComposer.java index 5951c759..a612e9e8 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserTagsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserTagsComposer.java @@ -13,7 +13,7 @@ public class RoomUserTagsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUserTagsComposer); this.response.appendInt(this.habbo.getRoomUnit().getId()); this.response.appendInt(this.habbo.getHabboStats().tags.length); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserTalkComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserTalkComposer.java index a2bdce88..6af2fdb7 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserTalkComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserTalkComposer.java @@ -13,7 +13,7 @@ public class RoomUserTalkComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUserTalkComposer); if (this.roomChatMessage.getMessage().isEmpty()) diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserTypingComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserTypingComposer.java index f725735e..b4126838 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserTypingComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserTypingComposer.java @@ -15,7 +15,7 @@ public class RoomUserTypingComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUserTypingComposer); this.response.appendInt(this.roomUnit.getId()); this.response.appendInt(this.typing ? 1 : 0); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserUnbannedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserUnbannedComposer.java index 8040e40d..8390e131 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserUnbannedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserUnbannedComposer.java @@ -15,7 +15,7 @@ public class RoomUserUnbannedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUserUnbannedComposer); this.response.appendInt(this.room.getId()); this.response.appendInt(this.userId); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserWhisperComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserWhisperComposer.java index f96e659e..10f8800c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserWhisperComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserWhisperComposer.java @@ -13,7 +13,7 @@ public class RoomUserWhisperComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { if (this.roomChatMessage.getMessage().isEmpty()) return null; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUsersAddGuildBadgeComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUsersAddGuildBadgeComposer.java index 4f95b2db..b8340394 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUsersAddGuildBadgeComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUsersAddGuildBadgeComposer.java @@ -13,7 +13,7 @@ public class RoomUsersAddGuildBadgeComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUsersGuildBadgesComposer); this.response.appendInt(1); this.response.appendInt(this.guild.getId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUsersComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUsersComposer.java index 3fbfba97..4b53f9c6 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUsersComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUsersComposer.java @@ -33,7 +33,7 @@ public class RoomUsersComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUsersComposer); if (this.habbo != null) { this.response.appendInt(1); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUsersGuildBadgesComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUsersGuildBadgesComposer.java index b8e2e46f..babb2980 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUsersGuildBadgesComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUsersGuildBadgesComposer.java @@ -14,7 +14,7 @@ public class RoomUsersGuildBadgesComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUsersGuildBadgesComposer); this.response.appendInt(this.guildBadges.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/trading/OtherTradingDisabledComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/trading/OtherTradingDisabledComposer.java index 956edcde..90c23159 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/trading/OtherTradingDisabledComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/trading/OtherTradingDisabledComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class OtherTradingDisabledComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.OtherTradingDisabledComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeAcceptedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeAcceptedComposer.java index c453cc16..e6f10f66 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeAcceptedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeAcceptedComposer.java @@ -13,7 +13,7 @@ public class TradeAcceptedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.TradeAcceptedComposer); this.response.appendInt(this.tradeUser.getUserId()); this.response.appendInt(this.tradeUser.getAccepted()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeCloseWindowComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeCloseWindowComposer.java index 6f0b87fe..225abef7 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeCloseWindowComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeCloseWindowComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class TradeCloseWindowComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.TradeCloseWindowComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeClosedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeClosedComposer.java index fb729e50..db247875 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeClosedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeClosedComposer.java @@ -17,7 +17,7 @@ public class TradeClosedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.TradeStoppedComposer); this.response.appendInt(this.userId); this.response.appendInt(this.errorCode); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeCompleteComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeCompleteComposer.java index c59cf2e9..2f21441e 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeCompleteComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeCompleteComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class TradeCompleteComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UnknownTradeComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeStartComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeStartComposer.java index 3329122c..57d9118d 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeStartComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeStartComposer.java @@ -21,7 +21,7 @@ public class TradeStartComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.TradeStartComposer); for (RoomTradeUser tradeUser : this.roomTrade.getRoomTradeUsers()) { this.response.appendInt(tradeUser.getHabbo().getHabboInfo().getId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeStartFailComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeStartFailComposer.java index 663f925b..1012e680 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeStartFailComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeStartFailComposer.java @@ -25,7 +25,7 @@ public class TradeStartFailComposer extends MessageComposer { this.username = username; } - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.TradeStartFailComposer); this.response.appendInt(this.code); this.response.appendString(this.username); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeUpdateComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeUpdateComposer.java index 3f28f45c..14464cf1 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeUpdateComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/trading/TradeUpdateComposer.java @@ -16,7 +16,7 @@ public class TradeUpdateComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.TradeUpdateComposer); for (RoomTradeUser roomTradeUser : this.roomTrade.getRoomTradeUsers()) { this.response.appendInt(roomTradeUser.getUserId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/trading/TradingWaitingConfirmComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/trading/TradingWaitingConfirmComposer.java index a165fe89..40efd6c3 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/trading/TradingWaitingConfirmComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/trading/TradingWaitingConfirmComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class TradingWaitingConfirmComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.TradingWaitingConfirmComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/trading/YouTradingDisabledComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/trading/YouTradingDisabledComposer.java index a2da47c0..ddb06e56 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/trading/YouTradingDisabledComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/trading/YouTradingDisabledComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class YouTradingDisabledComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.YouTradingDisabledComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/BuildersClubExpiredComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/BuildersClubExpiredComposer.java index 98de05c4..1be029d2 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/BuildersClubExpiredComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/BuildersClubExpiredComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class BuildersClubExpiredComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.BuildersClubExpiredComposer); this.response.appendInt(Integer.MAX_VALUE); this.response.appendInt(0); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/CloseWebPageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/CloseWebPageComposer.java index 59b0f56d..a5b22a21 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/CloseWebPageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/CloseWebPageComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class CloseWebPageComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.CloseWebPageComposer); //Empty body return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/CompetitionEntrySubmitResultComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/CompetitionEntrySubmitResultComposer.java index 98231ad9..36db1a94 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/CompetitionEntrySubmitResultComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/CompetitionEntrySubmitResultComposer.java @@ -22,7 +22,7 @@ public class CompetitionEntrySubmitResultComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.CompetitionEntrySubmitResultComposer); this.response.appendInt(this.unknownInt1); this.response.appendString(this.unknownString1); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/ConvertedForwardToRoomComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/ConvertedForwardToRoomComposer.java index fd54fe97..c36eb9fb 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/ConvertedForwardToRoomComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/ConvertedForwardToRoomComposer.java @@ -14,7 +14,7 @@ public class ConvertedForwardToRoomComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ConvertedForwardToRoomComposer); this.response.appendString(this.unknownString1); this.response.appendInt(this.unknownInt1); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/EpicPopupFrameComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/EpicPopupFrameComposer.java index ea1b85e7..0fc2e05e 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/EpicPopupFrameComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/EpicPopupFrameComposer.java @@ -13,7 +13,7 @@ public class EpicPopupFrameComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.EpicPopupFrameComposer); this.response.appendString(this.assetURI); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/ErrorLoginComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/ErrorLoginComposer.java index e43e3508..80546dd3 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/ErrorLoginComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/ErrorLoginComposer.java @@ -12,7 +12,7 @@ public class ErrorLoginComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ErrorLoginComposer); this.response.appendInt(this.errorCode); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/ExtendClubMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/ExtendClubMessageComposer.java index 3e3a2bc2..ec7cf3a1 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/ExtendClubMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/ExtendClubMessageComposer.java @@ -27,7 +27,7 @@ public class ExtendClubMessageComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ExtendClubMessageComposer); this.response.appendInt(this.item.getId()); this.response.appendString(this.item.getName()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/HabboMallComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/HabboMallComposer.java index 58c3475f..770fdfe0 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/HabboMallComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/HabboMallComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class HabboMallComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.HabboMallComposer); //Empty body return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/IgnoredUsersComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/IgnoredUsersComposer.java index e9c92582..6762d807 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/IgnoredUsersComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/IgnoredUsersComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class IgnoredUsersComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.IgnoredUsersComposer); this.response.appendInt(0); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/MessengerErrorComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/MessengerErrorComposer.java index 03a4b53b..c16dee3c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/MessengerErrorComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/MessengerErrorComposer.java @@ -14,7 +14,7 @@ public class MessengerErrorComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.MessengerErrorComposer); this.response.appendInt(this.errors.size()); for (Map.Entry entry : this.errors.entrySet()) { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/MinimailNewMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/MinimailNewMessageComposer.java index 65fd048c..d9534a7d 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/MinimailNewMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/MinimailNewMessageComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class MinimailNewMessageComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.MinimailNewMessageComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/ModToolComposerOne.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/ModToolComposerOne.java index 28794f60..56bba68c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/ModToolComposerOne.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/ModToolComposerOne.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class ModToolComposerOne extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ModToolComposerOne); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/ModToolSanctionDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/ModToolSanctionDataComposer.java index 819ee421..4cce8833 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/ModToolSanctionDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/ModToolSanctionDataComposer.java @@ -17,7 +17,7 @@ public class ModToolSanctionDataComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ModToolSanctionDataComposer); this.response.appendInt(this.unknownInt1); this.response.appendInt(this.accountId); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/MostUselessErrorAlertComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/MostUselessErrorAlertComposer.java index e58e1e54..65978271 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/MostUselessErrorAlertComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/MostUselessErrorAlertComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class MostUselessErrorAlertComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.MostUselessErrorAlertComposer); //EMpty Body return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/MysteryPrizeComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/MysteryPrizeComposer.java index 61f96b3b..d80cf1fa 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/MysteryPrizeComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/MysteryPrizeComposer.java @@ -5,7 +5,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class MysteryPrizeComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(427); this.response.appendString("s"); this.response.appendInt(230); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/RemoveRoomEventComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/RemoveRoomEventComposer.java index 543e14bb..1f052d53 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/RemoveRoomEventComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/RemoveRoomEventComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class RemoveRoomEventComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RemoveRoomEventComposer); //Empty Body return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/RentableItemBuyOutPriceComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/RentableItemBuyOutPriceComposer.java index 4c1b46e8..75b5f6db 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/RentableItemBuyOutPriceComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/RentableItemBuyOutPriceComposer.java @@ -22,7 +22,7 @@ public class RentableItemBuyOutPriceComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RentableItemBuyOutPriceComposer); this.response.appendBoolean(this.unknownBoolean1); this.response.appendString(this.unknownString1); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomAdErrorComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomAdErrorComposer.java index dcdb3d4c..0fb0752b 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomAdErrorComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomAdErrorComposer.java @@ -14,7 +14,7 @@ public class RoomAdErrorComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomAdErrorComposer); this.response.appendInt(this.errorCode); this.response.appendString(this.unknownString); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomCategoryUpdateMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomCategoryUpdateMessageComposer.java index 5355b89d..a726d903 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomCategoryUpdateMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomCategoryUpdateMessageComposer.java @@ -12,7 +12,7 @@ public class RoomCategoryUpdateMessageComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomCategoryUpdateMessageComposer); this.response.appendInt(this.unknownInt1); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomMessagesPostedCountComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomMessagesPostedCountComposer.java index 20870863..8a269fed 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomMessagesPostedCountComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomMessagesPostedCountComposer.java @@ -15,7 +15,7 @@ public class RoomMessagesPostedCountComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomMessagesPostedCountComposer); this.response.appendInt(this.room.getId()); this.response.appendString(this.room.getName()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomUnknown3Composer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomUnknown3Composer.java index f4720d4b..0965e3e7 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomUnknown3Composer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomUnknown3Composer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class RoomUnknown3Composer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUnknown3Composer); //Empty body return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomUserQuestionAnsweredComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomUserQuestionAnsweredComposer.java index 73124907..3bd9a877 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomUserQuestionAnsweredComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomUserQuestionAnsweredComposer.java @@ -18,7 +18,7 @@ public class RoomUserQuestionAnsweredComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.RoomUserQuestionAnsweredComposer); this.response.appendInt(this.userId); this.response.appendString(this.value); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsAddUserComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsAddUserComposer.java index 2e606ddc..a05f934e 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsAddUserComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsAddUserComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class SnowWarsAddUserComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(1880); this.response.appendInt(3); this.response.appendString("Derpface"); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsCompose1.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsCompose1.java index c920fe29..5dcdc02d 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsCompose1.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsCompose1.java @@ -12,7 +12,7 @@ public class SnowWarsCompose1 extends MessageComposer { //:test 1604 i:1 s:a i:10 i:2 i:3 i:4 s:1 i:3 i:10 i:1 s:Admin s:%look% s:M i:0 i:0 i:0 i:0 @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(this.header); this.response.appendInt(1); this.response.appendString("SnowStorm level " + 9); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsFullGameStatusComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsFullGameStatusComposer.java index d5736aff..c92b41d3 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsFullGameStatusComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsFullGameStatusComposer.java @@ -5,7 +5,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class SnowWarsFullGameStatusComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(0); this.response.appendInt(0); //Unused this.response.appendInt(0); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsGameStartedErrorComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsGameStartedErrorComposer.java index 3eab79fe..ebe60a79 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsGameStartedErrorComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsGameStartedErrorComposer.java @@ -5,7 +5,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class SnowWarsGameStartedErrorComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(2860); this.response.appendInt(1); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsGenericErrorComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsGenericErrorComposer.java index b2b1f57d..ffb6698a 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsGenericErrorComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsGenericErrorComposer.java @@ -5,7 +5,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class SnowWarsGenericErrorComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(3702); this.response.appendInt(1); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsInitGameArena.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsInitGameArena.java index a72bafa1..c9b23394 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsInitGameArena.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsInitGameArena.java @@ -5,7 +5,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class SnowWarsInitGameArena extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(3924); this.response.appendInt(0); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsJoinErrorComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsJoinErrorComposer.java index 7fb55df3..326a0d5a 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsJoinErrorComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsJoinErrorComposer.java @@ -9,7 +9,7 @@ public class SnowWarsJoinErrorComposer extends MessageComposer { public static final int ERROR_DUPLICATE_MACHINE_ID = 2; @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(1437); this.response.appendInt(2); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsLevelDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsLevelDataComposer.java index d8c5896f..f92e3f55 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsLevelDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsLevelDataComposer.java @@ -5,7 +5,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class SnowWarsLevelDataComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(3874); this.response.appendInt(0); this.response.appendInt(10); //MapID diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsLoadingArenaComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsLoadingArenaComposer.java index fc7f7b6d..d6f11a4f 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsLoadingArenaComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsLoadingArenaComposer.java @@ -11,7 +11,7 @@ public class SnowWarsLoadingArenaComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(3850); this.response.appendInt(this.count); //GameID? this.response.appendInt(0); //Count diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsLongDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsLongDataComposer.java index f9b48707..bcd20718 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsLongDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsLongDataComposer.java @@ -5,7 +5,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class SnowWarsLongDataComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(2823); this.response.appendInt(1); this.response.appendString("SnowStorm level " + 10); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsOnGameEnding.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsOnGameEnding.java index 520d2128..d071179c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsOnGameEnding.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsOnGameEnding.java @@ -5,7 +5,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class SnowWarsOnGameEnding extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(1893); this.response.appendInt(0); //idk diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsOnStageEnding.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsOnStageEnding.java index 70e9df71..1de1d88d 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsOnStageEnding.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsOnStageEnding.java @@ -5,7 +5,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class SnowWarsOnStageEnding extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(1140); this.response.appendInt(1); //idk return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsOnStageRunningComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsOnStageRunningComposer.java index d1a916da..b171aa26 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsOnStageRunningComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsOnStageRunningComposer.java @@ -5,7 +5,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class SnowWarsOnStageRunningComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(3832); this.response.appendInt(120); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsOnStageStartComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsOnStageStartComposer.java index 0ad456af..0eb4f634 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsOnStageStartComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsOnStageStartComposer.java @@ -5,7 +5,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class SnowWarsOnStageStartComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(889); this.response.appendInt(0); this.response.appendString("snowwar_arena_0"); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsPlayNowWindowComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsPlayNowWindowComposer.java index e7eb8931..80a91216 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsPlayNowWindowComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsPlayNowWindowComposer.java @@ -5,7 +5,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class SnowWarsPlayNowWindowComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(2276); this.response.appendInt(0); //status this.response.appendInt(100); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsPreviousRoomComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsPreviousRoomComposer.java index 77dcc7a3..51b8149c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsPreviousRoomComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsPreviousRoomComposer.java @@ -5,7 +5,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class SnowWarsPreviousRoomComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(1381); this.response.appendInt(1); //room Id return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsQuePositionComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsQuePositionComposer.java index 0bc871b4..73ede102 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsQuePositionComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsQuePositionComposer.java @@ -5,7 +5,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class SnowWarsQuePositionComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(2077); this.response.appendInt(1); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsQuickJoinComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsQuickJoinComposer.java index cb7502d2..02aa00f6 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsQuickJoinComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsQuickJoinComposer.java @@ -5,7 +5,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class SnowWarsQuickJoinComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(913); this.response.appendInt(1); this.response.appendString("SnowStorm level " + 9); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsRemoveUserComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsRemoveUserComposer.java index a7d986a6..01263b50 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsRemoveUserComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsRemoveUserComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class SnowWarsRemoveUserComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(2502); this.response.appendInt(3); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsResetTimerComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsResetTimerComposer.java index 83a4e241..43336c37 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsResetTimerComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsResetTimerComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class SnowWarsResetTimerComposer extends MessageComposer { //SnowStageRunning? @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(294); this.response.appendInt(100); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsStartLobbyCounter.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsStartLobbyCounter.java index c33d5702..20fa8a5f 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsStartLobbyCounter.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsStartLobbyCounter.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class SnowWarsStartLobbyCounter extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(3757); this.response.appendInt(5); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsUnknownComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsUnknownComposer.java index fd331a8c..1dcfe052 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsUnknownComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsUnknownComposer.java @@ -5,7 +5,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class SnowWarsUnknownComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(2869); this.response.appendString("snowwar"); this.response.appendInt(0); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsUserChatComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsUserChatComposer.java index c5987bab..d9268e57 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsUserChatComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsUserChatComposer.java @@ -5,7 +5,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class SnowWarsUserChatComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(2049); this.response.appendInt(1); //UserID this.response.appendString("Message"); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsUserEnteredArenaComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsUserEnteredArenaComposer.java index ca819281..4bd4de90 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsUserEnteredArenaComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsUserEnteredArenaComposer.java @@ -11,7 +11,7 @@ public class SnowWarsUserEnteredArenaComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(3425); if (this.type == 1) { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsUserExitArenaComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsUserExitArenaComposer.java index 7522a245..1962c130 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsUserExitArenaComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/SnowWarsUserExitArenaComposer.java @@ -5,7 +5,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; public class SnowWarsUserExitArenaComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(3811); this.response.appendInt(1); //userId this.response.appendInt(1); //IDK ? TEAM? diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/TalentTrackEmailFailedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/TalentTrackEmailFailedComposer.java index d2960135..efcabe5b 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/TalentTrackEmailFailedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/TalentTrackEmailFailedComposer.java @@ -12,7 +12,7 @@ public class TalentTrackEmailFailedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.TalentTrackEmailFailedComposer); this.response.appendInt(this.result); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/TalentTrackEmailVerifiedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/TalentTrackEmailVerifiedComposer.java index 87f4250d..119a0b36 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/TalentTrackEmailVerifiedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/TalentTrackEmailVerifiedComposer.java @@ -16,7 +16,7 @@ public class TalentTrackEmailVerifiedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.TalentTrackEmailVerifiedComposer); this.response.appendString(this.email); this.response.appendBoolean(this.unknownB1); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownAdManagerComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownAdManagerComposer.java index c5613934..d690e8a9 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownAdManagerComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownAdManagerComposer.java @@ -12,7 +12,7 @@ public class UnknownAdManagerComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UnknownAdManagerComposer); this.response.appendBoolean(this.unknownBoolean); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownAvatarEditorComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownAvatarEditorComposer.java index 0a5afef1..5ff0d0c5 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownAvatarEditorComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownAvatarEditorComposer.java @@ -12,7 +12,7 @@ public class UnknownAvatarEditorComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UnknownAvatarEditorComposer); this.response.appendInt(this.type); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownCatalogPageOfferComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownCatalogPageOfferComposer.java index ef67851b..0ce8fbd0 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownCatalogPageOfferComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownCatalogPageOfferComposer.java @@ -15,7 +15,7 @@ public class UnknownCatalogPageOfferComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UnknownCatalogPageOfferComposer); this.response.appendInt(this.pageId); this.catalogItem.serialize(this.response); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownCompetitionComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownCompetitionComposer.java index 6c567402..903e322c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownCompetitionComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownCompetitionComposer.java @@ -18,7 +18,7 @@ public class UnknownCompetitionComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UnknownCompetitionComposer); this.response.appendInt(this.unknownInt1); this.response.appendString(this.unknownString1); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownComposer4.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownComposer4.java index b097234b..780db475 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownComposer4.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownComposer4.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class UnknownComposer4 extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.IsFirstLoginOfDayComposer); this.response.appendBoolean(false); //Think something related to promo. Not sure though. return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownComposer5.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownComposer5.java index 600b280d..f9e18d7a 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownComposer5.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownComposer5.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class UnknownComposer5 extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UnknownComposer5); this.response.appendInt(0); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownComposer8.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownComposer8.java index 5fd770ce..99417c98 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownComposer8.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownComposer8.java @@ -16,7 +16,7 @@ public class UnknownComposer8 extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UnknownComposer8); this.response.appendInt(this.unknownInt1); this.response.appendInt(this.userId); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownFurniModelComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownFurniModelComposer.java index 1f48b509..e4c3d621 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownFurniModelComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownFurniModelComposer.java @@ -15,7 +15,7 @@ public class UnknownFurniModelComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UnknownFurniModelComposer); this.response.appendInt(this.item.getId()); this.response.appendInt(this.unknownInt); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownGuild2Composer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownGuild2Composer.java index f754d562..dab7e51e 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownGuild2Composer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownGuild2Composer.java @@ -12,7 +12,7 @@ public class UnknownGuild2Composer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UnknownGuild2Composer); this.response.appendInt(this.guildId); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownGuildComposer3.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownGuildComposer3.java index 92ed45aa..c82577c7 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownGuildComposer3.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownGuildComposer3.java @@ -12,7 +12,7 @@ public class UnknownGuildComposer3 extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UnknownGuildComposer3); this.response.appendInt(this.userId); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownHabboWayQuizComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownHabboWayQuizComposer.java index 69e80c39..5c1a6b06 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownHabboWayQuizComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownHabboWayQuizComposer.java @@ -16,7 +16,7 @@ public class UnknownHabboWayQuizComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UnknownHabboWayQuizComposer); this.response.appendString(this.unknownString); this.response.appendInt(this.unknownIntegerList.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownHelperComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownHelperComposer.java index 60cd0fff..ed2f4104 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownHelperComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownHelperComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class UnknownHelperComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UnknownHelperComposer); //Empty body return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownHintComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownHintComposer.java index fd3683cb..82ff7d27 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownHintComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownHintComposer.java @@ -12,7 +12,7 @@ public class UnknownHintComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UnknownHintComposer); this.response.appendString(this.key); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownMessengerErrorComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownMessengerErrorComposer.java index 36205b53..5f62eecd 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownMessengerErrorComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownMessengerErrorComposer.java @@ -16,7 +16,7 @@ public class UnknownMessengerErrorComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UnknownMessengerErrorComposer); this.response.appendInt(this.errorCode); this.response.appendInt(this.userId); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownPollQuestionComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownPollQuestionComposer.java index 972d64d7..61705142 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownPollQuestionComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownPollQuestionComposer.java @@ -16,7 +16,7 @@ public class UnknownPollQuestionComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.SimplePollAnswersComposer); this.response.appendInt(this.unknownInt); this.response.appendInt(this.unknownMap.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownRoomDesktopComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownRoomDesktopComposer.java index db5221e7..d535af23 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownRoomDesktopComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownRoomDesktopComposer.java @@ -16,7 +16,7 @@ public class UnknownRoomDesktopComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UnknownRoomDesktopComposer); this.response.appendInt(this.unknownInt1); this.response.appendInt(this.unknownMap.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownRoomViewerComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownRoomViewerComposer.java index 54446677..703a08e6 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownRoomViewerComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownRoomViewerComposer.java @@ -14,7 +14,7 @@ public class UnknownRoomViewerComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UnknownRoomViewerComposer); this.response.appendInt(this.unknownMap.size()); for (Map.Entry entry : this.unknownMap.entrySet()) { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownStatusComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownStatusComposer.java index d4c0f902..cfa8c309 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownStatusComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownStatusComposer.java @@ -15,7 +15,7 @@ public class UnknownStatusComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UnknownStatusComposer); this.response.appendInt(this.status); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownTradeComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownTradeComposer.java index 8d1a1ca9..052655e3 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownTradeComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownTradeComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class UnknownTradeComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UnknownTradeComposer); //Empty Body return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnkownPetPackageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnkownPetPackageComposer.java index e33142e3..337951a1 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnkownPetPackageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnkownPetPackageComposer.java @@ -14,7 +14,7 @@ public class UnkownPetPackageComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UnkownPetPackageComposer); this.response.appendInt(this.unknownMap.size()); for (Map.Entry entry : this.unknownMap.entrySet()) { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UserClassificationComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UserClassificationComposer.java index c679545d..f7c3213a 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UserClassificationComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UserClassificationComposer.java @@ -15,7 +15,7 @@ public class UserClassificationComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UserClassificationComposer); this.response.appendInt(this.info.size()); for (Pair> set : this.info) { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/VipTutorialsStartComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/VipTutorialsStartComposer.java index e9a8b86b..3c2412c5 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/VipTutorialsStartComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/VipTutorialsStartComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class VipTutorialsStartComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.VipTutorialsStartComposer); //Empty Body return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/WatchAndEarnRewardComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/WatchAndEarnRewardComposer.java index 17eb79e2..06dd2b9d 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/WatchAndEarnRewardComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/WatchAndEarnRewardComposer.java @@ -13,7 +13,7 @@ public class WatchAndEarnRewardComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.WatchAndEarnRewardComposer); this.response.appendString(this.item.getType().code); this.response.appendInt(this.item.getId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/WelcomeGiftComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/WelcomeGiftComposer.java index 6e41e4cb..8345ec60 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/WelcomeGiftComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/WelcomeGiftComposer.java @@ -20,7 +20,7 @@ public class WelcomeGiftComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.WelcomeGiftComposer); this.response.appendString(this.email); this.response.appendBoolean(this.unknownB1); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/WelcomeGiftErrorComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/WelcomeGiftErrorComposer.java index 3f94d436..afb1fde5 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/WelcomeGiftErrorComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/WelcomeGiftErrorComposer.java @@ -17,7 +17,7 @@ public class WelcomeGiftErrorComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.WelcomeGiftErrorComposer); this.response.appendInt(this.error); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/AddUserBadgeComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/AddUserBadgeComposer.java index ac7a38bd..7074188f 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/AddUserBadgeComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/AddUserBadgeComposer.java @@ -13,7 +13,7 @@ public class AddUserBadgeComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.AddUserBadgeComposer); this.response.appendInt(this.badge.getId()); this.response.appendString(this.badge.getCode()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/ChangeNameCheckResultComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/ChangeNameCheckResultComposer.java index bc2089de..e451a884 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/ChangeNameCheckResultComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/ChangeNameCheckResultComposer.java @@ -25,7 +25,7 @@ public class ChangeNameCheckResultComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UnknownComposer_2698); this.response.appendInt(this.status); this.response.appendString(this.name); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/ClubGiftReceivedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/ClubGiftReceivedComposer.java index cfb5e4d9..b67608bd 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/ClubGiftReceivedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/ClubGiftReceivedComposer.java @@ -15,7 +15,7 @@ public class ClubGiftReceivedComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.ClubGiftReceivedComposer); this.response.appendInt(this.items.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/FavoriteRoomsCountComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/FavoriteRoomsCountComposer.java index 57f7a586..36f4c4e5 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/FavoriteRoomsCountComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/FavoriteRoomsCountComposer.java @@ -15,7 +15,7 @@ public class FavoriteRoomsCountComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.FavoriteRoomsCountComposer); this.response.appendInt(Emulator.getConfig().getInt("hotel.rooms.max.favorite")); this.response.appendInt(this.habbo.getHabboStats().getFavoriteRooms().size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/MeMenuSettingsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/MeMenuSettingsComposer.java index 48319066..73b2d1d9 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/MeMenuSettingsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/MeMenuSettingsComposer.java @@ -13,7 +13,7 @@ public class MeMenuSettingsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.MeMenuSettingsComposer); this.response.appendInt(this.habbo.getHabboStats().volumeSystem); this.response.appendInt(this.habbo.getHabboStats().volumeFurni); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/MutedWhisperComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/MutedWhisperComposer.java index 05cf873a..1db3310f 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/MutedWhisperComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/MutedWhisperComposer.java @@ -12,7 +12,7 @@ public class MutedWhisperComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.MutedWhisperComposer); this.response.appendInt(this.seconds); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/ProfileFriendsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/ProfileFriendsComposer.java index 4cae8211..cc4d757c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/ProfileFriendsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/ProfileFriendsComposer.java @@ -57,7 +57,7 @@ public class ProfileFriendsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { try { this.response.init(Outgoing.ProfileFriendsComposer); this.response.appendInt(this.userId); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UpdateUserLookComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UpdateUserLookComposer.java index 5b536e02..ebe6f212 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UpdateUserLookComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UpdateUserLookComposer.java @@ -13,7 +13,7 @@ public class UpdateUserLookComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UpdateUserLookComposer); this.response.appendString(this.habbo.getHabboInfo().getLook()); this.response.appendString(this.habbo.getHabboInfo().getGender().name()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UserAchievementScoreComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UserAchievementScoreComposer.java index 8f7f7766..539481ab 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UserAchievementScoreComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UserAchievementScoreComposer.java @@ -13,7 +13,7 @@ public class UserAchievementScoreComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UserAchievementScoreComposer); this.response.appendInt(this.habbo.getHabboStats().getAchievementScore()); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UserBCLimitsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UserBCLimitsComposer.java index 30e1b895..3b745395 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UserBCLimitsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UserBCLimitsComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class UserBCLimitsComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UserBCLimitsComposer); this.response.appendInt(0); this.response.appendInt(500); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UserBadgesComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UserBadgesComposer.java index e4e5d2ca..7574c3a6 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UserBadgesComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UserBadgesComposer.java @@ -17,7 +17,7 @@ public class UserBadgesComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UserBadgesComposer); this.response.appendInt(this.habbo); synchronized (this.badges) { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UserCitizinShipComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UserCitizinShipComposer.java index b2f33c9b..cbaea5ba 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UserCitizinShipComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UserCitizinShipComposer.java @@ -12,7 +12,7 @@ public class UserCitizinShipComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UserCitizinShipComposer); this.response.appendString(this.name); this.response.appendInt(4); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UserClothesComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UserClothesComposer.java index bc6ef47f..82c33e9f 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UserClothesComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UserClothesComposer.java @@ -34,7 +34,7 @@ public class UserClothesComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UserClothesComposer); this.response.appendInt(this.idList.size()); this.idList.forEach(this.response::appendInt); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UserClubComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UserClubComposer.java index eeb0724f..6e5f60bc 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UserClubComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UserClubComposer.java @@ -14,7 +14,7 @@ public class UserClubComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UserClubComposer); this.response.appendString("club_habbo"); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UserCreditsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UserCreditsComposer.java index 5041b8ea..70c89ae6 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UserCreditsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UserCreditsComposer.java @@ -13,7 +13,7 @@ public class UserCreditsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UserCreditsComposer); this.response.appendString(this.habbo.getHabboInfo().getCredits() + ".0"); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UserCurrencyComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UserCurrencyComposer.java index d974ce80..22b689af 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UserCurrencyComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UserCurrencyComposer.java @@ -18,7 +18,7 @@ public class UserCurrencyComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UserCurrencyComposer); String[] pointsTypes = Emulator.getConfig().getValue("seasonal.types").split(";"); this.response.appendInt(pointsTypes.length); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UserDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UserDataComposer.java index 5d5ed7e2..6b4235dd 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UserDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UserDataComposer.java @@ -13,7 +13,7 @@ public class UserDataComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UserDataComposer); this.response.appendInt(this.habbo.getHabboInfo().getId()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UserHomeRoomComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UserHomeRoomComposer.java index ad324081..5ab9a8c3 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UserHomeRoomComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UserHomeRoomComposer.java @@ -14,7 +14,7 @@ public class UserHomeRoomComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UserHomeRoomComposer); this.response.appendInt(this.homeRoom); this.response.appendInt(this.newRoom); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UserPerksComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UserPerksComposer.java index 508ad241..d8d3262d 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UserPerksComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UserPerksComposer.java @@ -14,7 +14,7 @@ public class UserPerksComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UserPerksComposer); this.response.appendInt(15); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UserPermissionsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UserPermissionsComposer.java index 9dc9cb0b..4a0d13d4 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UserPermissionsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UserPermissionsComposer.java @@ -16,7 +16,7 @@ public class UserPermissionsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UserPermissionsComposer); this.response.appendInt(this.clubLevel); this.response.appendInt(this.habbo.getHabboInfo().getRank().getLevel()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UserPointsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UserPointsComposer.java index 6a158ad2..19ffa00c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UserPointsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UserPointsComposer.java @@ -16,7 +16,7 @@ public class UserPointsComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UserPointsComposer); this.response.appendInt(this.currentAmount); this.response.appendInt(this.amountAdded); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UserProfileComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UserProfileComposer.java index b2944ea8..7a535652 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UserProfileComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UserProfileComposer.java @@ -40,7 +40,7 @@ public class UserProfileComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { if (this.habboInfo == null) return null; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UserWardrobeComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UserWardrobeComposer.java index 562a2f09..912fab51 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UserWardrobeComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UserWardrobeComposer.java @@ -13,7 +13,7 @@ public class UserWardrobeComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.UserWardrobeComposer); this.response.appendInt(1); this.response.appendInt(this.wardrobeComponent.getLooks().size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/verification/VerifyMobileNumberComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/verification/VerifyMobileNumberComposer.java index 73b6983d..c763d4b1 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/verification/VerifyMobileNumberComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/verification/VerifyMobileNumberComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class VerifyMobileNumberComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.VerifyMobileNumberComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/verification/VerifyMobilePhoneCodeWindowComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/verification/VerifyMobilePhoneCodeWindowComposer.java index 80561efc..f2923d4c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/verification/VerifyMobilePhoneCodeWindowComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/verification/VerifyMobilePhoneCodeWindowComposer.java @@ -14,7 +14,7 @@ public class VerifyMobilePhoneCodeWindowComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.VerifyMobilePhoneCodeWindowComposer); this.response.appendInt(this.unknownInt1); this.response.appendInt(this.unknownInt2); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/verification/VerifyMobilePhoneDoneComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/verification/VerifyMobilePhoneDoneComposer.java index 136a97ba..b91fca9f 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/verification/VerifyMobilePhoneDoneComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/verification/VerifyMobilePhoneDoneComposer.java @@ -14,7 +14,7 @@ public class VerifyMobilePhoneDoneComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.VerifyMobilePhoneDoneComposer); this.response.appendInt(this.unknownInt1); this.response.appendInt(this.unknownInt2); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/verification/VerifyMobilePhoneWindowComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/verification/VerifyMobilePhoneWindowComposer.java index 85a31b5f..14766727 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/verification/VerifyMobilePhoneWindowComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/verification/VerifyMobilePhoneWindowComposer.java @@ -16,7 +16,7 @@ public class VerifyMobilePhoneWindowComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.VerifyMobilePhoneWindowComposer); this.response.appendInt(this.unknownInt1); this.response.appendInt(this.unknownInt2); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredConditionDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredConditionDataComposer.java index 71de8019..b3dcae0a 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredConditionDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredConditionDataComposer.java @@ -16,7 +16,7 @@ public class WiredConditionDataComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.WiredConditionDataComposer); this.condition.serializeWiredData(this.response, this.room); this.condition.needsUpdate(true); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredEffectDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredEffectDataComposer.java index abd1923d..73c84f2f 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredEffectDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredEffectDataComposer.java @@ -16,7 +16,7 @@ public class WiredEffectDataComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.WiredEffectDataComposer); this.effect.serializeWiredData(this.response, this.room); this.effect.needsUpdate(true); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredOpenComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredOpenComposer.java index ea89b564..d433f637 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredOpenComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredOpenComposer.java @@ -13,7 +13,7 @@ public class WiredOpenComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.WiredOpenComposer); this.response.appendInt(this.item.getId()); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredRewardAlertComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredRewardAlertComposer.java index 24f8965b..606a31eb 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredRewardAlertComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredRewardAlertComposer.java @@ -22,7 +22,7 @@ public class WiredRewardAlertComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.WiredRewardAlertComposer); this.response.appendInt(this.code); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredSavedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredSavedComposer.java index bfd12f61..17be832b 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredSavedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredSavedComposer.java @@ -6,7 +6,7 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class WiredSavedComposer extends MessageComposer { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.WiredSavedComposer); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredTriggerDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredTriggerDataComposer.java index abdb269f..8541e814 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredTriggerDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredTriggerDataComposer.java @@ -16,7 +16,7 @@ public class WiredTriggerDataComposer extends MessageComposer { } @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.WiredTriggerDataComposer); this.trigger.serializeWiredData(this.response, this.room); this.trigger.needsUpdate(true); diff --git a/src/main/java/com/eu/habbo/messages/rcon/FriendRequest.java b/src/main/java/com/eu/habbo/messages/rcon/FriendRequest.java index 3b2f35c5..59d0bf3b 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/FriendRequest.java +++ b/src/main/java/com/eu/habbo/messages/rcon/FriendRequest.java @@ -33,7 +33,7 @@ public class FriendRequest extends RCONMessage { if (info != null) { target.getClient().sendResponse(new MessageComposer() { @Override - public ServerMessage compose() { + protected ServerMessage composeInternal() { this.response.init(Outgoing.FriendRequestComposer); this.response.appendInt(info.getId()); this.response.appendString(info.getUsername()); diff --git a/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageEncoder.java b/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageEncoder.java index a3a59dbd..ccb470e0 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageEncoder.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageEncoder.java @@ -14,6 +14,7 @@ public class GameServerMessageEncoder extends MessageToByteEncoder Date: Sat, 9 May 2020 21:56:52 +0200 Subject: [PATCH 071/215] Add reliability to packets and actually clear the message buffer. --- .../com/eu/habbo/habbohotel/rooms/Room.java | 54 +++++++++++++------ .../eu/habbo/habbohotel/rooms/RoomTrade.java | 13 ++++- .../com/eu/habbo/messages/ServerMessage.java | 22 ++------ 3 files changed, 53 insertions(+), 36 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index e0d51c01..5338ce24 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -3726,35 +3726,59 @@ public class Room implements Comparable, ISerialize, Runnable { } public void sendComposer(ServerMessage message) { - for (Habbo habbo : this.getHabbos()) { - if (habbo.getClient() == null) { - this.removeHabbo(habbo, true); - continue; - } + message.retain(); - habbo.getClient().sendResponse(message); + try { + for (Habbo habbo : this.getHabbos()) { + if (habbo.getClient() == null) { + this.removeHabbo(habbo, true); + continue; + } + + habbo.getClient().sendResponse(message); + } + } finally { + message.release(); } } public void sendComposerToHabbosWithRights(ServerMessage message) { - for (Habbo habbo : this.getHabbos()) { - if (this.hasRights(habbo)) { - habbo.getClient().sendResponse(message); + message.retain(); + + try { + for (Habbo habbo : this.getHabbos()) { + if (this.hasRights(habbo)) { + habbo.getClient().sendResponse(message); + } } + } finally { + message.release(); } } public void petChat(ServerMessage message) { - for (Habbo habbo : this.getHabbos()) { - if (!habbo.getHabboStats().ignorePets) - habbo.getClient().sendResponse(message); + message.retain(); + + try { + for (Habbo habbo : this.getHabbos()) { + if (!habbo.getHabboStats().ignorePets) + habbo.getClient().sendResponse(message); + } + } finally { + message.release(); } } public void botChat(ServerMessage message) { - for (Habbo habbo : this.getHabbos()) { - if (!habbo.getHabboStats().ignoreBots) - habbo.getClient().sendResponse(message); + message.retain(); + + try { + for (Habbo habbo : this.getHabbos()) { + if (!habbo.getHabboStats().ignoreBots) + habbo.getClient().sendResponse(message); + } + } finally { + message.release(); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java index c6ba64e0..3a443447 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.rooms; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; +import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.inventory.AddHabboItemComposer; import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer; @@ -310,8 +311,16 @@ public class RoomTrade { } public void sendMessageToUsers(MessageComposer message) { - for (RoomTradeUser roomTradeUser : this.users) { - roomTradeUser.getHabbo().getClient().sendResponse(message); + ServerMessage messageComposed = message.compose(); + + messageComposed.retain(); + + try { + for (RoomTradeUser roomTradeUser : this.users) { + roomTradeUser.getHabbo().getClient().sendResponse(message); + } + } finally { + messageComposed.release(); } } diff --git a/src/main/java/com/eu/habbo/messages/ServerMessage.java b/src/main/java/com/eu/habbo/messages/ServerMessage.java index f43831d1..7a7e7c4f 100644 --- a/src/main/java/com/eu/habbo/messages/ServerMessage.java +++ b/src/main/java/com/eu/habbo/messages/ServerMessage.java @@ -1,6 +1,5 @@ package com.eu.habbo.messages; -import com.eu.habbo.util.DebugUtils; import com.eu.habbo.util.PacketUtils; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufOutputStream; @@ -194,23 +193,13 @@ public class ServerMessage implements ReferenceCounted { @Override public ReferenceCounted retain() { - int result = this.refs.incrementAndGet(); - - if (this.header == 1167 || this.header == 2024 || this.header == 2505) { - System.out.printf("retain Packet: %d Count: %d From: %s%n", this.header, result, DebugUtils.getCallerCallerStacktrace()); - } - + this.refs.incrementAndGet(); return this; } @Override public ReferenceCounted retain(int i) { - int result = this.refs.addAndGet(i); - - if (this.header == 1167 || this.header == 2024 || this.header == 2505) { - System.out.printf("retain Packet: %d Count: %d From: %s%n", this.header, result, DebugUtils.getCallerCallerStacktrace()); - } - + this.refs.addAndGet(i); return this; } @@ -232,17 +221,12 @@ public class ServerMessage implements ReferenceCounted { @Override public boolean release(int i) { int value = this.refs.addAndGet(-i); - - if (this.header == 1167 || this.header == 2024 || this.header == 2505) { - System.out.printf("release Packet: %d Count: %d From: %s%n", this.header, value, DebugUtils.getCallerCallerStacktrace()); - } - if (value < 0) { throw new IllegalReferenceCountException("Decremented below 0 (packet " + this.header + " value " + value + ")."); } if (value == 0) { - this.channelBuffer.release(); + this.channelBuffer.release(this.channelBuffer.refCnt()); return true; } From a93ffbbbaca053c9c7ce8b8986ef3969afebc4ac Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Sat, 9 May 2020 22:41:43 +0200 Subject: [PATCH 072/215] Added debug. --- .../encoders/GameServerMessageEncoder.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageEncoder.java b/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageEncoder.java index ccb470e0..3b706fa6 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageEncoder.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageEncoder.java @@ -4,18 +4,28 @@ import com.eu.habbo.messages.ServerMessage; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToByteEncoder; +import io.netty.util.IllegalReferenceCountException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class GameServerMessageEncoder extends MessageToByteEncoder { + private static final Logger LOGGER = LoggerFactory.getLogger(GameServerMessageEncoder.class); + @Override protected void encode(ChannelHandlerContext ctx, ServerMessage message, ByteBuf out) { - ByteBuf buf = message.get(); - try { - out.writeBytes(buf); - } finally { - // Release copied buffer. - buf.release(); + ByteBuf buf = message.get(); + + try { + out.writeBytes(buf); + } finally { + // Release copied buffer. + buf.release(); + } + } catch (IllegalReferenceCountException e) { + LOGGER.error("IllegalReferenceCountException happened for packet {}.", message.getHeader()); + throw e; } } From 4c140d940255992af2d69ff0799e3e4b9afa130b Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Sat, 9 May 2020 23:05:51 +0200 Subject: [PATCH 073/215] Fix more edge cases. --- .../com/eu/habbo/habbohotel/rooms/Room.java | 91 ++++++++++++------- .../encoders/GameServerMessageEncoder.java | 11 +-- 2 files changed, 60 insertions(+), 42 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 5338ce24..85d108a3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -3120,40 +3120,73 @@ public class Room implements Comparable, ISerialize, Runnable { return; } - final ServerMessage message = new RoomUserWhisperComposer(roomChatMessage).compose(); RoomChatMessage staffChatMessage = new RoomChatMessage(roomChatMessage); staffChatMessage.setMessage("To " + staffChatMessage.getTargetHabbo().getHabboInfo().getUsername() + ": " + staffChatMessage.getMessage()); + + final ServerMessage message = new RoomUserWhisperComposer(roomChatMessage).compose(); final ServerMessage staffMessage = new RoomUserWhisperComposer(staffChatMessage).compose(); - for (Habbo h : this.getHabbos()) { - if (h == roomChatMessage.getTargetHabbo() || h == habbo) { - if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId())) { - if (prefixMessage != null) { - h.getClient().sendResponse(prefixMessage); - } - h.getClient().sendResponse(message); + message.retain(); + staffMessage.retain(); - if (clearPrefixMessage != null) { - h.getClient().sendResponse(clearPrefixMessage); + try { + for (Habbo h : this.getHabbos()) { + if (h == roomChatMessage.getTargetHabbo() || h == habbo) { + if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId())) { + if (prefixMessage != null) { + h.getClient().sendResponse(prefixMessage); + } + h.getClient().sendResponse(message); + + if (clearPrefixMessage != null) { + h.getClient().sendResponse(clearPrefixMessage); + } } + + continue; + } + if (h.hasPermission("acc_see_whispers")) { + h.getClient().sendResponse(staffMessage); } - - continue; - } - if (h.hasPermission("acc_see_whispers")) { - h.getClient().sendResponse(staffMessage); } + } finally { + message.release(); + staffMessage.release(); } } else if (chatType == RoomChatType.TALK) { ServerMessage message = new RoomUserTalkComposer(roomChatMessage).compose(); boolean noChatLimit = habbo.hasPermission("acc_chat_no_limit"); - for (Habbo h : this.getHabbos()) { - if ((h.getRoomUnit().getCurrentLocation().distance(habbo.getRoomUnit().getCurrentLocation()) <= this.chatDistance || - h.equals(habbo) || - this.hasRights(h) || - noChatLimit) && (show == null || RoomLayout.tileInSquare(show, h.getRoomUnit().getCurrentLocation()))) { - if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId())) { + message.retain(); + + try { + for (Habbo h : this.getHabbos()) { + if ((h.getRoomUnit().getCurrentLocation().distance(habbo.getRoomUnit().getCurrentLocation()) <= this.chatDistance || + h.equals(habbo) || + this.hasRights(h) || + noChatLimit) && (show == null || RoomLayout.tileInSquare(show, h.getRoomUnit().getCurrentLocation()))) { + if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId())) { + if (prefixMessage != null && !h.getHabboStats().preferOldChat) { + h.getClient().sendResponse(prefixMessage); + } + h.getClient().sendResponse(message); + if (clearPrefixMessage != null && !h.getHabboStats().preferOldChat) { + h.getClient().sendResponse(clearPrefixMessage); + } + } + } + } + } finally { + message.release(); + } + } else if (chatType == RoomChatType.SHOUT) { + ServerMessage message = new RoomUserShoutComposer(roomChatMessage).compose(); + + message.retain(); + + try { + for (Habbo h : this.getHabbos()) { + if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId()) && (show == null || RoomLayout.tileInSquare(show, h.getRoomUnit().getCurrentLocation()))) { if (prefixMessage != null && !h.getHabboStats().preferOldChat) { h.getClient().sendResponse(prefixMessage); } @@ -3163,20 +3196,8 @@ public class Room implements Comparable, ISerialize, Runnable { } } } - } - } else if (chatType == RoomChatType.SHOUT) { - ServerMessage message = new RoomUserShoutComposer(roomChatMessage).compose(); - - for (Habbo h : this.getHabbos()) { - if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId()) && (show == null || RoomLayout.tileInSquare(show, h.getRoomUnit().getCurrentLocation()))) { - if (prefixMessage != null && !h.getHabboStats().preferOldChat) { - h.getClient().sendResponse(prefixMessage); - } - h.getClient().sendResponse(message); - if (clearPrefixMessage != null && !h.getHabboStats().preferOldChat) { - h.getClient().sendResponse(clearPrefixMessage); - } - } + } finally { + message.release(); } } diff --git a/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageEncoder.java b/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageEncoder.java index 3b706fa6..51fdacf9 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageEncoder.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageEncoder.java @@ -5,15 +5,13 @@ import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToByteEncoder; import io.netty.util.IllegalReferenceCountException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; + +import java.io.IOException; public class GameServerMessageEncoder extends MessageToByteEncoder { - private static final Logger LOGGER = LoggerFactory.getLogger(GameServerMessageEncoder.class); - @Override - protected void encode(ChannelHandlerContext ctx, ServerMessage message, ByteBuf out) { + protected void encode(ChannelHandlerContext ctx, ServerMessage message, ByteBuf out) throws Exception { try { ByteBuf buf = message.get(); @@ -24,8 +22,7 @@ public class GameServerMessageEncoder extends MessageToByteEncoder Date: Sun, 10 May 2020 00:02:46 +0200 Subject: [PATCH 074/215] Fix more issues. --- .../habbohotel/commands/EventCommand.java | 16 +++++++++---- .../habbohotel/commands/MassBadgeCommand.java | 22 ++++++++++------- .../habbohotel/commands/MassGiftCommand.java | 24 ++++++++++++------- .../habbo/messages/rcon/ImageHotelAlert.java | 15 ++++++++---- .../threading/runnables/CannonKickAction.java | 20 ++++++++++------ 5 files changed, 62 insertions(+), 35 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/EventCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/EventCommand.java index 21d57835..270a3914 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/EventCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/EventCommand.java @@ -35,12 +35,18 @@ public class EventCommand extends Command { ServerMessage msg = new BubbleAlertComposer("hotel.event", codes).compose(); - for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { - Habbo habbo = set.getValue(); - if (habbo.getHabboStats().blockStaffAlerts) - continue; + msg.retain(); - habbo.getClient().sendResponse(msg); + try { + for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { + Habbo habbo = set.getValue(); + if (habbo.getHabboStats().blockStaffAlerts) + continue; + + habbo.getClient().sendResponse(msg); + } + } finally { + msg.release(); } return true; diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/MassBadgeCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/MassBadgeCommand.java index b584ee61..44cd3c15 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/MassBadgeCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/MassBadgeCommand.java @@ -32,21 +32,25 @@ public class MassBadgeCommand extends Command { keys.put("image", "${image.library.url}album1584/" + badge + ".gif"); keys.put("message", Emulator.getTexts().getValue("commands.generic.cmd_badge.received")); ServerMessage message = new BubbleAlertComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys).compose(); + message.retain(); + try { + for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { + Habbo habbo = set.getValue(); - for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { - Habbo habbo = set.getValue(); + if (habbo.isOnline()) { + if (habbo.getInventory() != null && habbo.getInventory().getBadgesComponent() != null && !habbo.getInventory().getBadgesComponent().hasBadge(badge)) { + HabboBadge b = BadgesComponent.createBadge(badge, habbo); - if (habbo.isOnline()) { - if (habbo.getInventory() != null && habbo.getInventory().getBadgesComponent() != null && !habbo.getInventory().getBadgesComponent().hasBadge(badge)) { - HabboBadge b = BadgesComponent.createBadge(badge, habbo); + if (b != null) { + habbo.getClient().sendResponse(new AddUserBadgeComposer(b)); - if (b != null) { - habbo.getClient().sendResponse(new AddUserBadgeComposer(b)); - - habbo.getClient().sendResponse(message); + habbo.getClient().sendResponse(message); + } } } } + } finally { + message.release(); } } return true; diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/MassGiftCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/MassGiftCommand.java index 1c1055b1..1610f7e9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/MassGiftCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/MassGiftCommand.java @@ -60,20 +60,26 @@ public class MassGiftCommand extends Command { ServerMessage giftNotificiationMessage = new BubbleAlertComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys).compose(); Emulator.getThreading().run(() -> { - for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { - Habbo habbo = set.getValue(); + giftNotificiationMessage.retain(); - HabboItem item = Emulator.getGameEnvironment().getItemManager().createItem(0, baseItem, 0, 0, ""); + try { + for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { + Habbo habbo = set.getValue(); - Item giftItem = Emulator.getGameEnvironment().getItemManager().getItem((Integer) Emulator.getGameEnvironment().getCatalogManager().giftFurnis.values().toArray()[Emulator.getRandom().nextInt(Emulator.getGameEnvironment().getCatalogManager().giftFurnis.size())]); + HabboItem item = Emulator.getGameEnvironment().getItemManager().createItem(0, baseItem, 0, 0, ""); - String extraData = "1\t" + item.getId(); - extraData += "\t0\t0\t0\t" + finalMessage + "\t0\t0"; + Item giftItem = Emulator.getGameEnvironment().getItemManager().getItem((Integer) Emulator.getGameEnvironment().getCatalogManager().giftFurnis.values().toArray()[Emulator.getRandom().nextInt(Emulator.getGameEnvironment().getCatalogManager().giftFurnis.size())]); - Emulator.getGameEnvironment().getItemManager().createGift(habbo.getHabboInfo().getUsername(), giftItem, extraData, 0, 0); + String extraData = "1\t" + item.getId(); + extraData += "\t0\t0\t0\t" + finalMessage + "\t0\t0"; - habbo.getClient().sendResponse(new InventoryRefreshComposer()); - habbo.getClient().sendResponse(giftNotificiationMessage); + Emulator.getGameEnvironment().getItemManager().createGift(habbo.getHabboInfo().getUsername(), giftItem, extraData, 0, 0); + + habbo.getClient().sendResponse(new InventoryRefreshComposer()); + habbo.getClient().sendResponse(giftNotificiationMessage); + } + } finally { + giftNotificiationMessage.release(); } }); diff --git a/src/main/java/com/eu/habbo/messages/rcon/ImageHotelAlert.java b/src/main/java/com/eu/habbo/messages/rcon/ImageHotelAlert.java index a2166745..8e162a41 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/ImageHotelAlert.java +++ b/src/main/java/com/eu/habbo/messages/rcon/ImageHotelAlert.java @@ -43,12 +43,17 @@ public class ImageHotelAlert extends RCONMessage { } ServerMessage message = new BubbleAlertComposer(json.bubble_key, keys).compose(); - for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { - Habbo habbo = set.getValue(); - if (habbo.getHabboStats().blockStaffAlerts) - continue; + message.retain(); + try { + for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { + Habbo habbo = set.getValue(); + if (habbo.getHabboStats().blockStaffAlerts) + continue; - habbo.getClient().sendResponse(message); + habbo.getClient().sendResponse(message); + } + } finally { + message.release(); } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/CannonKickAction.java b/src/main/java/com/eu/habbo/threading/runnables/CannonKickAction.java index 65eff558..e1666301 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/CannonKickAction.java +++ b/src/main/java/com/eu/habbo/threading/runnables/CannonKickAction.java @@ -33,18 +33,24 @@ public class CannonKickAction implements Runnable { dater.put("title", "${notification.room.kick.cannonball.title}"); dater.put("message", "${notification.room.kick.cannonball.message}"); - ServerMessage message = new BubbleAlertComposer("cannon.png", dater).compose(); - int rotation = this.cannon.getRotation(); List tiles = this.room.getLayout().getTilesInFront(this.room.getLayout().getTile(this.cannon.getX(), this.cannon.getY()), rotation + 6, 3); - for (RoomTile t : tiles) { - for (Habbo habbo : this.room.getHabbosAt(t.x, t.y)) { - if (!habbo.hasPermission(Permission.ACC_UNKICKABLE) && !this.room.isOwner(habbo)) { - Emulator.getGameEnvironment().getRoomManager().leaveRoom(habbo, this.room); - habbo.getClient().sendResponse(message); //kicked composer + ServerMessage message = new BubbleAlertComposer("cannon.png", dater).compose(); + + message.retain(); + + try { + for (RoomTile t : tiles) { + for (Habbo habbo : this.room.getHabbosAt(t.x, t.y)) { + if (!habbo.hasPermission(Permission.ACC_UNKICKABLE) && !this.room.isOwner(habbo)) { + Emulator.getGameEnvironment().getRoomManager().leaveRoom(habbo, this.room); + habbo.getClient().sendResponse(message); //kicked composer + } } } + } finally { + message.release(); } } } From 46ff22f720293720bba593426c8c9c86596a7e77 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Sun, 10 May 2020 00:11:56 +0200 Subject: [PATCH 075/215] Fix all last edge cases. --- .../commands/HotelAlertCommand.java | 17 ++- .../commands/ReloadRoomCommand.java | 9 +- .../gameclients/GameClientManager.java | 39 +++-- .../com/eu/habbo/habbohotel/rooms/Room.java | 136 ++++++++++-------- .../habbo/habbohotel/users/HabboManager.java | 11 +- .../FloorPlanEditorSaveEvent.java | 9 +- .../eu/habbo/messages/rcon/HotelAlert.java | 15 +- 7 files changed, 146 insertions(+), 90 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java index 6be973a9..0d5bfdd1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java @@ -24,15 +24,18 @@ public class HotelAlertCommand extends Command { } ServerMessage msg = new StaffAlertWithLinkComposer(message + "\r\n-" + gameClient.getHabbo().getHabboInfo().getUsername(), "").compose(); + msg.retain(); + try { + for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { + Habbo habbo = set.getValue(); + if (habbo.getHabboStats().blockStaffAlerts) + continue; - for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { - Habbo habbo = set.getValue(); - if (habbo.getHabboStats().blockStaffAlerts) - continue; - - habbo.getClient().sendResponse(msg); + habbo.getClient().sendResponse(msg); + } + } finally { + msg.release(); } - } else { gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_ha.forgot_message"), RoomChatMessageBubbles.ALERT); } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/ReloadRoomCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/ReloadRoomCommand.java index 1ccd20d0..42c11e50 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/ReloadRoomCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/ReloadRoomCommand.java @@ -24,8 +24,13 @@ public class ReloadRoomCommand extends Command { Emulator.getGameEnvironment().getRoomManager().unloadRoom(room); room = Emulator.getGameEnvironment().getRoomManager().loadRoom(room.getId()); ServerMessage message = new ForwardToRoomComposer(room.getId()).compose(); - for (Habbo habbo : habbos) { - habbo.getClient().sendResponse(message); + message.retain(); + try { + for (Habbo habbo : habbos) { + habbo.getClient().sendResponse(message); + } + } finally { + message.release(); } } }, 100); diff --git a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java index ad9b28ff..dfbb7273 100644 --- a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java @@ -134,32 +134,47 @@ public class GameClientManager { public void sendBroadcastResponse(ServerMessage message) { - for (GameClient client : this.clients.values()) { - client.sendResponse(message); + message.retain(); + try { + for (GameClient client : this.clients.values()) { + client.sendResponse(message); + } + } finally { + message.release(); } } public void sendBroadcastResponse(ServerMessage message, GameClient exclude) { - for (GameClient client : this.clients.values()) { - if (client.equals(exclude)) - continue; + message.retain(); + try { + for (GameClient client : this.clients.values()) { + if (client.equals(exclude)) + continue; - client.sendResponse(message); + client.sendResponse(message); + } + } finally { + message.release(); } } public void sendBroadcastResponse(ServerMessage message, String minPermission, GameClient exclude) { - for (GameClient client : this.clients.values()) { - if (client.equals(exclude)) - continue; + message.retain(); + try { + for (GameClient client : this.clients.values()) { + if (client.equals(exclude)) + continue; - if (client.getHabbo() != null) { - if (client.getHabbo().hasPermission(minPermission)) { - client.sendResponse(message); + if (client.getHabbo() != null) { + if (client.getHabbo().hasPermission(minPermission)) { + client.sendResponse(message); + } } } + } finally { + message.release(); } } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 85d108a3..ada54ce5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -3115,57 +3115,87 @@ public class Room implements Comparable, ISerialize, Runnable { roomChatMessage.setMessage(trimmedMessage); - if (chatType == RoomChatType.WHISPER) { - if (roomChatMessage.getTargetHabbo() == null) { - return; - } + if (prefixMessage != null) { + prefixMessage.retain(); + } - RoomChatMessage staffChatMessage = new RoomChatMessage(roomChatMessage); - staffChatMessage.setMessage("To " + staffChatMessage.getTargetHabbo().getHabboInfo().getUsername() + ": " + staffChatMessage.getMessage()); + if (clearPrefixMessage != null) { + clearPrefixMessage.retain(); + } - final ServerMessage message = new RoomUserWhisperComposer(roomChatMessage).compose(); - final ServerMessage staffMessage = new RoomUserWhisperComposer(staffChatMessage).compose(); + try { + if (chatType == RoomChatType.WHISPER) { + if (roomChatMessage.getTargetHabbo() == null) { + return; + } - message.retain(); - staffMessage.retain(); + RoomChatMessage staffChatMessage = new RoomChatMessage(roomChatMessage); + staffChatMessage.setMessage("To " + staffChatMessage.getTargetHabbo().getHabboInfo().getUsername() + ": " + staffChatMessage.getMessage()); - try { - for (Habbo h : this.getHabbos()) { - if (h == roomChatMessage.getTargetHabbo() || h == habbo) { - if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId())) { - if (prefixMessage != null) { - h.getClient().sendResponse(prefixMessage); + final ServerMessage message = new RoomUserWhisperComposer(roomChatMessage).compose(); + final ServerMessage staffMessage = new RoomUserWhisperComposer(staffChatMessage).compose(); + + message.retain(); + staffMessage.retain(); + + try { + for (Habbo h : this.getHabbos()) { + if (h == roomChatMessage.getTargetHabbo() || h == habbo) { + if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId())) { + if (prefixMessage != null) { + h.getClient().sendResponse(prefixMessage); + } + h.getClient().sendResponse(message); + + if (clearPrefixMessage != null) { + h.getClient().sendResponse(clearPrefixMessage); + } } - h.getClient().sendResponse(message); - if (clearPrefixMessage != null) { - h.getClient().sendResponse(clearPrefixMessage); + continue; + } + if (h.hasPermission("acc_see_whispers")) { + h.getClient().sendResponse(staffMessage); + } + } + } finally { + message.release(); + staffMessage.release(); + } + } else if (chatType == RoomChatType.TALK) { + ServerMessage message = new RoomUserTalkComposer(roomChatMessage).compose(); + boolean noChatLimit = habbo.hasPermission("acc_chat_no_limit"); + + message.retain(); + + try { + for (Habbo h : this.getHabbos()) { + if ((h.getRoomUnit().getCurrentLocation().distance(habbo.getRoomUnit().getCurrentLocation()) <= this.chatDistance || + h.equals(habbo) || + this.hasRights(h) || + noChatLimit) && (show == null || RoomLayout.tileInSquare(show, h.getRoomUnit().getCurrentLocation()))) { + if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId())) { + if (prefixMessage != null && !h.getHabboStats().preferOldChat) { + h.getClient().sendResponse(prefixMessage); + } + h.getClient().sendResponse(message); + if (clearPrefixMessage != null && !h.getHabboStats().preferOldChat) { + h.getClient().sendResponse(clearPrefixMessage); + } } } - - continue; - } - if (h.hasPermission("acc_see_whispers")) { - h.getClient().sendResponse(staffMessage); } + } finally { + message.release(); } - } finally { - message.release(); - staffMessage.release(); - } - } else if (chatType == RoomChatType.TALK) { - ServerMessage message = new RoomUserTalkComposer(roomChatMessage).compose(); - boolean noChatLimit = habbo.hasPermission("acc_chat_no_limit"); + } else if (chatType == RoomChatType.SHOUT) { + ServerMessage message = new RoomUserShoutComposer(roomChatMessage).compose(); - message.retain(); + message.retain(); - try { - for (Habbo h : this.getHabbos()) { - if ((h.getRoomUnit().getCurrentLocation().distance(habbo.getRoomUnit().getCurrentLocation()) <= this.chatDistance || - h.equals(habbo) || - this.hasRights(h) || - noChatLimit) && (show == null || RoomLayout.tileInSquare(show, h.getRoomUnit().getCurrentLocation()))) { - if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId())) { + try { + for (Habbo h : this.getHabbos()) { + if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId()) && (show == null || RoomLayout.tileInSquare(show, h.getRoomUnit().getCurrentLocation()))) { if (prefixMessage != null && !h.getHabboStats().preferOldChat) { h.getClient().sendResponse(prefixMessage); } @@ -3175,29 +3205,17 @@ public class Room implements Comparable, ISerialize, Runnable { } } } + } finally { + message.release(); } - } finally { - message.release(); } - } else if (chatType == RoomChatType.SHOUT) { - ServerMessage message = new RoomUserShoutComposer(roomChatMessage).compose(); + } finally { + if (prefixMessage != null) { + prefixMessage.release(); + } - message.retain(); - - try { - for (Habbo h : this.getHabbos()) { - if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId()) && (show == null || RoomLayout.tileInSquare(show, h.getRoomUnit().getCurrentLocation()))) { - if (prefixMessage != null && !h.getHabboStats().preferOldChat) { - h.getClient().sendResponse(prefixMessage); - } - h.getClient().sendResponse(message); - if (clearPrefixMessage != null && !h.getHabboStats().preferOldChat) { - h.getClient().sendResponse(clearPrefixMessage); - } - } - } - } finally { - message.release(); + if (clearPrefixMessage != null) { + clearPrefixMessage.release(); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java index 8975b888..f21e385f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java @@ -179,10 +179,15 @@ public class HabboManager { public void sendPacketToHabbosWithPermission(ServerMessage message, String perm) { synchronized (this.onlineHabbos) { - for (Habbo habbo : this.onlineHabbos.values()) { - if (habbo.hasPermission(perm)) { - habbo.getClient().sendResponse(message); + message.retain(); + try { + for (Habbo habbo : this.onlineHabbos.values()) { + if (habbo.hasPermission(perm)) { + habbo.getClient().sendResponse(message); + } } + } finally { + message.release(); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/floorplaneditor/FloorPlanEditorSaveEvent.java b/src/main/java/com/eu/habbo/messages/incoming/floorplaneditor/FloorPlanEditorSaveEvent.java index 113dd0e3..5f6279df 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/floorplaneditor/FloorPlanEditorSaveEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/floorplaneditor/FloorPlanEditorSaveEvent.java @@ -148,8 +148,13 @@ public class FloorPlanEditorSaveEvent extends MessageHandler { Emulator.getGameEnvironment().getRoomManager().unloadRoom(room); room = Emulator.getGameEnvironment().getRoomManager().loadRoom(room.getId()); ServerMessage message = new ForwardToRoomComposer(room.getId()).compose(); - for (Habbo habbo : habbos) { - habbo.getClient().sendResponse(message); + message.retain(); + try { + for (Habbo habbo : habbos) { + habbo.getClient().sendResponse(message); + } + } finally { + message.release(); } } } diff --git a/src/main/java/com/eu/habbo/messages/rcon/HotelAlert.java b/src/main/java/com/eu/habbo/messages/rcon/HotelAlert.java index 70989239..912c52e1 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/HotelAlert.java +++ b/src/main/java/com/eu/habbo/messages/rcon/HotelAlert.java @@ -25,12 +25,17 @@ public class HotelAlert extends RCONMessage { } if (serverMessage != null) { - for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { - Habbo habbo = set.getValue(); - if (habbo.getHabboStats().blockStaffAlerts) - continue; + serverMessage.retain(); + try { + for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { + Habbo habbo = set.getValue(); + if (habbo.getHabboStats().blockStaffAlerts) + continue; - habbo.getClient().sendResponse(serverMessage); + habbo.getClient().sendResponse(serverMessage); + } + } finally { + serverMessage.release(); } } } From ec3a7d8f5850515f5dd12ad59c8048fdcb6861f8 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Sun, 10 May 2020 01:04:26 +0200 Subject: [PATCH 076/215] Fix crash when bot message is empty, increase max packet length. --- src/main/java/com/eu/habbo/habbohotel/rooms/Room.java | 4 ++++ .../networking/gameserver/decoders/GameByteFrameDecoder.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index ada54ce5..83ba308a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -3809,6 +3809,10 @@ public class Room implements Comparable, ISerialize, Runnable { } public void botChat(ServerMessage message) { + if (message == null) { + return; + } + message.retain(); try { diff --git a/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameByteFrameDecoder.java b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameByteFrameDecoder.java index 82e60ed4..67778018 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameByteFrameDecoder.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameByteFrameDecoder.java @@ -6,7 +6,7 @@ import io.netty.handler.codec.LengthFieldBasedFrameDecoder; public class GameByteFrameDecoder extends LengthFieldBasedFrameDecoder { - private static final int MAX_PACKET_LENGTH = 8192 * 4; + private static final int MAX_PACKET_LENGTH = 8192 * 16; private static final int LENGTH_FIELD_OFFSET = 0; private static final int LENGTH_FIELD_LENGTH = 4; private static final int LENGTH_FIELD_ADJUSTMENT = 0; From 40818513aa8b3eb48e27710fc02543d06989c3f3 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Sun, 10 May 2020 19:18:39 +0200 Subject: [PATCH 077/215] Fix packet length. --- .../gameserver/decoders/GameByteFrameDecoder.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameByteFrameDecoder.java b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameByteFrameDecoder.java index 67778018..f902a3c6 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameByteFrameDecoder.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameByteFrameDecoder.java @@ -6,7 +6,13 @@ import io.netty.handler.codec.LengthFieldBasedFrameDecoder; public class GameByteFrameDecoder extends LengthFieldBasedFrameDecoder { - private static final int MAX_PACKET_LENGTH = 8192 * 16; + /** + * MAX_PACKET_LENGTH is based on the maximum camera PNG size. + * Source: https://superuser.com/a/759030 + * Maximum camera packet is 320 * 320 Pixel * 4 Bytes per Pixel = 409600. + * Adding some for overhead 409600 + 8192 = 417792 + */ + private static final int MAX_PACKET_LENGTH = 417792; private static final int LENGTH_FIELD_OFFSET = 0; private static final int LENGTH_FIELD_LENGTH = 4; private static final int LENGTH_FIELD_ADJUSTMENT = 0; From 492c8f61422af713994a02a8446d9bd10423438d Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Wed, 13 May 2020 20:55:07 +0200 Subject: [PATCH 078/215] Revert ServerMessage release/retain. --- .../habbohotel/commands/EventCommand.java | 16 +- .../commands/HotelAlertCommand.java | 16 +- .../habbohotel/commands/MassBadgeCommand.java | 22 +- .../habbohotel/commands/MassGiftCommand.java | 24 +- .../commands/ReloadRoomCommand.java | 9 +- .../habbohotel/gameclients/GameClient.java | 4 +- .../gameclients/GameClientManager.java | 39 +--- .../com/eu/habbo/habbohotel/rooms/Room.java | 214 +++++++----------- .../eu/habbo/habbohotel/rooms/RoomTrade.java | 13 +- .../habbo/habbohotel/users/HabboManager.java | 11 +- .../com/eu/habbo/messages/ServerMessage.java | 52 +---- .../FloorPlanEditorSaveEvent.java | 9 +- .../eu/habbo/messages/rcon/HotelAlert.java | 15 +- .../habbo/messages/rcon/ImageHotelAlert.java | 16 +- .../networking/gameserver/GameServer.java | 3 - .../decoders/GameMessageHandler.java | 9 +- .../encoders/GameServerMessageLogger.java | 2 +- .../threading/runnables/CannonKickAction.java | 16 +- 18 files changed, 148 insertions(+), 342 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/EventCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/EventCommand.java index 270a3914..21d57835 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/EventCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/EventCommand.java @@ -35,18 +35,12 @@ public class EventCommand extends Command { ServerMessage msg = new BubbleAlertComposer("hotel.event", codes).compose(); - msg.retain(); + for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { + Habbo habbo = set.getValue(); + if (habbo.getHabboStats().blockStaffAlerts) + continue; - try { - for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { - Habbo habbo = set.getValue(); - if (habbo.getHabboStats().blockStaffAlerts) - continue; - - habbo.getClient().sendResponse(msg); - } - } finally { - msg.release(); + habbo.getClient().sendResponse(msg); } return true; diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java index 0d5bfdd1..52a3d454 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java @@ -24,17 +24,13 @@ public class HotelAlertCommand extends Command { } ServerMessage msg = new StaffAlertWithLinkComposer(message + "\r\n-" + gameClient.getHabbo().getHabboInfo().getUsername(), "").compose(); - msg.retain(); - try { - for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { - Habbo habbo = set.getValue(); - if (habbo.getHabboStats().blockStaffAlerts) - continue; - habbo.getClient().sendResponse(msg); - } - } finally { - msg.release(); + for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { + Habbo habbo = set.getValue(); + if (habbo.getHabboStats().blockStaffAlerts) + continue; + + habbo.getClient().sendResponse(msg); } } else { gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_ha.forgot_message"), RoomChatMessageBubbles.ALERT); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/MassBadgeCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/MassBadgeCommand.java index 44cd3c15..b584ee61 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/MassBadgeCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/MassBadgeCommand.java @@ -32,25 +32,21 @@ public class MassBadgeCommand extends Command { keys.put("image", "${image.library.url}album1584/" + badge + ".gif"); keys.put("message", Emulator.getTexts().getValue("commands.generic.cmd_badge.received")); ServerMessage message = new BubbleAlertComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys).compose(); - message.retain(); - try { - for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { - Habbo habbo = set.getValue(); - if (habbo.isOnline()) { - if (habbo.getInventory() != null && habbo.getInventory().getBadgesComponent() != null && !habbo.getInventory().getBadgesComponent().hasBadge(badge)) { - HabboBadge b = BadgesComponent.createBadge(badge, habbo); + for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { + Habbo habbo = set.getValue(); - if (b != null) { - habbo.getClient().sendResponse(new AddUserBadgeComposer(b)); + if (habbo.isOnline()) { + if (habbo.getInventory() != null && habbo.getInventory().getBadgesComponent() != null && !habbo.getInventory().getBadgesComponent().hasBadge(badge)) { + HabboBadge b = BadgesComponent.createBadge(badge, habbo); - habbo.getClient().sendResponse(message); - } + if (b != null) { + habbo.getClient().sendResponse(new AddUserBadgeComposer(b)); + + habbo.getClient().sendResponse(message); } } } - } finally { - message.release(); } } return true; diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/MassGiftCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/MassGiftCommand.java index 1610f7e9..1c1055b1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/MassGiftCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/MassGiftCommand.java @@ -60,26 +60,20 @@ public class MassGiftCommand extends Command { ServerMessage giftNotificiationMessage = new BubbleAlertComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys).compose(); Emulator.getThreading().run(() -> { - giftNotificiationMessage.retain(); + for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { + Habbo habbo = set.getValue(); - try { - for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { - Habbo habbo = set.getValue(); + HabboItem item = Emulator.getGameEnvironment().getItemManager().createItem(0, baseItem, 0, 0, ""); - HabboItem item = Emulator.getGameEnvironment().getItemManager().createItem(0, baseItem, 0, 0, ""); + Item giftItem = Emulator.getGameEnvironment().getItemManager().getItem((Integer) Emulator.getGameEnvironment().getCatalogManager().giftFurnis.values().toArray()[Emulator.getRandom().nextInt(Emulator.getGameEnvironment().getCatalogManager().giftFurnis.size())]); - Item giftItem = Emulator.getGameEnvironment().getItemManager().getItem((Integer) Emulator.getGameEnvironment().getCatalogManager().giftFurnis.values().toArray()[Emulator.getRandom().nextInt(Emulator.getGameEnvironment().getCatalogManager().giftFurnis.size())]); + String extraData = "1\t" + item.getId(); + extraData += "\t0\t0\t0\t" + finalMessage + "\t0\t0"; - String extraData = "1\t" + item.getId(); - extraData += "\t0\t0\t0\t" + finalMessage + "\t0\t0"; + Emulator.getGameEnvironment().getItemManager().createGift(habbo.getHabboInfo().getUsername(), giftItem, extraData, 0, 0); - Emulator.getGameEnvironment().getItemManager().createGift(habbo.getHabboInfo().getUsername(), giftItem, extraData, 0, 0); - - habbo.getClient().sendResponse(new InventoryRefreshComposer()); - habbo.getClient().sendResponse(giftNotificiationMessage); - } - } finally { - giftNotificiationMessage.release(); + habbo.getClient().sendResponse(new InventoryRefreshComposer()); + habbo.getClient().sendResponse(giftNotificiationMessage); } }); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/ReloadRoomCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/ReloadRoomCommand.java index 42c11e50..1ccd20d0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/ReloadRoomCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/ReloadRoomCommand.java @@ -24,13 +24,8 @@ public class ReloadRoomCommand extends Command { Emulator.getGameEnvironment().getRoomManager().unloadRoom(room); room = Emulator.getGameEnvironment().getRoomManager().loadRoom(room.getId()); ServerMessage message = new ForwardToRoomComposer(room.getId()).compose(); - message.retain(); - try { - for (Habbo habbo : habbos) { - habbo.getClient().sendResponse(message); - } - } finally { - message.release(); + for (Habbo habbo : habbos) { + habbo.getClient().sendResponse(message); } } }, 100); diff --git a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java index 4242467d..9f871543 100644 --- a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java +++ b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java @@ -96,7 +96,7 @@ public class GameClient { return; } - this.channel.write(response.retain(), this.channel.voidPromise()); + this.channel.write(response, this.channel.voidPromise()); this.channel.flush(); } } @@ -108,7 +108,7 @@ public class GameClient { return; } - this.channel.write(response.retain()); + this.channel.write(response); } this.channel.flush(); diff --git a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java index dfbb7273..ad9b28ff 100644 --- a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java @@ -134,47 +134,32 @@ public class GameClientManager { public void sendBroadcastResponse(ServerMessage message) { - message.retain(); - try { - for (GameClient client : this.clients.values()) { - client.sendResponse(message); - } - } finally { - message.release(); + for (GameClient client : this.clients.values()) { + client.sendResponse(message); } } public void sendBroadcastResponse(ServerMessage message, GameClient exclude) { - message.retain(); - try { - for (GameClient client : this.clients.values()) { - if (client.equals(exclude)) - continue; + for (GameClient client : this.clients.values()) { + if (client.equals(exclude)) + continue; - client.sendResponse(message); - } - } finally { - message.release(); + client.sendResponse(message); } } public void sendBroadcastResponse(ServerMessage message, String minPermission, GameClient exclude) { - message.retain(); - try { - for (GameClient client : this.clients.values()) { - if (client.equals(exclude)) - continue; + for (GameClient client : this.clients.values()) { + if (client.equals(exclude)) + continue; - if (client.getHabbo() != null) { - if (client.getHabbo().hasPermission(minPermission)) { - client.sendResponse(message); - } + if (client.getHabbo() != null) { + if (client.getHabbo().hasPermission(minPermission)) { + client.sendResponse(message); } } - } finally { - message.release(); } } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 83ba308a..483744f3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -3115,107 +3115,69 @@ public class Room implements Comparable, ISerialize, Runnable { roomChatMessage.setMessage(trimmedMessage); - if (prefixMessage != null) { - prefixMessage.retain(); - } - - if (clearPrefixMessage != null) { - clearPrefixMessage.retain(); - } - - try { - if (chatType == RoomChatType.WHISPER) { - if (roomChatMessage.getTargetHabbo() == null) { - return; - } - - RoomChatMessage staffChatMessage = new RoomChatMessage(roomChatMessage); - staffChatMessage.setMessage("To " + staffChatMessage.getTargetHabbo().getHabboInfo().getUsername() + ": " + staffChatMessage.getMessage()); - - final ServerMessage message = new RoomUserWhisperComposer(roomChatMessage).compose(); - final ServerMessage staffMessage = new RoomUserWhisperComposer(staffChatMessage).compose(); - - message.retain(); - staffMessage.retain(); - - try { - for (Habbo h : this.getHabbos()) { - if (h == roomChatMessage.getTargetHabbo() || h == habbo) { - if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId())) { - if (prefixMessage != null) { - h.getClient().sendResponse(prefixMessage); - } - h.getClient().sendResponse(message); - - if (clearPrefixMessage != null) { - h.getClient().sendResponse(clearPrefixMessage); - } - } - - continue; - } - if (h.hasPermission("acc_see_whispers")) { - h.getClient().sendResponse(staffMessage); - } - } - } finally { - message.release(); - staffMessage.release(); - } - } else if (chatType == RoomChatType.TALK) { - ServerMessage message = new RoomUserTalkComposer(roomChatMessage).compose(); - boolean noChatLimit = habbo.hasPermission("acc_chat_no_limit"); - - message.retain(); - - try { - for (Habbo h : this.getHabbos()) { - if ((h.getRoomUnit().getCurrentLocation().distance(habbo.getRoomUnit().getCurrentLocation()) <= this.chatDistance || - h.equals(habbo) || - this.hasRights(h) || - noChatLimit) && (show == null || RoomLayout.tileInSquare(show, h.getRoomUnit().getCurrentLocation()))) { - if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId())) { - if (prefixMessage != null && !h.getHabboStats().preferOldChat) { - h.getClient().sendResponse(prefixMessage); - } - h.getClient().sendResponse(message); - if (clearPrefixMessage != null && !h.getHabboStats().preferOldChat) { - h.getClient().sendResponse(clearPrefixMessage); - } - } - } - } - } finally { - message.release(); - } - } else if (chatType == RoomChatType.SHOUT) { - ServerMessage message = new RoomUserShoutComposer(roomChatMessage).compose(); - - message.retain(); - - try { - for (Habbo h : this.getHabbos()) { - if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId()) && (show == null || RoomLayout.tileInSquare(show, h.getRoomUnit().getCurrentLocation()))) { - if (prefixMessage != null && !h.getHabboStats().preferOldChat) { - h.getClient().sendResponse(prefixMessage); - } - h.getClient().sendResponse(message); - if (clearPrefixMessage != null && !h.getHabboStats().preferOldChat) { - h.getClient().sendResponse(clearPrefixMessage); - } - } - } - } finally { - message.release(); - } - } - } finally { - if (prefixMessage != null) { - prefixMessage.release(); + if (chatType == RoomChatType.WHISPER) { + if (roomChatMessage.getTargetHabbo() == null) { + return; } - if (clearPrefixMessage != null) { - clearPrefixMessage.release(); + RoomChatMessage staffChatMessage = new RoomChatMessage(roomChatMessage); + staffChatMessage.setMessage("To " + staffChatMessage.getTargetHabbo().getHabboInfo().getUsername() + ": " + staffChatMessage.getMessage()); + + final ServerMessage message = new RoomUserWhisperComposer(roomChatMessage).compose(); + final ServerMessage staffMessage = new RoomUserWhisperComposer(staffChatMessage).compose(); + + for (Habbo h : this.getHabbos()) { + if (h == roomChatMessage.getTargetHabbo() || h == habbo) { + if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId())) { + if (prefixMessage != null) { + h.getClient().sendResponse(prefixMessage); + } + h.getClient().sendResponse(message); + + if (clearPrefixMessage != null) { + h.getClient().sendResponse(clearPrefixMessage); + } + } + + continue; + } + if (h.hasPermission("acc_see_whispers")) { + h.getClient().sendResponse(staffMessage); + } + } + } else if (chatType == RoomChatType.TALK) { + ServerMessage message = new RoomUserTalkComposer(roomChatMessage).compose(); + boolean noChatLimit = habbo.hasPermission("acc_chat_no_limit"); + + for (Habbo h : this.getHabbos()) { + if ((h.getRoomUnit().getCurrentLocation().distance(habbo.getRoomUnit().getCurrentLocation()) <= this.chatDistance || + h.equals(habbo) || + this.hasRights(h) || + noChatLimit) && (show == null || RoomLayout.tileInSquare(show, h.getRoomUnit().getCurrentLocation()))) { + if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId())) { + if (prefixMessage != null && !h.getHabboStats().preferOldChat) { + h.getClient().sendResponse(prefixMessage); + } + h.getClient().sendResponse(message); + if (clearPrefixMessage != null && !h.getHabboStats().preferOldChat) { + h.getClient().sendResponse(clearPrefixMessage); + } + } + } + } + } else if (chatType == RoomChatType.SHOUT) { + ServerMessage message = new RoomUserShoutComposer(roomChatMessage).compose(); + + for (Habbo h : this.getHabbos()) { + if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId()) && (show == null || RoomLayout.tileInSquare(show, h.getRoomUnit().getCurrentLocation()))) { + if (prefixMessage != null && !h.getHabboStats().preferOldChat) { + h.getClient().sendResponse(prefixMessage); + } + h.getClient().sendResponse(message); + if (clearPrefixMessage != null && !h.getHabboStats().preferOldChat) { + h.getClient().sendResponse(clearPrefixMessage); + } + } } } @@ -3765,46 +3727,28 @@ public class Room implements Comparable, ISerialize, Runnable { } public void sendComposer(ServerMessage message) { - message.retain(); - - try { - for (Habbo habbo : this.getHabbos()) { - if (habbo.getClient() == null) { - this.removeHabbo(habbo, true); - continue; - } - - habbo.getClient().sendResponse(message); + for (Habbo habbo : this.getHabbos()) { + if (habbo.getClient() == null) { + this.removeHabbo(habbo, true); + continue; } - } finally { - message.release(); + + habbo.getClient().sendResponse(message); } } public void sendComposerToHabbosWithRights(ServerMessage message) { - message.retain(); - - try { - for (Habbo habbo : this.getHabbos()) { - if (this.hasRights(habbo)) { - habbo.getClient().sendResponse(message); - } + for (Habbo habbo : this.getHabbos()) { + if (this.hasRights(habbo)) { + habbo.getClient().sendResponse(message); } - } finally { - message.release(); } } public void petChat(ServerMessage message) { - message.retain(); - - try { - for (Habbo habbo : this.getHabbos()) { - if (!habbo.getHabboStats().ignorePets) - habbo.getClient().sendResponse(message); - } - } finally { - message.release(); + for (Habbo habbo : this.getHabbos()) { + if (!habbo.getHabboStats().ignorePets) + habbo.getClient().sendResponse(message); } } @@ -3813,15 +3757,9 @@ public class Room implements Comparable, ISerialize, Runnable { return; } - message.retain(); - - try { - for (Habbo habbo : this.getHabbos()) { - if (!habbo.getHabboStats().ignoreBots) - habbo.getClient().sendResponse(message); - } - } finally { - message.release(); + for (Habbo habbo : this.getHabbos()) { + if (!habbo.getHabboStats().ignoreBots) + habbo.getClient().sendResponse(message); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java index 3a443447..c6ba64e0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java @@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.rooms; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; -import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.inventory.AddHabboItemComposer; import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer; @@ -311,16 +310,8 @@ public class RoomTrade { } public void sendMessageToUsers(MessageComposer message) { - ServerMessage messageComposed = message.compose(); - - messageComposed.retain(); - - try { - for (RoomTradeUser roomTradeUser : this.users) { - roomTradeUser.getHabbo().getClient().sendResponse(message); - } - } finally { - messageComposed.release(); + for (RoomTradeUser roomTradeUser : this.users) { + roomTradeUser.getHabbo().getClient().sendResponse(message); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java index f21e385f..8975b888 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java @@ -179,15 +179,10 @@ public class HabboManager { public void sendPacketToHabbosWithPermission(ServerMessage message, String perm) { synchronized (this.onlineHabbos) { - message.retain(); - try { - for (Habbo habbo : this.onlineHabbos.values()) { - if (habbo.hasPermission(perm)) { - habbo.getClient().sendResponse(message); - } + for (Habbo habbo : this.onlineHabbos.values()) { + if (habbo.hasPermission(perm)) { + habbo.getClient().sendResponse(message); } - } finally { - message.release(); } } } diff --git a/src/main/java/com/eu/habbo/messages/ServerMessage.java b/src/main/java/com/eu/habbo/messages/ServerMessage.java index 7a7e7c4f..8754ce5c 100644 --- a/src/main/java/com/eu/habbo/messages/ServerMessage.java +++ b/src/main/java/com/eu/habbo/messages/ServerMessage.java @@ -4,15 +4,13 @@ import com.eu.habbo.util.PacketUtils; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufOutputStream; import io.netty.buffer.Unpooled; -import io.netty.util.IllegalReferenceCountException; -import io.netty.util.ReferenceCounted; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.concurrent.atomic.AtomicInteger; -public class ServerMessage implements ReferenceCounted { +public class ServerMessage { private static final Logger LOGGER = LoggerFactory.getLogger(ServerMessage.class); private boolean initialized; @@ -35,6 +33,7 @@ public class ServerMessage implements ReferenceCounted { throw new ServerMessageException("ServerMessage was already initialized."); } + this.initialized = true; this.header = id; this.refs = new AtomicInteger(0); this.channelBuffer = Unpooled.buffer(); @@ -186,51 +185,4 @@ public class ServerMessage implements ReferenceCounted { return this.channelBuffer.copy(); } - @Override - public int refCnt() { - return this.refs.get(); - } - - @Override - public ReferenceCounted retain() { - this.refs.incrementAndGet(); - return this; - } - - @Override - public ReferenceCounted retain(int i) { - this.refs.addAndGet(i); - return this; - } - - @Override - public ReferenceCounted touch() { - return this; - } - - @Override - public ReferenceCounted touch(Object o) { - return this; - } - - @Override - public boolean release() { - return this.release(1); - } - - @Override - public boolean release(int i) { - int value = this.refs.addAndGet(-i); - if (value < 0) { - throw new IllegalReferenceCountException("Decremented below 0 (packet " + this.header + " value " + value + ")."); - } - - if (value == 0) { - this.channelBuffer.release(this.channelBuffer.refCnt()); - return true; - } - - return false; - } - } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/incoming/floorplaneditor/FloorPlanEditorSaveEvent.java b/src/main/java/com/eu/habbo/messages/incoming/floorplaneditor/FloorPlanEditorSaveEvent.java index 5f6279df..113dd0e3 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/floorplaneditor/FloorPlanEditorSaveEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/floorplaneditor/FloorPlanEditorSaveEvent.java @@ -148,13 +148,8 @@ public class FloorPlanEditorSaveEvent extends MessageHandler { Emulator.getGameEnvironment().getRoomManager().unloadRoom(room); room = Emulator.getGameEnvironment().getRoomManager().loadRoom(room.getId()); ServerMessage message = new ForwardToRoomComposer(room.getId()).compose(); - message.retain(); - try { - for (Habbo habbo : habbos) { - habbo.getClient().sendResponse(message); - } - } finally { - message.release(); + for (Habbo habbo : habbos) { + habbo.getClient().sendResponse(message); } } } diff --git a/src/main/java/com/eu/habbo/messages/rcon/HotelAlert.java b/src/main/java/com/eu/habbo/messages/rcon/HotelAlert.java index 912c52e1..70989239 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/HotelAlert.java +++ b/src/main/java/com/eu/habbo/messages/rcon/HotelAlert.java @@ -25,17 +25,12 @@ public class HotelAlert extends RCONMessage { } if (serverMessage != null) { - serverMessage.retain(); - try { - for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { - Habbo habbo = set.getValue(); - if (habbo.getHabboStats().blockStaffAlerts) - continue; + for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { + Habbo habbo = set.getValue(); + if (habbo.getHabboStats().blockStaffAlerts) + continue; - habbo.getClient().sendResponse(serverMessage); - } - } finally { - serverMessage.release(); + habbo.getClient().sendResponse(serverMessage); } } } diff --git a/src/main/java/com/eu/habbo/messages/rcon/ImageHotelAlert.java b/src/main/java/com/eu/habbo/messages/rcon/ImageHotelAlert.java index 8e162a41..d392a6b2 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/ImageHotelAlert.java +++ b/src/main/java/com/eu/habbo/messages/rcon/ImageHotelAlert.java @@ -43,17 +43,13 @@ public class ImageHotelAlert extends RCONMessage { } ServerMessage message = new BubbleAlertComposer(json.bubble_key, keys).compose(); - message.retain(); - try { - for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { - Habbo habbo = set.getValue(); - if (habbo.getHabboStats().blockStaffAlerts) - continue; - habbo.getClient().sendResponse(message); - } - } finally { - message.release(); + for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { + Habbo habbo = set.getValue(); + if (habbo.getHabboStats().blockStaffAlerts) + continue; + + habbo.getClient().sendResponse(message); } } diff --git a/src/main/java/com/eu/habbo/networking/gameserver/GameServer.java b/src/main/java/com/eu/habbo/networking/gameserver/GameServer.java index bbd2f4bf..90514484 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/GameServer.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/GameServer.java @@ -30,9 +30,6 @@ public class GameServer extends Server { public void initChannel(SocketChannel ch) throws Exception { ch.pipeline().addLast("logger", new LoggingHandler()); - // Logger. - - // Decoders. ch.pipeline().addLast(new GamePolicyDecoder()); ch.pipeline().addLast(new GameByteFrameDecoder()); diff --git a/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageHandler.java b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageHandler.java index a0ba3112..2da3032e 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageHandler.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameMessageHandler.java @@ -63,14 +63,7 @@ public class GameMessageHandler extends ChannelInboundHandlerAdapter { if (cause instanceof TooLongFrameException) { LOGGER.error("Disconnecting client, reason: \"" + cause.getMessage() + "\"."); } else { - cause.printStackTrace(); - - LOGGER.error("Disconnecting client, exception in GameMessageHander:"); - LOGGER.error(cause.toString()); - - for (StackTraceElement element : cause.getStackTrace()) { - LOGGER.error(element.toString()); - } + LOGGER.error("Disconnecting client, exception in GameMessageHander.", cause); } ctx.channel().close(); diff --git a/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java b/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java index a21edde9..fd351942 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/encoders/GameServerMessageLogger.java @@ -27,7 +27,7 @@ public class GameServerMessageLogger extends MessageToMessageEncoder Date: Fri, 15 May 2020 17:11:40 -0400 Subject: [PATCH 079/215] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b6468486..8a4a8145 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,8 @@ When making an bug report or a feature request use the template we provide so th - Skeletor - z - ArpyAge +- Mike + ## Discord ## Join us on Discord at https://discord.gg/BzfFsTp From c92b9ecea36e4d3253a6143cdf05f868b22f7a03 Mon Sep 17 00:00:00 2001 From: Swirny <140-Swirny@users.noreply.git.krews.org> Date: Sat, 16 May 2020 10:21:22 -0400 Subject: [PATCH 080/215] Added SQL file for 2.4.0 RC-2 --- sqlupdates/sqlupdates/2.4.0 RC-1 to 2.4.0 RC-2.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 sqlupdates/sqlupdates/2.4.0 RC-1 to 2.4.0 RC-2.sql diff --git a/sqlupdates/sqlupdates/2.4.0 RC-1 to 2.4.0 RC-2.sql b/sqlupdates/sqlupdates/2.4.0 RC-1 to 2.4.0 RC-2.sql new file mode 100644 index 00000000..e69de29b From 5ec38a5efe5ed2a5fa8f185de9d43b2ac240d103 Mon Sep 17 00:00:00 2001 From: Swirny <140-Swirny@users.noreply.git.krews.org> Date: Sat, 16 May 2020 10:21:45 -0400 Subject: [PATCH 081/215] Update 2.4.0 RC-1 to 2.4.0 RC-2.sql --- sqlupdates/{sqlupdates => }/2.4.0 RC-1 to 2.4.0 RC-2.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sqlupdates/{sqlupdates => }/2.4.0 RC-1 to 2.4.0 RC-2.sql (100%) diff --git a/sqlupdates/sqlupdates/2.4.0 RC-1 to 2.4.0 RC-2.sql b/sqlupdates/2.4.0 RC-1 to 2.4.0 RC-2.sql similarity index 100% rename from sqlupdates/sqlupdates/2.4.0 RC-1 to 2.4.0 RC-2.sql rename to sqlupdates/2.4.0 RC-1 to 2.4.0 RC-2.sql From c6df972265090a70947e0d7b00725c946754971f Mon Sep 17 00:00:00 2001 From: Swirny <140-Swirny@users.noreply.git.krews.org> Date: Sat, 16 May 2020 10:22:21 -0400 Subject: [PATCH 082/215] Update 2.4.0 RC-1 to 2.4.0 RC-2.sql --- ...{2.4.0 RC-1 to 2.4.0 RC-2.sql => 2_4_0 RC-1 to 2_4_0 RC-2.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sqlupdates/{2.4.0 RC-1 to 2.4.0 RC-2.sql => 2_4_0 RC-1 to 2_4_0 RC-2.sql} (100%) diff --git a/sqlupdates/2.4.0 RC-1 to 2.4.0 RC-2.sql b/sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql similarity index 100% rename from sqlupdates/2.4.0 RC-1 to 2.4.0 RC-2.sql rename to sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql From 57d489b83b45cc1a39e3baffcb6ead6f12834c50 Mon Sep 17 00:00:00 2001 From: Swirny <140-Swirny@users.noreply.git.krews.org> Date: Sat, 16 May 2020 10:28:58 -0400 Subject: [PATCH 083/215] Update 2_4_0 RC-1 to 2_4_0 RC-2.sql --- sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql b/sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql index e69de29b..95f8436b 100644 --- a/sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql +++ b/sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql @@ -0,0 +1 @@ +/* SQLS HERE */ \ No newline at end of file From 04e2e7847db24bd4bc7710c2e5cc64cdbb2fc879 Mon Sep 17 00:00:00 2001 From: xjoao Date: Fri, 22 May 2020 13:23:35 -0400 Subject: [PATCH 084/215] Update exception --- src/main/java/com/eu/habbo/habbohotel/games/Game.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/games/Game.java b/src/main/java/com/eu/habbo/habbohotel/games/Game.java index f8aa6c37..6bff094a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/Game.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/Game.java @@ -74,7 +74,7 @@ public abstract class Game implements Runnable { habbo.getClient().sendResponse(new GuideSessionPartnerIsPlayingComposer(true)); return true; } - } catch (Exception e) { + } catch (NoSuchMethodException | SecurityException e) { LOGGER.error("Caught exception", e); } From c46d12f87ce9e9071cddeb37b367c4fab3dce583 Mon Sep 17 00:00:00 2001 From: xjoao Date: Fri, 22 May 2020 13:34:01 -0400 Subject: [PATCH 085/215] Update exception --- .../java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java index 5107be53..eff68a99 100644 --- a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java +++ b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java @@ -73,7 +73,7 @@ public class ForumThread implements Runnable, ISerialize { try { this.lastComment = ForumThreadComment.getById(set.getInt("last_comment_id")); - } catch (Exception e) { + } catch (SQLException e)) { } this.comments = new THashMap<>(); From d766818ef2f029824547601a5c67bc980257c52b Mon Sep 17 00:00:00 2001 From: xjoao Date: Fri, 22 May 2020 13:38:33 -0400 Subject: [PATCH 086/215] Update exception --- src/main/java/com/eu/habbo/habbohotel/items/Item.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/Item.java b/src/main/java/com/eu/habbo/habbohotel/items/Item.java index caf8932a..eb7316ff 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/Item.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/Item.java @@ -54,7 +54,7 @@ public class Item { try { int index = Integer.valueOf(item.getExtradata()) % (item.getBaseItem().getMultiHeights().length); return item.getBaseItem().getMultiHeights()[(item.getExtradata().isEmpty() ? 0 : index)]; - } catch (Exception e) { + } catch (NumberFormatException e) { } } From f3042b6b4569de8c787533b0bf5ea35114510ff5 Mon Sep 17 00:00:00 2001 From: xjoao Date: Fri, 22 May 2020 13:58:45 -0400 Subject: [PATCH 087/215] Update close for try witch resources --- .../habbohotel/items/YoutubeManager.java | 52 +++++++++---------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/YoutubeManager.java b/src/main/java/com/eu/habbo/habbohotel/items/YoutubeManager.java index d2f3d3bf..3be71726 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/YoutubeManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/YoutubeManager.java @@ -133,37 +133,35 @@ public class YoutubeManager { InputStream is = conn.getInputStream(); InputStreamReader isr = new InputStreamReader(is); - BufferedReader br = new BufferedReader(isr); - - YoutubePlaylist playlist = null; - - String inputLine; - while ((inputLine = br.readLine()) != null) { - if (inputLine.contains("window[\"ytInitialData\"]")) { - JsonObject obj = new JsonParser().parse(inputLine.substring(inputLine.indexOf("{")).replace(";", "")).getAsJsonObject(); - - JsonObject meta = obj.get("microformat").getAsJsonObject().get("microformatDataRenderer").getAsJsonObject(); - String name = meta.get("title").getAsString(); - String description = meta.get("description").getAsString(); - - ArrayList videos = new ArrayList<>(); - - JsonArray rawVideos = obj.get("contents").getAsJsonObject().get("twoColumnBrowseResultsRenderer").getAsJsonObject().get("tabs").getAsJsonArray().get(0).getAsJsonObject().get("tabRenderer").getAsJsonObject().get("content").getAsJsonObject().get("sectionListRenderer").getAsJsonObject().get("contents").getAsJsonArray().get(0).getAsJsonObject().get("itemSectionRenderer").getAsJsonObject().get("contents").getAsJsonArray().get(0).getAsJsonObject().get("playlistVideoListRenderer").getAsJsonObject().get("contents").getAsJsonArray(); - - for (JsonElement rawVideo : rawVideos) { - JsonObject videoData = rawVideo.getAsJsonObject().get("playlistVideoRenderer").getAsJsonObject(); - if (!videoData.has("lengthSeconds")) continue; // removed videos - videos.add(new YoutubeVideo(videoData.get("videoId").getAsString(), Integer.valueOf(videoData.get("lengthSeconds").getAsString()))); + YoutubePlaylist playlist; + try (BufferedReader br = new BufferedReader(isr)) { + playlist = null; + String inputLine; + while ((inputLine = br.readLine()) != null) { + if (inputLine.contains("window[\"ytInitialData\"]")) { + JsonObject obj = new JsonParser().parse(inputLine.substring(inputLine.indexOf("{")).replace(";", "")).getAsJsonObject(); + + JsonObject meta = obj.get("microformat").getAsJsonObject().get("microformatDataRenderer").getAsJsonObject(); + String name = meta.get("title").getAsString(); + String description = meta.get("description").getAsString(); + + ArrayList videos = new ArrayList<>(); + + JsonArray rawVideos = obj.get("contents").getAsJsonObject().get("twoColumnBrowseResultsRenderer").getAsJsonObject().get("tabs").getAsJsonArray().get(0).getAsJsonObject().get("tabRenderer").getAsJsonObject().get("content").getAsJsonObject().get("sectionListRenderer").getAsJsonObject().get("contents").getAsJsonArray().get(0).getAsJsonObject().get("itemSectionRenderer").getAsJsonObject().get("contents").getAsJsonArray().get(0).getAsJsonObject().get("playlistVideoListRenderer").getAsJsonObject().get("contents").getAsJsonArray(); + + for (JsonElement rawVideo : rawVideos) { + JsonObject videoData = rawVideo.getAsJsonObject().get("playlistVideoRenderer").getAsJsonObject(); + if (!videoData.has("lengthSeconds")) continue; // removed videos + videos.add(new YoutubeVideo(videoData.get("videoId").getAsString(), Integer.valueOf(videoData.get("lengthSeconds").getAsString()))); + } + + playlist = new YoutubePlaylist(playlistId, name, description, videos); + + break; } - - playlist = new YoutubePlaylist(playlistId, name, description, videos); - - break; } } - br.close(); - this.playlistCache.put(playlistId, playlist); return playlist; From f9a76c8fc6b397cd5de297683d07df43877badc0 Mon Sep 17 00:00:00 2001 From: Swirny Date: Sun, 24 May 2020 11:27:56 +0200 Subject: [PATCH 088/215] Adjusted marketplace search --- .../eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java index f18ad446..4fd9f853 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java @@ -114,7 +114,7 @@ public class MarketPlace { public static List getOffers(int minPrice, int maxPrice, String search, int sort) { List offers = new ArrayList<>(10); - String query = "SELECT B.* FROM marketplace_items a INNER JOIN (SELECT b.item_id AS base_item_id, b.limited_data AS ltd_data, marketplace_items.*, AVG(price) as avg, MIN(marketplace_items.price) as minPrice, MAX(marketplace_items.price) as maxPrice, COUNT(*) as number, (SELECT COUNT(*) FROM marketplace_items c INNER JOIN items as items_b ON c.item_id = items_b.id WHERE state = 2 AND items_b.item_id = base_item_id AND DATE(from_unixtime(sold_timestamp)) = CURDATE()) as sold_count_today FROM marketplace_items INNER JOIN items b ON marketplace_items.item_id = b.id INNER JOIN items_base bi ON b.item_id = bi.id WHERE price = (SELECT MIN(e.price) FROM marketplace_items e, items d WHERE e.item_id = d.id AND d.item_id = b.item_id AND e.state = 1 AND e.timestamp > ? GROUP BY d.item_id) AND state = 1 AND timestamp > ?"; + String query = "SELECT B.* FROM marketplace_items a INNER JOIN (SELECT b.item_id AS base_item_id, b.limited_data AS ltd_data, marketplace_items.*, AVG(price) as avg, MIN(marketplace_items.price) as minPrice, MAX(marketplace_items.price) as maxPrice, COUNT(*) as number, (SELECT COUNT(*) FROM marketplace_items c INNER JOIN items as items_b ON c.item_id = items_b.id WHERE state = 2 AND items_b.item_id = base_item_id AND DATE(from_unixtime(sold_timestamp)) = CURDATE()) as sold_count_today FROM marketplace_items INNER JOIN items b ON marketplace_items.item_id = b.id INNER JOIN items_base bi ON b.item_id = bi.id INNER JOIN catalog_items ci ON items_base.id = ci.item_ids WHERE price = (SELECT MIN(e.price) FROM marketplace_items e, items d WHERE e.item_id = d.id AND d.item_id = b.item_id AND e.state = 1 AND e.timestamp > ? GROUP BY d.item_id) AND state = 1 AND timestamp > ?"; if (minPrice > 0) { query += " AND CEIL(price + (price / 100)) >= " + minPrice; } @@ -122,7 +122,7 @@ public class MarketPlace { query += " AND CEIL(price + (price / 100)) <= " + maxPrice; } if (search.length() > 0) { - query += " AND bi.public_name LIKE ?"; + query += " AND bi.public_name LIKE ? OR ci.catalog_name LIKE ?"; } query += " GROUP BY base_item_id, ltd_data"; @@ -160,6 +160,7 @@ public class MarketPlace { statement.setInt(2, Emulator.getIntUnixTimestamp() - 172800); if (search.length() > 0) statement.setString(3, "%" + search + "%"); + statement.setString(4, "%" + search + "%"); try (ResultSet set = statement.executeQuery()) { while (set.next()) { From 6ebfc66cdabff4875dd830ee37960db4e7c5089d Mon Sep 17 00:00:00 2001 From: xjoao Date: Sun, 24 May 2020 12:50:42 -0400 Subject: [PATCH 089/215] optimized statement --- .../incoming/modtool/ModToolChangeRoomSettingsEvent.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/ModToolChangeRoomSettingsEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/ModToolChangeRoomSettingsEvent.java index 2a325246..a84022df 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/ModToolChangeRoomSettingsEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/ModToolChangeRoomSettingsEvent.java @@ -13,9 +13,9 @@ public class ModToolChangeRoomSettingsEvent extends MessageHandler { Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.packet.readInt()); if (room != null) { - boolean lockDoor = this.packet.readInt() == 1; - boolean changeTitle = this.packet.readInt() == 1; - boolean kickUsers = this.packet.readInt() == 1; + final boolean lockDoor = this.packet.readInt() == 1; + final boolean changeTitle = this.packet.readInt() == 1; + final boolean kickUsers = this.packet.readInt() == 1; Emulator.getGameEnvironment().getModToolManager().roomAction(room, this.client.getHabbo(), kickUsers, lockDoor, changeTitle); } From c9d2f4653507dcbf012a8139a61d7852299a1992 Mon Sep 17 00:00:00 2001 From: xjoao Date: Sun, 24 May 2020 15:44:43 -0400 Subject: [PATCH 090/215] updated exception --- src/main/java/com/eu/habbo/networking/Server.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/networking/Server.java b/src/main/java/com/eu/habbo/networking/Server.java index 800529c1..8590e074 100644 --- a/src/main/java/com/eu/habbo/networking/Server.java +++ b/src/main/java/com/eu/habbo/networking/Server.java @@ -67,7 +67,7 @@ public abstract class Server { try { this.workerGroup.shutdownGracefully(0, 0, TimeUnit.MILLISECONDS).sync(); this.bossGroup.shutdownGracefully(0, 0, TimeUnit.MILLISECONDS).sync(); - } catch (Exception e) { + } catch catch (InterruptedException e) { LOGGER.error("Exception during {} shutdown... HARD STOP", this.name, e); } LOGGER.info("GameServer Stopped!"); From b0aa1996e3e73b433db0b86cb79dc4058c3a243e Mon Sep 17 00:00:00 2001 From: xjoao Date: Sun, 24 May 2020 16:33:48 -0400 Subject: [PATCH 091/215] Apply suggestion to src/main/java/com/eu/habbo/networking/Server.java --- src/main/java/com/eu/habbo/networking/Server.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/networking/Server.java b/src/main/java/com/eu/habbo/networking/Server.java index 8590e074..3b6d17f8 100644 --- a/src/main/java/com/eu/habbo/networking/Server.java +++ b/src/main/java/com/eu/habbo/networking/Server.java @@ -67,7 +67,7 @@ public abstract class Server { try { this.workerGroup.shutdownGracefully(0, 0, TimeUnit.MILLISECONDS).sync(); this.bossGroup.shutdownGracefully(0, 0, TimeUnit.MILLISECONDS).sync(); - } catch catch (InterruptedException e) { + } catch(InterruptedException e) { LOGGER.error("Exception during {} shutdown... HARD STOP", this.name, e); } LOGGER.info("GameServer Stopped!"); From 9e1177cb078306f6404ed020c45cea8ae98c976f Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Thu, 28 May 2020 22:21:31 +0200 Subject: [PATCH 092/215] Fixes MachineID sometimes not unique #620. --- .../habbohotel/gameclients/GameClient.java | 11 +---------- .../incoming/handshake/MachineIDEvent.java | 18 +++++++++++++++--- .../outgoing/handshake/MachineIDComposer.java | 11 ++++++----- src/main/java/com/eu/habbo/util/HexUtils.java | 14 ++++++++++++++ 4 files changed, 36 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java index 9f871543..a05ef0a0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java +++ b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java @@ -73,17 +73,8 @@ public class GameClient { if (machineId == null) { throw new RuntimeException("Cannot set machineID to NULL"); } - this.machineId = machineId; - if (this.habbo != null) { - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users SET machine_id = ? WHERE id = ? LIMIT 1")) { - statement.setString(1, this.machineId); - statement.setInt(2, this.habbo.getHabboInfo().getId()); - statement.execute(); - } catch (SQLException e) { - LOGGER.error("Caught SQL exception", e); - } - } + this.machineId = machineId; } public void sendResponse(MessageComposer composer) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/MachineIDEvent.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/MachineIDEvent.java index 7be07c04..9949ffa5 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/handshake/MachineIDEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/handshake/MachineIDEvent.java @@ -3,14 +3,26 @@ package com.eu.habbo.messages.incoming.handshake; import com.eu.habbo.messages.NoAuthMessage; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.handshake.MachineIDComposer; +import com.eu.habbo.util.HexUtils; @NoAuthMessage public class MachineIDEvent extends MessageHandler { + private static final int HASH_LENGTH = 64; + @Override public void handle() throws Exception { - String unknown = this.packet.readString(); - this.client.setMachineId(this.packet.readString()); - this.client.sendResponse(new MachineIDComposer(this.client)); + String storedMachineId = this.packet.readString(); + String clientFingerprint = this.packet.readString(); + String capabilities = this.packet.readString(); + + // Update stored machine id if it doesn't match our requirements. + if (storedMachineId.startsWith("~") || storedMachineId.length() != HASH_LENGTH) { + storedMachineId = HexUtils.getRandom(HASH_LENGTH); + this.client.sendResponse(new MachineIDComposer(storedMachineId)); + } + + this.client.setMachineId(storedMachineId); } + } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/handshake/MachineIDComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/handshake/MachineIDComposer.java index 3e5736b2..f96abff6 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/handshake/MachineIDComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/handshake/MachineIDComposer.java @@ -1,21 +1,22 @@ package com.eu.habbo.messages.outgoing.handshake; -import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.Outgoing; public class MachineIDComposer extends MessageComposer { - private final GameClient client; - public MachineIDComposer(GameClient client) { - this.client = client; + private final String machineId; + + public MachineIDComposer(String machineId) { + this.machineId = machineId; } @Override protected ServerMessage composeInternal() { this.response.init(Outgoing.MachineIDComposer); - this.response.appendString(this.client.getMachineId()); + this.response.appendString(this.machineId); return this.response; } + } diff --git a/src/main/java/com/eu/habbo/util/HexUtils.java b/src/main/java/com/eu/habbo/util/HexUtils.java index 82ad1990..2e5bccb4 100644 --- a/src/main/java/com/eu/habbo/util/HexUtils.java +++ b/src/main/java/com/eu/habbo/util/HexUtils.java @@ -1,5 +1,8 @@ package com.eu.habbo.util; +import java.util.Random; +import java.util.concurrent.ThreadLocalRandom; + public class HexUtils { private static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray(); @@ -24,4 +27,15 @@ public class HexUtils { return data; } + public static String getRandom(int length){ + Random r = ThreadLocalRandom.current(); + StringBuilder sb = new StringBuilder(); + + while(sb.length() < length){ + sb.append(Integer.toHexString(r.nextInt())); + } + + return sb.toString().substring(0, length); + } + } From 5157e12d2793a27543816a454fe3b3adada194a5 Mon Sep 17 00:00:00 2001 From: Swirny <140-Swirny@users.noreply.git.krews.org> Date: Fri, 29 May 2020 19:43:30 -0400 Subject: [PATCH 093/215] Resolve "Public Room Sorting" --- sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql | 0 src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql diff --git a/sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql b/sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql new file mode 100644 index 00000000..e69de29b diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java index 75249798..59dc8999 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java @@ -992,7 +992,7 @@ public class RoomManager { rooms.add(room); } } - + rooms.sort(Room.SORT_ID); return rooms; } From 3feea72105dee96e44727ef588d698e96a4a6ea2 Mon Sep 17 00:00:00 2001 From: xjoao Date: Fri, 29 May 2020 22:25:23 -0400 Subject: [PATCH 094/215] @override added --- src/main/java/com/eu/habbo/messages/ClientMessage.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/messages/ClientMessage.java b/src/main/java/com/eu/habbo/messages/ClientMessage.java index a5185cb9..55fdae44 100644 --- a/src/main/java/com/eu/habbo/messages/ClientMessage.java +++ b/src/main/java/com/eu/habbo/messages/ClientMessage.java @@ -20,7 +20,14 @@ public class ClientMessage { public int getMessageId() { return this.header; } - + + + /** + * + * @return + * @throws CloneNotSupportedException + */ + @Override public ClientMessage clone() throws CloneNotSupportedException { return new ClientMessage(this.header, this.buffer.duplicate()); } From bb2c3a270d9a9d32e9359eb4eee9b17aff0803dc Mon Sep 17 00:00:00 2001 From: xjoao Date: Fri, 29 May 2020 22:28:00 -0400 Subject: [PATCH 095/215] updated exception --- src/main/java/com/eu/habbo/messages/PacketManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/messages/PacketManager.java b/src/main/java/com/eu/habbo/messages/PacketManager.java index 54ad2f77..36c6e2c9 100644 --- a/src/main/java/com/eu/habbo/messages/PacketManager.java +++ b/src/main/java/com/eu/habbo/messages/PacketManager.java @@ -129,7 +129,7 @@ public class PacketManager { for (String s : Emulator.getConfig().getValue("debug.show.headers").split(";")) { try { logList.add(Integer.valueOf(s)); - } catch (Exception e) { + } catch (NumberFormatException e) { } } From f45844ef656b37abb1ef01560702f2993e9d3318 Mon Sep 17 00:00:00 2001 From: xjoao Date: Fri, 29 May 2020 22:29:14 -0400 Subject: [PATCH 096/215] updated exception --- src/main/java/com/eu/habbo/messages/ServerMessage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/messages/ServerMessage.java b/src/main/java/com/eu/habbo/messages/ServerMessage.java index 8754ce5c..91f52457 100644 --- a/src/main/java/com/eu/habbo/messages/ServerMessage.java +++ b/src/main/java/com/eu/habbo/messages/ServerMessage.java @@ -42,7 +42,7 @@ public class ServerMessage { try { this.stream.writeInt(0); this.stream.writeShort(id); - } catch (Exception e) { + } catch (IOException e) { throw new ServerMessageException(e); } From 41f1bf465ef0c8bb5d773d4b54331677a1a329f1 Mon Sep 17 00:00:00 2001 From: harmonic Date: Sun, 31 May 2020 19:10:49 +0100 Subject: [PATCH 097/215] Start 2.4.0 rc-2 --- src/main/java/com/eu/habbo/Emulator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/Emulator.java b/src/main/java/com/eu/habbo/Emulator.java index e5ca801e..540c70c7 100644 --- a/src/main/java/com/eu/habbo/Emulator.java +++ b/src/main/java/com/eu/habbo/Emulator.java @@ -39,8 +39,8 @@ public final class Emulator { public final static int MINOR = 4; public final static int BUILD = 0; - // This Build of 2.4.0 will not be released anytime soon. :) - public final static String PREVIEW = "RC-1"; + // Rick and Morty Edition + public final static String PREVIEW = "RC-2"; public static final String version = "Arcturus Morningstar" + " " + MAJOR + "." + MINOR + "." + BUILD + "-" + PREVIEW; private static final String logo = From 00f36170f16e77946a792f232ea99364c6c793d0 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Tue, 2 Jun 2020 11:35:46 +0200 Subject: [PATCH 098/215] Resolve syntax issues caused by xjoao. --- src/main/java/com/eu/habbo/habbohotel/games/Game.java | 2 +- .../com/eu/habbo/habbohotel/guilds/forums/ForumThread.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/games/Game.java b/src/main/java/com/eu/habbo/habbohotel/games/Game.java index 6bff094a..f8aa6c37 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/Game.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/Game.java @@ -74,7 +74,7 @@ public abstract class Game implements Runnable { habbo.getClient().sendResponse(new GuideSessionPartnerIsPlayingComposer(true)); return true; } - } catch (NoSuchMethodException | SecurityException e) { + } catch (Exception e) { LOGGER.error("Caught exception", e); } diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java index eff68a99..f4325c0d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java +++ b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java @@ -73,7 +73,8 @@ public class ForumThread implements Runnable, ISerialize { try { this.lastComment = ForumThreadComment.getById(set.getInt("last_comment_id")); - } catch (SQLException e)) { + } catch (SQLException e) { + LOGGER.error("ForumThread last_comment_id exception", e); } this.comments = new THashMap<>(); From 34e7239ac40473d73895d634a23e2f8423c452af Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Wed, 3 Jun 2020 02:30:32 +0200 Subject: [PATCH 099/215] Fixes #610 - negative flood time --- .../com/eu/habbo/habbohotel/rooms/RoomChatMessage.java | 7 ++++++- src/main/java/com/eu/habbo/habbohotel/users/Habbo.java | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java index 0063a0d5..22a8b662 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java @@ -216,7 +216,12 @@ public class RoomChatMessage implements Runnable, ISerialize, DatabaseLoggable { return; } } else { - this.habbo.mute(Emulator.getConfig().getInt("hotel.wordfilter.automute"), false); + int muteTime = Emulator.getConfig().getInt("hotel.wordfilter.automute"); + if (muteTime > 0) { + this.habbo.mute(muteTime, false); + } else { + LOGGER.error("Invalid hotel.wordfilter.automute defined in emulator_settings ({}).", muteTime); + } } this.message = ""; diff --git a/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java b/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java index 242bdd02..af87ae9d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java @@ -384,6 +384,11 @@ public class Habbo implements Runnable { } public void mute(int seconds, boolean isFlood) { + if (seconds <= 0) { + LOGGER.warn("Tried to mute user for {} seconds, which is invalid.", seconds); + return; + } + if (!this.hasPermission("acc_no_mute")) { int remaining = this.habboStats.addMuteTime(seconds); this.client.sendResponse(new FloodCounterComposer(remaining)); From 93922dcd49995b48dda3dc6448e0e19f2595a557 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Wed, 3 Jun 2020 02:42:38 +0200 Subject: [PATCH 100/215] Fixes #621 - acc_hide_mail --- sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql | 2 +- .../java/com/eu/habbo/habbohotel/commands/UserInfoCommand.java | 2 +- .../java/com/eu/habbo/habbohotel/permissions/Permission.java | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql b/sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql index 95f8436b..c323751f 100644 --- a/sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql +++ b/sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql @@ -1 +1 @@ -/* SQLS HERE */ \ No newline at end of file +ALTER TABLE `permissions` ADD `acc_hide_mail` ENUM('0', '1') NOT NULL DEFAULT '0' AFTER `acc_hide_ip`; \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UserInfoCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/UserInfoCommand.java index 88d25872..c0402ee3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UserInfoCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/UserInfoCommand.java @@ -42,7 +42,7 @@ public class UserInfoCommand extends Command { Emulator.getTexts().getValue("command.cmd_userinfo.motto") + ": " + habbo.getMotto().replace("<", "[").replace(">", "]") + "\r" + Emulator.getTexts().getValue("command.cmd_userinfo.rank") + ": " + habbo.getRank().getName() + " (" + habbo.getRank().getId() + ") \r" + Emulator.getTexts().getValue("command.cmd_userinfo.online") + ": " + (onlineHabbo == null ? Emulator.getTexts().getValue("generic.no") : Emulator.getTexts().getValue("generic.yes")) + "\r" + - Emulator.getTexts().getValue("command.cmd_userinfo.email") + ": " + habbo.getMail() + "\r" + + ((habbo.getRank().hasPermission("acc_hide_mail", true)) ? "" : Emulator.getTexts().getValue("command.cmd_userinfo.email") + ": " + habbo.getMail() + "\r") + ((habbo.getRank().hasPermission("acc_hide_ip", true)) ? "" : Emulator.getTexts().getValue("command.cmd_userinfo.ip_register") + ": " + habbo.getIpRegister() + "\r") + ((habbo.getRank().hasPermission("acc_hide_ip", true)) || onlineHabbo == null ? "" : Emulator.getTexts().getValue("command.cmd_userinfo.ip_current") + ": " + onlineHabbo.getClient().getChannel().remoteAddress().toString() + "\r") + (onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.achievement_score") + ": " + onlineHabbo.getHabboStats().achievementScore + "\r" : "")); diff --git a/src/main/java/com/eu/habbo/habbohotel/permissions/Permission.java b/src/main/java/com/eu/habbo/habbohotel/permissions/Permission.java index a41fd11a..ace827af 100644 --- a/src/main/java/com/eu/habbo/habbohotel/permissions/Permission.java +++ b/src/main/java/com/eu/habbo/habbohotel/permissions/Permission.java @@ -15,6 +15,7 @@ public class Permission { public static String ACC_UNLIMITED_BOTS = "acc_unlimited_bots"; public static String ACC_UNLIMITED_PETS = "acc_unlimited_pets"; public static String ACC_HIDE_IP = "acc_hide_ip"; + public static String ACC_HIDE_MAIL = "acc_hide_mail"; public static String ACC_NOT_MIMICED = "acc_not_mimiced"; public static String ACC_CHAT_NO_FLOOD = "acc_chat_no_flood"; public static String ACC_STAFF_CHAT = "acc_staff_chat"; From 462592f2171b231c172bf00abd300499e3c67df9 Mon Sep 17 00:00:00 2001 From: Swirny <140-Swirny@users.noreply.git.krews.org> Date: Sat, 16 May 2020 05:22:22 -0400 Subject: [PATCH 101/215] Fixed flood with rights --- .../com/eu/habbo/habbohotel/rooms/Room.java | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 483744f3..dc3af8b5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -1202,15 +1202,26 @@ public class Room implements Comparable, ISerialize, Runnable { { habbo.getHabboStats().chatCounter--; - if (habbo.getHabboStats().chatCounter > 3 && !this.hasRights(habbo)) { - if (this.chatProtection == 0) { - this.floodMuteHabbo(habbo, 30); - } else if (this.chatProtection == 1 && habbo.getHabboStats().chatCounter > 4) { - this.floodMuteHabbo(habbo, 30); - } else if (this.chatProtection == 2 && habbo.getHabboStats().chatCounter > 5) { - this.floodMuteHabbo(habbo, 30); + if (Emulator.getConfig().getBoolean("flood.with.rights")) { + if (habbo.getHabboStats().chatCounter > 3 && !this.hasRights(habbo)) { + if (this.chatProtection == 0) { + this.floodMuteHabbo(habbo, 30); + } else if (this.chatProtection == 1 && habbo.getHabboStats().chatCounter > 4) { + this.floodMuteHabbo(habbo, 30); + } else if (this.chatProtection == 2 && habbo.getHabboStats().chatCounter > 5) { + this.floodMuteHabbo(habbo, 30); + } } } + else if (habbo.getHabboStats().chatCounter > 3 && this.hasRights(habbo)) { + if (this.chatProtection == 0) { + this.floodMuteHabbo(habbo, 30); + } else if (this.chatProtection == 1 && habbo.getHabboStats().chatCounter > 4) { + this.floodMuteHabbo(habbo, 30); + } else if (this.chatProtection == 2 && habbo.getHabboStats().chatCounter > 5) { + this.floodMuteHabbo(habbo, 30); + } + } } else { habbo.getHabboStats().chatCounter = 0; From caf0bcb41f5669a8f76900d0997502ad83f76a39 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Wed, 3 Jun 2020 02:53:10 +0200 Subject: [PATCH 102/215] Add SQL and fix code --- sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql | 1 - sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql | 3 +++ .../java/com/eu/habbo/habbohotel/rooms/Room.java | 15 ++++++++------- 3 files changed, 11 insertions(+), 8 deletions(-) delete mode 100644 sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql create mode 100644 sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql diff --git a/sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql b/sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql deleted file mode 100644 index c323751f..00000000 --- a/sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `permissions` ADD `acc_hide_mail` ENUM('0', '1') NOT NULL DEFAULT '0' AFTER `acc_hide_ip`; \ No newline at end of file diff --git a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql new file mode 100644 index 00000000..cb3bef84 --- /dev/null +++ b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql @@ -0,0 +1,3 @@ +ALTER TABLE `permissions` ADD `acc_hide_mail` ENUM('0', '1') NOT NULL DEFAULT '0' AFTER `acc_hide_ip`; + +INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('flood.with.rights', '0'); \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index dc3af8b5..e752e85e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -1214,13 +1214,14 @@ public class Room implements Comparable, ISerialize, Runnable { } } else if (habbo.getHabboStats().chatCounter > 3 && this.hasRights(habbo)) { - if (this.chatProtection == 0) { - this.floodMuteHabbo(habbo, 30); - } else if (this.chatProtection == 1 && habbo.getHabboStats().chatCounter > 4) { - this.floodMuteHabbo(habbo, 30); - } else if (this.chatProtection == 2 && habbo.getHabboStats().chatCounter > 5) { - this.floodMuteHabbo(habbo, 30); - } + if (this.chatProtection == 0) { + this.floodMuteHabbo(habbo, 30); + } else if (this.chatProtection == 1 && habbo.getHabboStats().chatCounter > 4) { + this.floodMuteHabbo(habbo, 30); + } else if (this.chatProtection == 2 && habbo.getHabboStats().chatCounter > 5) { + this.floodMuteHabbo(habbo, 30); + } + } } } else { From dd98c3072a08704c0156c1eeacd7dcca29771380 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Wed, 3 Jun 2020 03:04:05 +0200 Subject: [PATCH 103/215] Remove duplicate code, simplify logic --- .../com/eu/habbo/habbohotel/rooms/Room.java | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index e752e85e..10484daf 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -1202,8 +1202,11 @@ public class Room implements Comparable, ISerialize, Runnable { { habbo.getHabboStats().chatCounter--; - if (Emulator.getConfig().getBoolean("flood.with.rights")) { - if (habbo.getHabboStats().chatCounter > 3 && !this.hasRights(habbo)) { + if (habbo.getHabboStats().chatCounter > 3) { + final boolean floodRights = Emulator.getConfig().getBoolean("flood.with.rights"); + final boolean hasRights = this.hasRights(habbo); + + if (floodRights || !hasRights) { if (this.chatProtection == 0) { this.floodMuteHabbo(habbo, 30); } else if (this.chatProtection == 1 && habbo.getHabboStats().chatCounter > 4) { @@ -1213,16 +1216,6 @@ public class Room implements Comparable, ISerialize, Runnable { } } } - else if (habbo.getHabboStats().chatCounter > 3 && this.hasRights(habbo)) { - if (this.chatProtection == 0) { - this.floodMuteHabbo(habbo, 30); - } else if (this.chatProtection == 1 && habbo.getHabboStats().chatCounter > 4) { - this.floodMuteHabbo(habbo, 30); - } else if (this.chatProtection == 2 && habbo.getHabboStats().chatCounter > 5) { - this.floodMuteHabbo(habbo, 30); - } - } - } } else { habbo.getHabboStats().chatCounter = 0; From e2013c8451e0df5dd399e25ccf9570a826972fc5 Mon Sep 17 00:00:00 2001 From: Swirny Date: Sat, 16 May 2020 15:35:20 +0200 Subject: [PATCH 104/215] Added official moderation command softkick --- sqlupdates/2_3_1_TO_2_4_0-RC-1.sql | 4 +++ .../habbohotel/commands/CommandHandler.java | 1 + .../habbohotel/commands/SoftKickCommand.java | 25 +++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 src/main/java/com/eu/habbo/habbohotel/commands/SoftKickCommand.java diff --git a/sqlupdates/2_3_1_TO_2_4_0-RC-1.sql b/sqlupdates/2_3_1_TO_2_4_0-RC-1.sql index 5cebe121..24f16927 100644 --- a/sqlupdates/2_3_1_TO_2_4_0-RC-1.sql +++ b/sqlupdates/2_3_1_TO_2_4_0-RC-1.sql @@ -1,3 +1,7 @@ INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.room.stickies.max', '200'); INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('retro.style.homeroom', '1'); + +ALTER TABLE `permissions` ADD `cmd_softkick` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_kickall`; + +INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.keys.cmd_softkick', 'softkick'); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/CommandHandler.java b/src/main/java/com/eu/habbo/habbohotel/commands/CommandHandler.java index a8e550a1..33974e59 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/CommandHandler.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/CommandHandler.java @@ -284,6 +284,7 @@ public class CommandHandler { addCommand(new WordQuizCommand()); addCommand(new UpdateYoutubePlaylistsCommand()); addCommand(new AddYoutubePlaylistCommand()); + addCommand(new SoftKickCommand()); addCommand(new TestCommand()); } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/SoftKickCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/SoftKickCommand.java new file mode 100644 index 00000000..7323e0dc --- /dev/null +++ b/src/main/java/com/eu/habbo/habbohotel/commands/SoftKickCommand.java @@ -0,0 +1,25 @@ +package com.eu.habbo.habbohotel.commands; + +import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.gameclients.GameClient; +import com.eu.habbo.habbohotel.permissions.Permission; +import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.habbohotel.users.Habbo; + +public class SoftKickCommand extends Command { + public SoftKickCommand() { + super("cmd_softkick", Emulator.getTexts().getValue("commands.keys.cmd_softkick").split(";")); + } + + @Override + public boolean handle(GameClient gameClient, String[] params) throws Exception { + final Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom(); + + for (Habbo habbo : room.getHabbos()) { + if (!(habbo.hasPermission(Permission.ACC_UNKICKABLE) || habbo.hasPermission(Permission.ACC_SUPPORTTOOL) || room.isOwner(habbo))) { + room.kickHabbo(habbo, false); + } + } + return true; + } +} From 25c9f887189ea6e663434ab1e789923a737596f4 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Wed, 3 Jun 2020 03:15:09 +0200 Subject: [PATCH 105/215] Changes by Swirny, squashed to make merging easier --- sqlupdates/2_3_1_TO_2_4_0-RC-1.sql | 6 +----- sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql | 4 ++++ .../habbohotel/commands/SoftKickCommand.java | 20 ++++++++++++++----- 3 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql diff --git a/sqlupdates/2_3_1_TO_2_4_0-RC-1.sql b/sqlupdates/2_3_1_TO_2_4_0-RC-1.sql index 24f16927..3e2d7895 100644 --- a/sqlupdates/2_3_1_TO_2_4_0-RC-1.sql +++ b/sqlupdates/2_3_1_TO_2_4_0-RC-1.sql @@ -1,7 +1,3 @@ INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.room.stickies.max', '200'); -INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('retro.style.homeroom', '1'); - -ALTER TABLE `permissions` ADD `cmd_softkick` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `cmd_kickall`; - -INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.keys.cmd_softkick', 'softkick'); +INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('retro.style.homeroom', '1'); \ No newline at end of file diff --git a/sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql b/sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql new file mode 100644 index 00000000..77f75ee3 --- /dev/null +++ b/sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql @@ -0,0 +1,4 @@ +ALTER TABLE `permissions` ADD `cmd_softkick` ENUM('0', '1') NOT NULL DEFAULT '0' AFTER `cmd_kickall`; +INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.keys.cmd_softkick', 'softkick'); +INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_softkick_not_found', '%user% not found'); +INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_softkick_error_self', 'You can not softkick yourself!'); \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/SoftKickCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/SoftKickCommand.java index 7323e0dc..8f9eb699 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/SoftKickCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/SoftKickCommand.java @@ -4,6 +4,7 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; public class SoftKickCommand extends Command { @@ -13,13 +14,22 @@ public class SoftKickCommand extends Command { @Override public boolean handle(GameClient gameClient, String[] params) throws Exception { - final Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom(); + if (params.length == 2) { + Habbo habbo = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(params[1]); - for (Habbo habbo : room.getHabbos()) { - if (!(habbo.hasPermission(Permission.ACC_UNKICKABLE) || habbo.hasPermission(Permission.ACC_SUPPORTTOOL) || room.isOwner(habbo))) { - room.kickHabbo(habbo, false); - } + if (habbo == null) { + gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.keys.cmd_softkick_error").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT); + return true; } + else if (habbo == gameClient.getHabbo()) { + gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.keys.cmd_softkick_error_self"), RoomChatMessageBubbles.ALERT); + return true; + } + else { + final Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom(); + room.kickHabbo(habbo, false); + } + } return true; } } From f5dd2088097145e15a71deb54dba49c1a72bd0b0 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Wed, 3 Jun 2020 03:17:32 +0200 Subject: [PATCH 106/215] Move SQL to correct file --- sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql | 4 ---- sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql | 10 +++++++++- 2 files changed, 9 insertions(+), 5 deletions(-) delete mode 100644 sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql diff --git a/sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql b/sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql deleted file mode 100644 index 77f75ee3..00000000 --- a/sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql +++ /dev/null @@ -1,4 +0,0 @@ -ALTER TABLE `permissions` ADD `cmd_softkick` ENUM('0', '1') NOT NULL DEFAULT '0' AFTER `cmd_kickall`; -INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.keys.cmd_softkick', 'softkick'); -INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_softkick_not_found', '%user% not found'); -INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_softkick_error_self', 'You can not softkick yourself!'); \ No newline at end of file diff --git a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql index cb3bef84..e44e9474 100644 --- a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql +++ b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql @@ -1,3 +1,11 @@ +-- Hide email from specific ranks. ALTER TABLE `permissions` ADD `acc_hide_mail` ENUM('0', '1') NOT NULL DEFAULT '0' AFTER `acc_hide_ip`; -INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('flood.with.rights', '0'); \ No newline at end of file +-- Flood with rights. +INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('flood.with.rights', '0'); + +-- Softkick command. +ALTER TABLE `permissions` ADD `cmd_softkick` ENUM('0', '1') NOT NULL DEFAULT '0' AFTER `cmd_kickall`; +INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.keys.cmd_softkick', 'softkick'); +INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_softkick_not_found', '%user% not found'); +INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_softkick_error_self', 'You can not softkick yourself!'); \ No newline at end of file From e4e8b5fe6f4eccc05074597efb829d07b4420d9d Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Wed, 3 Jun 2020 03:25:06 +0200 Subject: [PATCH 107/215] Improve code --- sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql | 2 +- .../habbohotel/commands/SoftKickCommand.java | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql index e44e9474..2f68174f 100644 --- a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql +++ b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql @@ -5,7 +5,7 @@ ALTER TABLE `permissions` ADD `acc_hide_mail` ENUM('0', '1') NOT NULL DEFAULT '0 INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('flood.with.rights', '0'); -- Softkick command. -ALTER TABLE `permissions` ADD `cmd_softkick` ENUM('0', '1') NOT NULL DEFAULT '0' AFTER `cmd_kickall`; +ALTER TABLE `permissions` ADD `cmd_softkick` ENUM('0', '1') NOT NULL DEFAULT '0' AFTER `cmd_kickall`; INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.keys.cmd_softkick', 'softkick'); INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_softkick_not_found', '%user% not found'); INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_softkick_error_self', 'You can not softkick yourself!'); \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/SoftKickCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/SoftKickCommand.java index 8f9eb699..c89ab075 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/SoftKickCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/SoftKickCommand.java @@ -2,7 +2,6 @@ package com.eu.habbo.habbohotel.commands; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; @@ -15,18 +14,22 @@ public class SoftKickCommand extends Command { @Override public boolean handle(GameClient gameClient, String[] params) throws Exception { if (params.length == 2) { - Habbo habbo = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(params[1]); + final String username = params[1]; + final Habbo habbo = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(username); if (habbo == null) { - gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.keys.cmd_softkick_error").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT); + gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.keys.cmd_softkick_error").replace("%user%", username), RoomChatMessageBubbles.ALERT); return true; } - else if (habbo == gameClient.getHabbo()) { + + if (habbo == gameClient.getHabbo()) { gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.keys.cmd_softkick_error_self"), RoomChatMessageBubbles.ALERT); return true; } - else { - final Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom(); + + final Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom(); + + if (room != null) { room.kickHabbo(habbo, false); } } From 1afca5c0a0acc52df891e07ae5422c552ff77301 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Wed, 3 Jun 2020 03:53:28 +0200 Subject: [PATCH 108/215] Fixes #624 - Wrong online_time counting --- .../java/com/eu/habbo/habbohotel/users/HabboStats.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java index 9b71194b..0b7797b6 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; public class HabboStats implements Runnable { @@ -34,7 +35,7 @@ public class HabboStats implements Runnable { public final THashMap cache; public final TIntArrayList calendarRewardsClaimed; public final TIntObjectMap offerCache = new TIntObjectHashMap<>(); - private final int timeLoggedIn = Emulator.getIntUnixTimestamp(); + private final AtomicInteger lastOnlineTime = new AtomicInteger(Emulator.getIntUnixTimestamp()); private final THashMap achievementProgress; private final THashMap achievementCache; private final THashMap recentPurchases; @@ -299,6 +300,10 @@ public class HabboStats implements Runnable { @Override public void run() { + // Find difference between last sync and update with a new timestamp. + int onlineTimeLast = this.lastOnlineTime.getAndUpdate(operand -> Emulator.getIntUnixTimestamp()); + int onlineTime = Emulator.getIntUnixTimestamp() - onlineTimeLast; + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) { try (PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET achievement_score = ?, respects_received = ?, respects_given = ?, daily_respect_points = ?, block_following = ?, block_friendrequests = ?, online_time = online_time + ?, guild_id = ?, daily_pet_respect_points = ?, club_expire_timestamp = ?, login_streak = ?, rent_space_id = ?, rent_space_endtime = ?, volume_system = ?, volume_furni = ?, volume_trax = ?, block_roominvites = ?, old_chat = ?, block_camera_follow = ?, chat_color = ?, hof_points = ?, block_alerts = ?, talent_track_citizenship_level = ?, talent_track_helpers_level = ?, ignore_bots = ?, ignore_pets = ?, nux = ?, mute_end_timestamp = ?, allow_name_change = ?, perk_trade = ?, can_trade = ?, `forums_post_count` = ?, ui_flags = ?, has_gotten_default_saved_searches = ? WHERE user_id = ? LIMIT 1")) { statement.setInt(1, this.achievementScore); @@ -307,7 +312,7 @@ public class HabboStats implements Runnable { statement.setInt(4, this.respectPointsToGive); statement.setString(5, this.blockFollowing ? "1" : "0"); statement.setString(6, this.blockFriendRequests ? "1" : "0"); - statement.setInt(7, Emulator.getIntUnixTimestamp() - this.timeLoggedIn); + statement.setInt(7, onlineTime); statement.setInt(8, this.guild); statement.setInt(9, this.petRespectPointsToGive); statement.setInt(10, this.clubExpireTimestamp); From 60a63e48323f11da8feaa8f0e9b37c919fabe5e3 Mon Sep 17 00:00:00 2001 From: Swirny Date: Tue, 19 May 2020 14:26:45 +0200 Subject: [PATCH 109/215] User can no longer ignore staffs --- sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql | 6 ++++- .../eu/habbo/habbohotel/users/HabboStats.java | 27 ++++++++++++------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql index 2f68174f..86864df5 100644 --- a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql +++ b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql @@ -8,4 +8,8 @@ INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('flood.with.rights', '0 ALTER TABLE `permissions` ADD `cmd_softkick` ENUM('0', '1') NOT NULL DEFAULT '0' AFTER `cmd_kickall`; INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.keys.cmd_softkick', 'softkick'); INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_softkick_not_found', '%user% not found'); -INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_softkick_error_self', 'You can not softkick yourself!'); \ No newline at end of file +INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_softkick_error_self', 'You can not softkick yourself!'); + +-- Rank ignoring +INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('generic.error.higher_rank', 'You can\'t ignore this user.'); +INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.ignore.staffs', '0'); \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java index 0b7797b6..29f68f17 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java @@ -1,6 +1,7 @@ package com.eu.habbo.habbohotel.users; import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.achievements.Achievement; import com.eu.habbo.habbohotel.achievements.AchievementManager; import com.eu.habbo.habbohotel.achievements.TalentTrackType; @@ -602,17 +603,23 @@ public class HabboStats implements Runnable { return 0; } - public void ignoreUser(int userId) { - if (!this.userIgnored(userId)) { - this.ignoredUsers.add(userId); + public void ignoreUser(GameClient gameClient, int userId) { + Habbo target = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId); + if (target.getHabboInfo().getRank().getId() >= gameClient.getHabbo().getHabboInfo().getRank().getId()) { + gameClient.getHabbo().whisper(Emulator.getTexts().getValue("generic.error.higher_rank"), RoomChatMessageBubbles.ALERT); + } + else { + if (!this.userIgnored(userId)) { + this.ignoredUsers.add(userId); - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); - PreparedStatement statement = connection.prepareStatement("INSERT INTO users_ignored (user_id, target_id) VALUES (?, ?)")) { - statement.setInt(1, this.habboInfo.getId()); - statement.setInt(2, userId); - statement.execute(); - } catch (SQLException e) { - LOGGER.error("Caught SQL exception", e); + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); + PreparedStatement statement = connection.prepareStatement("INSERT INTO users_ignored (user_id, target_id) VALUES (?, ?)")) { + statement.setInt(1, this.habboInfo.getId()); + statement.setInt(2, userId); + statement.execute(); + } catch (SQLException e) { + LOGGER.error("Caught SQL exception", e); + } } } } From b638e04737c3ca1b83475065c834a079014b355a Mon Sep 17 00:00:00 2001 From: Swirny Date: Mon, 25 May 2020 18:49:42 +0200 Subject: [PATCH 110/215] Made ignore staff optional, active by default --- .../eu/habbo/habbohotel/users/HabboStats.java | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java index 29f68f17..3edea69f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java @@ -605,11 +605,25 @@ public class HabboStats implements Runnable { public void ignoreUser(GameClient gameClient, int userId) { Habbo target = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId); - if (target.getHabboInfo().getRank().getId() >= gameClient.getHabbo().getHabboInfo().getRank().getId()) { - gameClient.getHabbo().whisper(Emulator.getTexts().getValue("generic.error.higher_rank"), RoomChatMessageBubbles.ALERT); + if (!Emulator.getConfig().getBoolean("hotel.ignore.staffs")) { + if (target.getHabboInfo().getRank().getId() >= gameClient.getHabbo().getHabboInfo().getRank().getId()) { + gameClient.getHabbo().whisper(Emulator.getTexts().getValue("generic.error.higher_rank"), RoomChatMessageBubbles.ALERT); + } else { + if (!this.userIgnored(userId)) { + this.ignoredUsers.add(userId); + + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); + PreparedStatement statement = connection.prepareStatement("INSERT INTO users_ignored (user_id, target_id) VALUES (?, ?)")) { + statement.setInt(1, this.habboInfo.getId()); + statement.setInt(2, userId); + statement.execute(); + } catch (SQLException e) { + LOGGER.error("Caught SQL exception", e); + } + } + } } - else { - if (!this.userIgnored(userId)) { + else if (!this.userIgnored(userId)) { this.ignoredUsers.add(userId); try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); @@ -621,8 +635,8 @@ public class HabboStats implements Runnable { LOGGER.error("Caught SQL exception", e); } } + } - } public void unignoreUser(int userId) { if (this.userIgnored(userId)) { From d2d3dcc78c1e6ac95a349b3d06ea61faebf90642 Mon Sep 17 00:00:00 2001 From: Swirny Date: Mon, 25 May 2020 18:54:07 +0200 Subject: [PATCH 111/215] Fixed if-else statement --- src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java index 3edea69f..cf536f93 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java @@ -608,8 +608,7 @@ public class HabboStats implements Runnable { if (!Emulator.getConfig().getBoolean("hotel.ignore.staffs")) { if (target.getHabboInfo().getRank().getId() >= gameClient.getHabbo().getHabboInfo().getRank().getId()) { gameClient.getHabbo().whisper(Emulator.getTexts().getValue("generic.error.higher_rank"), RoomChatMessageBubbles.ALERT); - } else { - if (!this.userIgnored(userId)) { + } else if (!this.userIgnored(userId)) { this.ignoredUsers.add(userId); try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); @@ -622,7 +621,7 @@ public class HabboStats implements Runnable { } } } - } + else if (!this.userIgnored(userId)) { this.ignoredUsers.add(userId); From 5b52ece5e37d745489e030b8d02dd60f1496d810 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Wed, 3 Jun 2020 04:26:07 +0200 Subject: [PATCH 112/215] Clean up code, fix bug showing it succeeded while it didn't --- sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql | 4 +- .../eu/habbo/habbohotel/users/HabboStats.java | 62 ++++++++++--------- .../incoming/modtool/ReportEvent.java | 14 +++-- .../rooms/users/IgnoreRoomUserEvent.java | 3 +- .../eu/habbo/messages/rcon/IgnoreUser.java | 2 +- 5 files changed, 44 insertions(+), 41 deletions(-) diff --git a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql index 86864df5..2f406602 100644 --- a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql +++ b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql @@ -11,5 +11,5 @@ INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_softki INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_softkick_error_self', 'You can not softkick yourself!'); -- Rank ignoring -INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('generic.error.higher_rank', 'You can\'t ignore this user.'); -INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.ignore.staffs', '0'); \ No newline at end of file +INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('generic.error.ignore_higher_rank', 'You can\'t ignore this user.'); +INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.allow.ignore.staffs', '1'); \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java index cf536f93..d40f1682 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java @@ -603,40 +603,42 @@ public class HabboStats implements Runnable { return 0; } - public void ignoreUser(GameClient gameClient, int userId) { - Habbo target = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId); - if (!Emulator.getConfig().getBoolean("hotel.ignore.staffs")) { - if (target.getHabboInfo().getRank().getId() >= gameClient.getHabbo().getHabboInfo().getRank().getId()) { - gameClient.getHabbo().whisper(Emulator.getTexts().getValue("generic.error.higher_rank"), RoomChatMessageBubbles.ALERT); - } else if (!this.userIgnored(userId)) { - this.ignoredUsers.add(userId); + /** + * Ignore an user. + * + * @param gameClient The client to which this HabboStats instance belongs. + * @param userId The user to ignore. + * @return true if successfully ignored, false otherwise. + */ + public boolean ignoreUser(GameClient gameClient, int userId) { + final Habbo target = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId); - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); - PreparedStatement statement = connection.prepareStatement("INSERT INTO users_ignored (user_id, target_id) VALUES (?, ?)")) { - statement.setInt(1, this.habboInfo.getId()); - statement.setInt(2, userId); - statement.execute(); - } catch (SQLException e) { - LOGGER.error("Caught SQL exception", e); - } - } + if (!Emulator.getConfig().getBoolean("hotel.allow.ignore.staffs")) { + final int ownRank = gameClient.getHabbo().getHabboInfo().getRank().getId(); + final int targetRank = target.getHabboInfo().getRank().getId(); + + if (targetRank >= ownRank) { + gameClient.getHabbo().whisper(Emulator.getTexts().getValue("generic.error.ignore_higher_rank"), RoomChatMessageBubbles.ALERT); + return false; } - - else if (!this.userIgnored(userId)) { - this.ignoredUsers.add(userId); - - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); - PreparedStatement statement = connection.prepareStatement("INSERT INTO users_ignored (user_id, target_id) VALUES (?, ?)")) { - statement.setInt(1, this.habboInfo.getId()); - statement.setInt(2, userId); - statement.execute(); - } catch (SQLException e) { - LOGGER.error("Caught SQL exception", e); - } - } - } + if (!this.userIgnored(userId)) { + this.ignoredUsers.add(userId); + + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); + PreparedStatement statement = connection.prepareStatement("INSERT INTO users_ignored (user_id, target_id) VALUES (?, ?)")) { + statement.setInt(1, this.habboInfo.getId()); + statement.setInt(2, userId); + statement.execute(); + } catch (SQLException e) { + LOGGER.error("Caught SQL exception", e); + } + } + + return true; + } + public void unignoreUser(int userId) { if (this.userIgnored(userId)) { this.ignoredUsers.remove(userId); diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/ReportEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/ReportEvent.java index 8b2122e5..22a81fc1 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/ReportEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/ReportEvent.java @@ -73,8 +73,9 @@ public class ReportEvent extends MessageHandler { Emulator.getThreading().run(() -> { if (issue.state == ModToolTicketState.OPEN) { if (cfhTopic.action == CfhActionType.AUTO_IGNORE) { - ReportEvent.this.client.getHabbo().getHabboStats().ignoreUser(reported.getHabboInfo().getId()); - ReportEvent.this.client.sendResponse(new RoomUserIgnoredComposer(reported, RoomUserIgnoredComposer.IGNORED)); + if (ReportEvent.this.client.getHabbo().getHabboStats().ignoreUser(ReportEvent.this.client, reported.getHabboInfo().getId())) { + ReportEvent.this.client.sendResponse(new RoomUserIgnoredComposer(reported, RoomUserIgnoredComposer.IGNORED)); + } } ReportEvent.this.client.sendResponse(new ModToolIssueHandledComposer(cfhTopic.reply).compose()); @@ -99,10 +100,11 @@ public class ReportEvent extends MessageHandler { Emulator.getThreading().run(() -> { if (issue.state == ModToolTicketState.OPEN) { if (cfhTopic.action == CfhActionType.AUTO_IGNORE) { - ReportEvent.this.client.getHabbo().getHabboStats().ignoreUser(issue.reportedId); - Habbo reported = Emulator.getGameEnvironment().getHabboManager().getHabbo(issue.reportedId); - if (reported != null) { - ReportEvent.this.client.sendResponse(new RoomUserIgnoredComposer(reported, RoomUserIgnoredComposer.IGNORED)); + if (ReportEvent.this.client.getHabbo().getHabboStats().ignoreUser(ReportEvent.this.client, issue.reportedId)) { + Habbo reported = Emulator.getGameEnvironment().getHabboManager().getHabbo(issue.reportedId); + if (reported != null) { + ReportEvent.this.client.sendResponse(new RoomUserIgnoredComposer(reported, RoomUserIgnoredComposer.IGNORED)); + } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/IgnoreRoomUserEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/IgnoreRoomUserEvent.java index 2cd65c81..88621035 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/IgnoreRoomUserEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/IgnoreRoomUserEvent.java @@ -21,8 +21,7 @@ public class IgnoreRoomUserEvent extends MessageHandler { if (habbo == this.client.getHabbo()) return; - { - this.client.getHabbo().getHabboStats().ignoreUser(habbo.getHabboInfo().getId()); + if (this.client.getHabbo().getHabboStats().ignoreUser(this.client, habbo.getHabboInfo().getId())) { this.client.sendResponse(new RoomUserIgnoredComposer(habbo, RoomUserIgnoredComposer.IGNORED)); AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("SelfModIgnoreSeen")); } diff --git a/src/main/java/com/eu/habbo/messages/rcon/IgnoreUser.java b/src/main/java/com/eu/habbo/messages/rcon/IgnoreUser.java index 7a4799d4..852a1764 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/IgnoreUser.java +++ b/src/main/java/com/eu/habbo/messages/rcon/IgnoreUser.java @@ -22,7 +22,7 @@ public class IgnoreUser extends RCONMessage { Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(object.user_id); if (habbo != null) { - habbo.getHabboStats().ignoreUser(object.target_id); + habbo.getHabboStats().ignoreUser(habbo.getClient(), object.target_id); } else { try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO users_ignored (user_id, target_id) VALUES (?, ?)")) { From d97bc09c116d52797a465c24788d2fcd78e58c8e Mon Sep 17 00:00:00 2001 From: harmonic Date: Thu, 4 Jun 2020 14:23:19 +0100 Subject: [PATCH 113/215] Fixed Bot picking up, before if you had 15 in your inventory it wouldn't let you pick them up, but would allow you to buy more from the catalogue, i've set it to use the existing "hotel.bots.max.inventory" and it now checks on catalogue purchase and will alert you with a configurable message if you have too many, if you want it to act like habbo you can give users the unlimited bots perm. --- sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql | 5 ++++- src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java | 6 ++++-- .../messages/incoming/catalog/CatalogBuyItemEvent.java | 7 +++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql index 2f406602..c775ff01 100644 --- a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql +++ b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql @@ -12,4 +12,7 @@ INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_softki -- Rank ignoring INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('generic.error.ignore_higher_rank', 'You can\'t ignore this user.'); -INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.allow.ignore.staffs', '1'); \ No newline at end of file +INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.allow.ignore.staffs', '1'); + +-- Bot Inventory Limiting +INSERT INTO `emulator_texts`(`key`, `value`) VALUES ('hotel.bot.max.amount.message', 'You can\'t buy or pickup anymore bots until you place some, the maximum amount of bots you are allowed is %amount%.'); diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java index d948c332..f6449e4f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java @@ -163,6 +163,7 @@ public class BotManager { } public void pickUpBot(Bot bot, Habbo habbo) { + int botConfigSize = Emulator.getConfig().getInt("hotel.bots.max.inventory"); if (bot != null && habbo != null) { BotPickUpEvent pickedUpEvent = new BotPickUpEvent(bot, habbo); Emulator.getPluginManager().fireEvent(pickedUpEvent); @@ -171,8 +172,9 @@ public class BotManager { return; if (bot.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasPermission(Permission.ACC_ANYROOMOWNER)) { - if (!habbo.hasPermission("acc_unlimited_bots") && habbo.getInventory().getBotsComponent().getBots().size() >= 15) - return; + if (!habbo.hasPermission("acc_unlimited_bots") && habbo.getInventory().getBotsComponent().getBots().size() >= botConfigSize) { + habbo.alert(Emulator.getTexts().getValue("hotel.bot.max.amount.message").replace("%amount%", botConfigSize + "")); + } bot.onPickUp(habbo, habbo.getHabboInfo().getCurrentRoom()); habbo.getHabboInfo().getCurrentRoom().removeBot(bot); diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java index a20ea1b8..b154b49e 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java @@ -192,6 +192,13 @@ public class CatalogBuyItemEvent extends MessageHandler { else item = page.getCatalogItem(itemId); // temp patch, can a dev with better knowledge than me look into this asap pls. + if (page instanceof BotsLayout) { + int botConfigSize = Emulator.getConfig().getInt("hotel.bots.max.inventory"); + if (!this.client.getHabbo().hasPermission("acc_unlimited_bots") && this.client.getHabbo().getInventory().getBotsComponent().getBots().size() >= botConfigSize) { + this.client.getHabbo().alert(Emulator.getTexts().getValue("hotel.bot.max.amount.message").replace("%amount%", botConfigSize + "")); + return; + } + } if (page instanceof PetsLayout) { // checks it's the petlayout String[] check = extraData.split("\n"); // splits the extradata if ((check.length != 3) || (check[0].length() < PET_NAME_LENGTH_MINIMUM) || (check[0].length() > PET_NAME_LENGTH_MAXIMUM) || (!StringUtils.isAlphanumeric(check[0])))// checks if there's 3 parts (always is with pets, if not it fucks them off) From 7ac72b2935d5473ee894c26cf95dd6471b9b9a3a Mon Sep 17 00:00:00 2001 From: harmonic Date: Thu, 4 Jun 2020 16:19:34 +0100 Subject: [PATCH 114/215] Fixed Permission. --- src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java | 2 +- .../habbo/messages/incoming/catalog/CatalogBuyItemEvent.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java index f6449e4f..f8f70a49 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java @@ -172,7 +172,7 @@ public class BotManager { return; if (bot.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasPermission(Permission.ACC_ANYROOMOWNER)) { - if (!habbo.hasPermission("acc_unlimited_bots") && habbo.getInventory().getBotsComponent().getBots().size() >= botConfigSize) { + if (!habbo.hasPermission(Permission.ACC_UNLIMITED_BOTS) && habbo.getInventory().getBotsComponent().getBots().size() >= botConfigSize) { habbo.alert(Emulator.getTexts().getValue("hotel.bot.max.amount.message").replace("%amount%", botConfigSize + "")); } diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java index b154b49e..1aa80882 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.catalog.CatalogPage; import com.eu.habbo.habbohotel.catalog.ClubOffer; import com.eu.habbo.habbohotel.catalog.layouts.*; import com.eu.habbo.habbohotel.items.FurnitureType; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.users.HabboBadge; import com.eu.habbo.habbohotel.users.HabboInventory; import com.eu.habbo.messages.incoming.MessageHandler; @@ -194,7 +195,7 @@ public class CatalogBuyItemEvent extends MessageHandler { // temp patch, can a dev with better knowledge than me look into this asap pls. if (page instanceof BotsLayout) { int botConfigSize = Emulator.getConfig().getInt("hotel.bots.max.inventory"); - if (!this.client.getHabbo().hasPermission("acc_unlimited_bots") && this.client.getHabbo().getInventory().getBotsComponent().getBots().size() >= botConfigSize) { + if (!this.client.getHabbo().hasPermission(Permission.ACC_UNLIMITED_BOTS) && this.client.getHabbo().getInventory().getBotsComponent().getBots().size() >= botConfigSize) { this.client.getHabbo().alert(Emulator.getTexts().getValue("hotel.bot.max.amount.message").replace("%amount%", botConfigSize + "")); return; } From 43a1ca2a306207bf629dbf75a0e3722ffa554bac Mon Sep 17 00:00:00 2001 From: harmonic Date: Thu, 4 Jun 2020 16:44:19 +0100 Subject: [PATCH 115/215] Cleanup. --- .../java/com/eu/habbo/habbohotel/bots/BotManager.java | 10 ++++++---- .../messages/incoming/catalog/CatalogBuyItemEvent.java | 8 +++++--- .../messages/incoming/rooms/bots/BotPickupEvent.java | 2 ++ src/main/java/com/eu/habbo/plugin/PluginManager.java | 2 ++ 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java index f8f70a49..598db052 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java @@ -22,6 +22,8 @@ import java.lang.reflect.Method; import java.sql.*; import java.util.Map; + + public class BotManager { private static final Logger LOGGER = LoggerFactory.getLogger(BotManager.class); @@ -30,7 +32,7 @@ public class BotManager { public static int MAXIMUM_CHAT_SPEED = 604800; public static int MAXIMUM_CHAT_LENGTH = 120; public static int MAXIMUM_NAME_LENGTH = 15; - + public static int MAXIMUM_BOT_INVENTORY_SIZE = 25; public BotManager() throws Exception { long millis = System.currentTimeMillis(); @@ -163,7 +165,7 @@ public class BotManager { } public void pickUpBot(Bot bot, Habbo habbo) { - int botConfigSize = Emulator.getConfig().getInt("hotel.bots.max.inventory"); + if (bot != null && habbo != null) { BotPickUpEvent pickedUpEvent = new BotPickUpEvent(bot, habbo); Emulator.getPluginManager().fireEvent(pickedUpEvent); @@ -172,8 +174,8 @@ public class BotManager { return; if (bot.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasPermission(Permission.ACC_ANYROOMOWNER)) { - if (!habbo.hasPermission(Permission.ACC_UNLIMITED_BOTS) && habbo.getInventory().getBotsComponent().getBots().size() >= botConfigSize) { - habbo.alert(Emulator.getTexts().getValue("hotel.bot.max.amount.message").replace("%amount%", botConfigSize + "")); + if (!habbo.hasPermission(Permission.ACC_UNLIMITED_BOTS) && habbo.getInventory().getBotsComponent().getBots().size() >= MAXIMUM_BOT_INVENTORY_SIZE) { + habbo.alert(Emulator.getTexts().getValue("hotel.bot.max.amount.message").replace("%amount%", MAXIMUM_BOT_INVENTORY_SIZE + "")); } bot.onPickUp(habbo, habbo.getHabboInfo().getCurrentRoom()); diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java index 1aa80882..3e3e2d80 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java @@ -1,6 +1,7 @@ package com.eu.habbo.messages.incoming.catalog; import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.bots.BotManager; import com.eu.habbo.habbohotel.catalog.CatalogItem; import com.eu.habbo.habbohotel.catalog.CatalogManager; import com.eu.habbo.habbohotel.catalog.CatalogPage; @@ -28,6 +29,8 @@ import static com.eu.habbo.messages.incoming.catalog.CheckPetNameEvent.PET_NAME_ import static com.eu.habbo.messages.incoming.catalog.CheckPetNameEvent.PET_NAME_LENGTH_MINIMUM; public class CatalogBuyItemEvent extends MessageHandler { + + @Override public void handle() throws Exception { if (Emulator.getIntUnixTimestamp() - this.client.getHabbo().getHabboStats().lastPurchaseTimestamp >= CatalogManager.PURCHASE_COOLDOWN) { @@ -194,9 +197,8 @@ public class CatalogBuyItemEvent extends MessageHandler { item = page.getCatalogItem(itemId); // temp patch, can a dev with better knowledge than me look into this asap pls. if (page instanceof BotsLayout) { - int botConfigSize = Emulator.getConfig().getInt("hotel.bots.max.inventory"); - if (!this.client.getHabbo().hasPermission(Permission.ACC_UNLIMITED_BOTS) && this.client.getHabbo().getInventory().getBotsComponent().getBots().size() >= botConfigSize) { - this.client.getHabbo().alert(Emulator.getTexts().getValue("hotel.bot.max.amount.message").replace("%amount%", botConfigSize + "")); + if (!this.client.getHabbo().hasPermission(Permission.ACC_UNLIMITED_BOTS) && this.client.getHabbo().getInventory().getBotsComponent().getBots().size() >= BotManager.MAXIMUM_BOT_INVENTORY_SIZE) { + this.client.getHabbo().alert(Emulator.getTexts().getValue("hotel.bot.max.amount.message").replace("%amount%", BotManager.MAXIMUM_BOT_INVENTORY_SIZE + "")); return; } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/bots/BotPickupEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/bots/BotPickupEvent.java index 6adae312..ea04d577 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/bots/BotPickupEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/bots/BotPickupEvent.java @@ -5,6 +5,8 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.messages.incoming.MessageHandler; public class BotPickupEvent extends MessageHandler { + + @Override public void handle() throws Exception { Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom(); diff --git a/src/main/java/com/eu/habbo/plugin/PluginManager.java b/src/main/java/com/eu/habbo/plugin/PluginManager.java index d2d7c730..5c8af221 100644 --- a/src/main/java/com/eu/habbo/plugin/PluginManager.java +++ b/src/main/java/com/eu/habbo/plugin/PluginManager.java @@ -150,6 +150,8 @@ public class PluginManager { CameraPurchaseEvent.CAMERA_PURCHASE_POINTS_TYPE = Emulator.getConfig().getInt("camera.price.points.type", 0); BuyRoomPromotionEvent.ROOM_PROMOTION_BADGE = Emulator.getConfig().getValue("room.promotion.badge", "RADZZ"); + BotManager.MAXIMUM_BOT_INVENTORY_SIZE = Emulator.getConfig().getInt("hotel.bots.max.inventory"); + NewNavigatorEventCategoriesComposer.CATEGORIES.clear(); for (String category : Emulator.getConfig().getValue("navigator.eventcategories", "").split(";")) { From 1db6571db6498d669d295a2f8578a4c50ef82232 Mon Sep 17 00:00:00 2001 From: harmonic Date: Thu, 4 Jun 2020 16:52:04 +0100 Subject: [PATCH 116/215] Runs the flood protection everytime someone talks, as well as via the room cycle, fixing a tanji exploit. --- .../java/com/eu/habbo/habbohotel/rooms/Room.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 10484daf..dfa02ad9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -3040,6 +3040,20 @@ public class Room implements Comparable, ISerialize, Runnable { if (habbo.getHabboInfo().getCurrentRoom() != this) return; + if (!habbo.hasPermission(Permission.ACC_CHAT_NO_FLOOD) && habbo.getHabboStats().chatCounter > 0) { + int chatCounter = habbo.getHabboStats().chatCounter - 1; + + if (chatCounter > 3 && !this.hasRights(habbo)) { + if (this.chatProtection == 0) { + this.floodMuteHabbo(habbo, 30); + } else if (this.chatProtection == 1 && chatCounter > 4) { + this.floodMuteHabbo(habbo, 30); + } else if (this.chatProtection == 2 && chatCounter > 5) { + this.floodMuteHabbo(habbo, 30); + } + } + } + long millis = System.currentTimeMillis(); if (HABBO_CHAT_DELAY) { if (millis - habbo.getHabboStats().lastChat < 750) { From 6cb39c232f0ba1e0a20645046a1b6d8becdadea0 Mon Sep 17 00:00:00 2001 From: harmonic Date: Thu, 4 Jun 2020 20:01:44 +0100 Subject: [PATCH 117/215] Added it so that when a roller rolls you off of an object it counts as OnWalkOff, allowing it to be used in conjunction with the Wired Trigger: User walks off furni. (LIKE HABBO) --- .../rooms/users/RoomUnitOnRollerComposer.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUnitOnRollerComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUnitOnRollerComposer.java index 856e7a69..863792d7 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUnitOnRollerComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUnitOnRollerComposer.java @@ -9,8 +9,11 @@ import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.Outgoing; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class RoomUnitOnRollerComposer extends MessageComposer { + private static final Logger LOGGER = LoggerFactory.getLogger(RoomUnitOnRollerComposer.class); private final RoomUnit roomUnit; private final HabboItem roller; private final RoomTile oldLocation; @@ -18,6 +21,8 @@ public class RoomUnitOnRollerComposer extends MessageComposer { private final RoomTile newLocation; private final double newZ; private final Room room; + private int x; + private int y; public RoomUnitOnRollerComposer(RoomUnit roomUnit, HabboItem roller, RoomTile oldLocation, double oldZ, RoomTile newLocation, double newZ, Room room) { this.roomUnit = roomUnit; @@ -58,14 +63,23 @@ public class RoomUnitOnRollerComposer extends MessageComposer { if (this.roller != null && room.getLayout() != null) { RoomTile rollerTile = room.getLayout().getTile(this.roller.getX(), this.roller.getY()); - + HabboItem topItem = this.room.getTopItemAt(this.roomUnit.getCurrentLocation().x, this.roomUnit.getCurrentLocation().y); + if (topItem != null) { + try { + topItem.onWalkOff(this.roomUnit, this.room, new Object[]{this}); + } catch (Exception e) { + LOGGER.error("Caught exception", e); + } + } Emulator.getThreading().run(() -> { if (RoomUnitOnRollerComposer.this.oldLocation == rollerTile && RoomUnitOnRollerComposer.this.roomUnit.getGoal() == rollerTile) { RoomUnitOnRollerComposer.this.roomUnit.setLocation(room.getLayout().getTile(newLocation.x, newLocation.y)); RoomUnitOnRollerComposer.this.roomUnit.setPreviousLocationZ(RoomUnitOnRollerComposer.this.newLocation.getStackHeight()); RoomUnitOnRollerComposer.this.roomUnit.setZ(RoomUnitOnRollerComposer.this.newLocation.getStackHeight()); RoomUnitOnRollerComposer.this.roomUnit.sitUpdate = true; + } + }, this.room.getRollerSpeed() == 0 ? 250 : InteractionRoller.DELAY); } else { this.roomUnit.setLocation(this.newLocation); From ec41fdc73f74d76607722968edc4bd359529ed83 Mon Sep 17 00:00:00 2001 From: harmonic Date: Thu, 4 Jun 2020 20:53:39 +0100 Subject: [PATCH 118/215] Fixes Issue 656 --- .../habbo/messages/incoming/rooms/items/PostItDeleteEvent.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItDeleteEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItDeleteEvent.java index 4b5c26f6..821f92c8 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItDeleteEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItDeleteEvent.java @@ -3,6 +3,7 @@ package com.eu.habbo.messages.incoming.rooms.items; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.interactions.InteractionExternalImage; import com.eu.habbo.habbohotel.items.interactions.InteractionPostIt; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.incoming.MessageHandler; @@ -22,7 +23,7 @@ public class PostItDeleteEvent extends MessageHandler { HabboItem item = room.getHabboItem(itemId); if (item instanceof InteractionPostIt || item instanceof InteractionExternalImage) { - if (item.getUserId() == this.client.getHabbo().getHabboInfo().getId() || room.isOwner(this.client.getHabbo())) { + if (item.getUserId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)) { item.setRoomId(0); room.removeHabboItem(item); room.sendComposer(new RemoveWallItemComposer(item).compose()); From c49d9248ceb35cfcf9f72f119330e470721106bc Mon Sep 17 00:00:00 2001 From: harmonic Date: Thu, 4 Jun 2020 21:55:38 +0100 Subject: [PATCH 119/215] Fixed Pet Inventory limit check on purchasing too. --- sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql | 6 ++++-- .../java/com/eu/habbo/habbohotel/pets/PetManager.java | 1 + .../messages/incoming/catalog/CatalogBuyItemEvent.java | 7 ++++++- .../messages/incoming/rooms/pets/PetPickupEvent.java | 8 +++----- src/main/java/com/eu/habbo/plugin/PluginManager.java | 3 ++- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql index c775ff01..c8e18803 100644 --- a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql +++ b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql @@ -14,5 +14,7 @@ INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_softki INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('generic.error.ignore_higher_rank', 'You can\'t ignore this user.'); INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.allow.ignore.staffs', '1'); --- Bot Inventory Limiting -INSERT INTO `emulator_texts`(`key`, `value`) VALUES ('hotel.bot.max.amount.message', 'You can\'t buy or pickup anymore bots until you place some, the maximum amount of bots you are allowed is %amount%.'); +-- Inventory Limiting +INSERT INTO `emulator_texts`(`key`, `value`) VALUES ('error.bots.max.inventory', 'You can\'t buy or pickup anymore bots until you place some, the maximum amount of bots you are allowed is %amount%.'); + +UPDATE `emulator_texts` SET `value` = 'You\'ve reached the maximum amount of pets in your inventory! The Limit is %amount%!' WHERE `key` = 'error.pets.max.inventory'; diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java b/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java index 6b8b3d77..8294707d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java @@ -28,6 +28,7 @@ import java.util.Collection; import java.util.Map; public class PetManager { + public static int MAXIMUM_PET_INVENTORY_SIZE = 25; 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}; static int[] skins = new int[]{0, 1, 6, 7}; diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java index 3e3e2d80..8e9e2db1 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java @@ -9,6 +9,7 @@ import com.eu.habbo.habbohotel.catalog.ClubOffer; import com.eu.habbo.habbohotel.catalog.layouts.*; import com.eu.habbo.habbohotel.items.FurnitureType; import com.eu.habbo.habbohotel.permissions.Permission; +import com.eu.habbo.habbohotel.pets.PetManager; import com.eu.habbo.habbohotel.users.HabboBadge; import com.eu.habbo.habbohotel.users.HabboInventory; import com.eu.habbo.messages.incoming.MessageHandler; @@ -198,11 +199,15 @@ public class CatalogBuyItemEvent extends MessageHandler { // temp patch, can a dev with better knowledge than me look into this asap pls. if (page instanceof BotsLayout) { if (!this.client.getHabbo().hasPermission(Permission.ACC_UNLIMITED_BOTS) && this.client.getHabbo().getInventory().getBotsComponent().getBots().size() >= BotManager.MAXIMUM_BOT_INVENTORY_SIZE) { - this.client.getHabbo().alert(Emulator.getTexts().getValue("hotel.bot.max.amount.message").replace("%amount%", BotManager.MAXIMUM_BOT_INVENTORY_SIZE + "")); + this.client.getHabbo().alert(Emulator.getTexts().getValue("error.bots.max.inventory").replace("%amount%", BotManager.MAXIMUM_BOT_INVENTORY_SIZE + "")); return; } } if (page instanceof PetsLayout) { // checks it's the petlayout + if (!this.client.getHabbo().hasPermission(Permission.ACC_UNLIMITED_PETS) && this.client.getHabbo().getInventory().getPetsComponent().getPets().size() >= PetManager.MAXIMUM_PET_INVENTORY_SIZE) { + this.client.getHabbo().alert(Emulator.getTexts().getValue("error.pets.max.inventory").replace("%amount%", PetManager.MAXIMUM_PET_INVENTORY_SIZE + "")); + return; + } String[] check = extraData.split("\n"); // splits the extradata if ((check.length != 3) || (check[0].length() < PET_NAME_LENGTH_MINIMUM) || (check[0].length() > PET_NAME_LENGTH_MAXIMUM) || (!StringUtils.isAlphanumeric(check[0])))// checks if there's 3 parts (always is with pets, if not it fucks them off) return; // if it does it fucks off. diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PetPickupEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PetPickupEvent.java index 29dd53f6..211375c3 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PetPickupEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PetPickupEvent.java @@ -3,14 +3,12 @@ package com.eu.habbo.messages.incoming.rooms.pets; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.pets.Pet; +import com.eu.habbo.habbohotel.pets.PetManager; import com.eu.habbo.habbohotel.pets.RideablePet; import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomChatMessage; -import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.inventory.AddPetComposer; -import com.eu.habbo.messages.outgoing.rooms.users.RoomUserWhisperComposer; public class PetPickupEvent extends MessageHandler { @Override @@ -26,8 +24,8 @@ public class PetPickupEvent extends MessageHandler { if (pet != null) { if (this.client.getHabbo().getHabboInfo().getId() == pet.getId() || room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)) { - if (this.client.getHabbo().getInventory().getPetsComponent().getPets().size() >= Emulator.getConfig().getInt("hotel.pets.max.inventory") && !this.client.getHabbo().hasPermission("acc_unlimited_pets")) { - this.client.sendResponse(new RoomUserWhisperComposer(new RoomChatMessage(Emulator.getTexts().getValue("error.pets.max.inventory"), this.client.getHabbo(), this.client.getHabbo(), RoomChatMessageBubbles.ALERT))); + if (!this.client.getHabbo().hasPermission(Permission.ACC_UNLIMITED_PETS) && this.client.getHabbo().getInventory().getPetsComponent().getPets().size() >= PetManager.MAXIMUM_PET_INVENTORY_SIZE) { + this.client.getHabbo().alert(Emulator.getTexts().getValue("error.pets.max.inventory").replace("%amount%", PetManager.MAXIMUM_PET_INVENTORY_SIZE + "")); return; } diff --git a/src/main/java/com/eu/habbo/plugin/PluginManager.java b/src/main/java/com/eu/habbo/plugin/PluginManager.java index 5c8af221..50565833 100644 --- a/src/main/java/com/eu/habbo/plugin/PluginManager.java +++ b/src/main/java/com/eu/habbo/plugin/PluginManager.java @@ -19,6 +19,7 @@ import com.eu.habbo.habbohotel.messenger.Messenger; import com.eu.habbo.habbohotel.modtool.WordFilter; import com.eu.habbo.habbohotel.navigation.EventCategory; import com.eu.habbo.habbohotel.navigation.NavigatorManager; +import com.eu.habbo.habbohotel.pets.PetManager; import com.eu.habbo.habbohotel.rooms.*; import com.eu.habbo.habbohotel.users.HabboInventory; import com.eu.habbo.habbohotel.users.HabboManager; @@ -151,7 +152,7 @@ public class PluginManager { BuyRoomPromotionEvent.ROOM_PROMOTION_BADGE = Emulator.getConfig().getValue("room.promotion.badge", "RADZZ"); BotManager.MAXIMUM_BOT_INVENTORY_SIZE = Emulator.getConfig().getInt("hotel.bots.max.inventory"); - + PetManager.MAXIMUM_PET_INVENTORY_SIZE = Emulator.getConfig().getInt("hotel.pets.max.inventory"); NewNavigatorEventCategoriesComposer.CATEGORIES.clear(); for (String category : Emulator.getConfig().getValue("navigator.eventcategories", "").split(";")) { From de1b59acabb09563ec1b56387355d541fda5a78d Mon Sep 17 00:00:00 2001 From: Harmonic Date: Fri, 5 Jun 2020 04:06:48 -0400 Subject: [PATCH 120/215] Fixes users being sent into an endless loop in various edge cases when it tries to teleport them to a tile they're already on. Now it won't bother. --- .../interactions/wired/effects/WiredEffectTeleport.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java index 965ed802..ebd7254a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java @@ -47,14 +47,20 @@ public class WiredEffectTeleport extends InteractionWiredEffect { Room room = roomUnit.getRoom(); - if (room == null) + if (room == null) { return; + } // makes a temporary effect + roomUnit.getRoom().unIdle(roomUnit.getRoom().getHabbo(roomUnit)); room.sendComposer(new RoomUserEffectComposer(roomUnit, 4).compose()); Emulator.getThreading().run(new SendRoomUnitEffectComposer(room, roomUnit), WiredHandler.TELEPORT_DELAY + 1000); + if (tile == roomUnit.getCurrentLocation()) { + return; + } + if (tile.state == RoomTileState.INVALID || tile.state == RoomTileState.BLOCKED) { RoomTile alternativeTile = null; List optionalTiles = room.getLayout().getTilesAround(tile); @@ -146,6 +152,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect { if (!this.items.isEmpty()) { int i = Emulator.getRandom().nextInt(this.items.size()); HabboItem item = this.items.get(i); + teleportUnitToTile(roomUnit, room.getLayout().getTile(item.getX(), item.getY())); return true; } From ed6dab3da9eaf37bdd302e8e54cf53d2a1261eaa Mon Sep 17 00:00:00 2001 From: Harmonic Date: Fri, 5 Jun 2020 04:10:49 -0400 Subject: [PATCH 121/215] Fix Room Bundle currency updating. Before: The currency was taken when purchasing a room bundle, however it did not send a composer window to update the client, also it still took the currency even if a user had maxiumum rooms, meaning that the user was charged even if they didn't get the room! --- .../incoming/catalog/CatalogBuyItemEvent.java | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java index a20ea1b8..b901e1ad 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.catalog.CatalogPage; import com.eu.habbo.habbohotel.catalog.ClubOffer; import com.eu.habbo.habbohotel.catalog.layouts.*; import com.eu.habbo.habbohotel.items.FurnitureType; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.users.HabboBadge; import com.eu.habbo.habbohotel.users.HabboInventory; import com.eu.habbo.messages.incoming.MessageHandler; @@ -17,6 +18,7 @@ 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.HotelWillCloseInMinutesComposer; import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer; +import com.eu.habbo.messages.outgoing.navigator.CanCreateRoomComposer; import com.eu.habbo.messages.outgoing.users.*; import com.eu.habbo.threading.runnables.ShutdownEmulator; import gnu.trove.map.hash.THashMap; @@ -80,22 +82,29 @@ public class CatalogBuyItemEvent extends MessageHandler { } }); - if (item[0] == null || item[0].getCredits() > this.client.getHabbo().getHabboInfo().getCredits() || item[0].getPoints() > this.client.getHabbo().getHabboInfo().getCurrencyAmount(item[0].getPointsType())) { + CatalogItem roomBundleItem = item[0]; + if (roomBundleItem == null || roomBundleItem.getCredits() > this.client.getHabbo().getHabboInfo().getCredits() || roomBundleItem.getPoints() > this.client.getHabbo().getHabboInfo().getCurrencyAmount(roomBundleItem.getPointsType())) { this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); return; } + int roomCount = Emulator.getGameEnvironment().getRoomManager().getRoomsForHabbo(this.client.getHabbo()).size(); + int maxRooms = this.client.getHabbo().getHabboStats().hasActiveClub() ? Emulator.getConfig().getInt("hotel.max.rooms.vip") : Emulator.getConfig().getInt("hotel.max.rooms.user"); - ((RoomBundleLayout) page).buyRoom(this.client.getHabbo()); - - if (!this.client.getHabbo().hasPermission("acc_infinite_credits")) { - this.client.getHabbo().getHabboInfo().addCredits(-item[0].getCredits()); + if (roomCount >= maxRooms) { // checks if a user has the maximum rooms + this.client.sendResponse(new CanCreateRoomComposer(roomCount, maxRooms)); // if so throws the max room error. + this.client.sendResponse(new PurchaseOKComposer(null)); // Send this so the alert disappears, not sure if this is how it should be handled :S + return; } - - if (!this.client.getHabbo().hasPermission("acc_inifinte_points")) { - this.client.getHabbo().getHabboInfo().addCurrencyAmount(item[0].getPointsType(), -item[0].getPoints()); - } - - this.client.sendResponse(new PurchaseOKComposer()); + ((RoomBundleLayout) page).buyRoom(this.client.getHabbo()); + if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS)) { //if the player has this perm disabled + this.client.getHabbo().getHabboInfo().addCredits(-roomBundleItem.getCredits()); // takes their credits away + this.client.sendResponse(new UserCreditsComposer(this.client.getHabbo())); // Sends the updated currency composer window + } + if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_POINTS)) { //if the player has this perm disabled + this.client.getHabbo().getHabboInfo().addCurrencyAmount(roomBundleItem.getPointsType(), -roomBundleItem.getPoints()); // takes their points away + this.client.sendResponse(new UserCurrencyComposer(this.client.getHabbo())); // Sends the updated currency composer window + } + this.client.sendResponse(new PurchaseOKComposer()); // Sends the composer to close the window. final boolean[] badgeFound = {false}; item[0].getBaseItems().stream().filter(i -> i.getType() == FurnitureType.BADGE).forEach(i -> { From 582b60b810b9a71835ea209449243925a6ebdc67 Mon Sep 17 00:00:00 2001 From: Harmonic Date: Fri, 5 Jun 2020 04:12:49 -0400 Subject: [PATCH 122/215] Goodbye magic strings --- sqlupdates/1_0_6_TO_1_0_7.sql | 2 +- .../eu/habbo/habbohotel/bots/BotManager.java | 6 +++--- .../habbohotel/catalog/CatalogManager.java | 5 +++-- .../habbohotel/commands/ChatTypeCommand.java | 3 ++- .../habbohotel/commands/CommandHandler.java | 2 +- .../habbohotel/commands/EnableCommand.java | 3 ++- .../habbo/habbohotel/commands/MimicCommand.java | 3 ++- .../habbo/habbohotel/commands/TestCommand.java | 4 ++-- .../habbohotel/commands/UserInfoCommand.java | 7 ++++--- .../interactions/InteractionGuildGate.java | 3 ++- .../wired/effects/WiredEffectGiveReward.java | 5 +++-- .../navigation/NavigatorHotelFilter.java | 4 ++-- .../navigation/NavigatorPublicFilter.java | 2 +- .../navigation/NavigatorRoomAdsFilter.java | 2 +- .../habbohotel/permissions/Permission.java | 6 ++---- .../com/eu/habbo/habbohotel/rooms/Room.java | 12 ++++++------ .../habbo/habbohotel/rooms/RoomChatMessage.java | 7 ++++--- .../eu/habbo/habbohotel/rooms/RoomManager.java | 6 +++--- .../AmbassadorAlertCommandEvent.java | 3 ++- .../AmbassadorVisitCommandEvent.java | 3 ++- .../catalog/CatalogBuyItemAsGiftEvent.java | 7 ++++--- .../incoming/catalog/CatalogBuyItemEvent.java | 4 ++-- .../FloorPlanEditorSaveEvent.java | 2 +- .../incoming/guides/RequestGuideToolEvent.java | 7 ++++--- .../guilds/GuildAcceptMembershipEvent.java | 3 ++- .../incoming/guilds/GuildChangeBadgeEvent.java | 3 ++- .../incoming/guilds/GuildChangeColorsEvent.java | 3 ++- .../guilds/GuildChangeNameDescEvent.java | 3 ++- .../guilds/GuildChangeSettingsEvent.java | 3 ++- .../guilds/GuildConfirmRemoveMemberEvent.java | 3 ++- .../guilds/GuildDeclineMembershipEvent.java | 3 ++- .../incoming/guilds/GuildDeleteEvent.java | 3 ++- .../incoming/guilds/GuildRemoveAdminEvent.java | 3 ++- .../incoming/guilds/GuildRemoveMemberEvent.java | 3 ++- .../incoming/guilds/GuildSetAdminEvent.java | 3 ++- .../incoming/guilds/RequestGuildBuyEvent.java | 3 ++- .../guilds/RequestGuildMembersEvent.java | 3 ++- .../forums/GuildForumModerateMessageEvent.java | 3 ++- .../forums/GuildForumModerateThreadEvent.java | 3 ++- .../forums/GuildForumPostThreadEvent.java | 3 ++- .../forums/GuildForumThreadUpdateEvent.java | 3 ++- .../RequestNewNavigatorRoomsEvent.java | 2 +- .../incoming/rooms/RoomBackgroundEvent.java | 3 ++- .../incoming/rooms/RoomPlacePaintEvent.java | 3 ++- .../incoming/rooms/RoomStaffPickEvent.java | 3 ++- .../rooms/bots/BotSaveSettingsEvent.java | 2 +- .../incoming/rooms/items/MoveWallItemEvent.java | 3 ++- .../incoming/rooms/pets/PetPickupEvent.java | 2 +- .../incoming/rooms/pets/PetPlaceEvent.java | 4 ++-- .../rooms/promotions/BuyRoomPromotionEvent.java | 5 +++-- .../incoming/rooms/users/RoomUserKickEvent.java | 2 +- .../incoming/rooms/users/RoomUserMuteEvent.java | 3 ++- .../incoming/trading/TradeStartEvent.java | 3 ++- .../incoming/users/ChangeChatBubbleEvent.java | 3 ++- .../wired/WiredConditionSaveDataEvent.java | 2 +- .../wired/WiredEffectSaveDataEvent.java | 2 +- .../wired/WiredTriggerSaveDataEvent.java | 2 +- .../catalog/CatalogPagesListComposer.java | 3 ++- .../outgoing/guilds/GuildInfoComposer.java | 3 ++- .../guilds/forums/GuildForumDataComposer.java | 3 ++- .../outgoing/modtool/ModToolComposer.java | 17 +++++++++-------- .../outgoing/users/UserPerksComposer.java | 5 +++-- .../outgoing/users/UserPermissionsComposer.java | 3 ++- 63 files changed, 139 insertions(+), 98 deletions(-) diff --git a/sqlupdates/1_0_6_TO_1_0_7.sql b/sqlupdates/1_0_6_TO_1_0_7.sql index 7b15a7fa..0274afa8 100644 --- a/sqlupdates/1_0_6_TO_1_0_7.sql +++ b/sqlupdates/1_0_6_TO_1_0_7.sql @@ -1,6 +1,6 @@ #DATABASE UPDATE: 1.0.6 -> 1.0.7 -ALTER TABLE `permissions` ADD `acc_update_notifications` ENUM( '0', '1' ) NOT NULL DEFAULT '0'; +ALTER TABLE `permissions` ADD `"acc_update_notifications"` ENUM( '0', '1' ) NOT NULL DEFAULT '0'; DELETE FROM emulator_settings WHERE `key` LIKE 'emulator.version'; #END DATABASE UPDATE: 1.0.5 -> 1.0.6 \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java index d948c332..4bffd0a7 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java @@ -110,8 +110,8 @@ public class BotManager { return; if (room != null && bot != null && habbo != null) { - if (room.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasPermission(Permission.ACC_ANYROOMOWNER) || habbo.hasPermission("acc_placefurni")) { - if (room.getCurrentBots().size() >= Room.MAXIMUM_BOTS && !habbo.hasPermission("acc_unlimited_bots")) { + if (room.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasPermission(Permission.ACC_ANYROOMOWNER) || habbo.hasPermission(Permission.ACC_PLACEFURNI)) { + if (room.getCurrentBots().size() >= Room.MAXIMUM_BOTS && !habbo.hasPermission(Permission.ACC_UNLIMITED_BOTS)) { habbo.getClient().sendResponse(new BotErrorComposer(BotErrorComposer.ROOM_ERROR_MAX_BOTS)); return; } @@ -171,7 +171,7 @@ public class BotManager { return; if (bot.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasPermission(Permission.ACC_ANYROOMOWNER)) { - if (!habbo.hasPermission("acc_unlimited_bots") && habbo.getInventory().getBotsComponent().getBots().size() >= 15) + if (!habbo.hasPermission(Permission.ACC_UNLIMITED_BOTS) && habbo.getInventory().getBotsComponent().getBots().size() >= 15) return; bot.onPickUp(habbo, habbo.getHabboInfo().getCurrentRoom()); diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java index 47423eff..eea7f628 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java @@ -11,6 +11,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.SoundTrack; import com.eu.habbo.habbohotel.items.interactions.*; import com.eu.habbo.habbohotel.modtool.ScripterManager; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.pets.Pet; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboBadge; @@ -1070,14 +1071,14 @@ public class CatalogManager { } } - if (!free && !habbo.getClient().getHabbo().hasPermission("acc_infinite_credits")) { + if (!free && !habbo.getClient().getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS)) { if (purchasedEvent.totalCredits > 0) { habbo.getClient().getHabbo().getHabboInfo().addCredits(-purchasedEvent.totalCredits); habbo.getClient().sendResponse(new UserCreditsComposer(habbo.getClient().getHabbo())); } } - if (!free && !habbo.getClient().getHabbo().hasPermission("acc_infinite_points")) { + if (!free && !habbo.getClient().getHabbo().hasPermission(Permission.ACC_INFINITE_POINTS)) { if (purchasedEvent.totalPoints > 0) { habbo.getClient().getHabbo().getHabboInfo().addCurrencyAmount(item.getPointsType(), -purchasedEvent.totalPoints); habbo.getClient().sendResponse(new UserPointsComposer(habbo.getClient().getHabbo().getHabboInfo().getCurrencyAmount(item.getPointsType()), -purchasedEvent.totalPoints, item.getPointsType())); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/ChatTypeCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/ChatTypeCommand.java index 005911f7..6afc6dc3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/ChatTypeCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/ChatTypeCommand.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.commands; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.messages.outgoing.users.MeMenuSettingsComposer; @@ -31,7 +32,7 @@ public class ChatTypeCommand extends Command { return true; } - if (!gameClient.getHabbo().hasPermission("acc_anychatcolor")) { + if (!gameClient.getHabbo().hasPermission(Permission.ACC_ANYCHATCOLOR)) { for (String s : Emulator.getConfig().getValue("commands.cmd_chatcolor.banned_numbers").split(";")) { if (Integer.valueOf(s) == chatColor) { gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_chatcolor.banned"), RoomChatMessageBubbles.ALERT); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/CommandHandler.java b/src/main/java/com/eu/habbo/habbohotel/commands/CommandHandler.java index 33974e59..16d2c5c9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/CommandHandler.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/CommandHandler.java @@ -72,7 +72,7 @@ public class CommandHandler { for (String s : command.keys) { if (s.toLowerCase().equals(parts[0].toLowerCase())) { boolean succes = false; - if (command.permission == null || gameClient.getHabbo().hasPermission(command.permission, gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null && (gameClient.getHabbo().getHabboInfo().getCurrentRoom().hasRights(gameClient.getHabbo())) || gameClient.getHabbo().hasPermission("acc_placefurni") || (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null && gameClient.getHabbo().getHabboInfo().getCurrentRoom().getGuildId() > 0 && gameClient.getHabbo().getHabboInfo().getCurrentRoom().guildRightLevel(gameClient.getHabbo()) >= 2))) { + if (command.permission == null || gameClient.getHabbo().hasPermission(command.permission, gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null && (gameClient.getHabbo().getHabboInfo().getCurrentRoom().hasRights(gameClient.getHabbo())) || gameClient.getHabbo().hasPermission(Permission.ACC_PLACEFURNI) || (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null && gameClient.getHabbo().getHabboInfo().getCurrentRoom().getGuildId() > 0 && gameClient.getHabbo().getHabboInfo().getCurrentRoom().guildRightLevel(gameClient.getHabbo()) >= 2))) { try { Emulator.getPluginManager().fireEvent(new UserExecuteCommandEvent(gameClient.getHabbo(), command, parts)); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/EnableCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/EnableCommand.java index c56842b6..cf69a1d1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/EnableCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/EnableCommand.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.commands; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; import org.slf4j.Logger; @@ -29,7 +30,7 @@ public class EnableCommand extends Command { } if (target != null) { - if (target == gameClient.getHabbo() || gameClient.getHabbo().hasPermission("acc_enable_others")) { + if (target == gameClient.getHabbo() || gameClient.getHabbo().hasPermission(Permission.ACC_ENABLE_OTHERS)) { try { if (target.getHabboInfo().getCurrentRoom() != null) { if (target.getHabboInfo().getRiding() == null) { diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/MimicCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/MimicCommand.java index 80bef498..123f1db4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/MimicCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/MimicCommand.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.commands; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboGender; @@ -27,7 +28,7 @@ public class MimicCommand extends Command { if (habbo == gameClient.getHabbo()) { gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_mimic.not_self"), RoomChatMessageBubbles.ALERT); return true; - } else if (habbo.hasPermission("acc_not_mimiced") && !gameClient.getHabbo().hasPermission("acc_not_mimiced")) { + } else if (habbo.hasPermission(Permission.ACC_NOT_MIMICED) && !gameClient.getHabbo().hasPermission(Permission.ACC_NOT_MIMICED)) { gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_mimic.blocked").replace("%user%", params[1]).replace("%gender_name%", (habbo.getHabboInfo().getGender().equals(HabboGender.M) ? Emulator.getTexts().getValue("gender.him") : Emulator.getTexts().getValue("gender.her"))), RoomChatMessageBubbles.ALERT); return true; } else if (!habbo.hasPermission("acc_mimic_unredeemed") && FigureUtil.hasBlacklistedClothing(habbo.getHabboInfo().getLook(), gameClient.getHabbo().getForbiddenClothing())) { diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/TestCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/TestCommand.java index 9caaa41d..243dec78 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/TestCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/TestCommand.java @@ -2,7 +2,7 @@ package com.eu.habbo.habbohotel.commands; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.messages.ServerMessage; public class TestCommand extends Command { @@ -12,7 +12,7 @@ public class TestCommand extends Command { @Override public boolean handle(GameClient gameClient, String[] params) throws Exception { - if (gameClient.getHabbo() != null || !gameClient.getHabbo().hasPermission("acc_supporttool") || !Emulator.debugging) + if (gameClient.getHabbo() != null || !gameClient.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL) || !Emulator.debugging) return false; int header = Integer.valueOf(params[1]); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UserInfoCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/UserInfoCommand.java index c0402ee3..fdd621c8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UserInfoCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/UserInfoCommand.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.commands; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.modtool.ModToolBan; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboInfo; @@ -42,9 +43,9 @@ public class UserInfoCommand extends Command { Emulator.getTexts().getValue("command.cmd_userinfo.motto") + ": " + habbo.getMotto().replace("<", "[").replace(">", "]") + "\r" + Emulator.getTexts().getValue("command.cmd_userinfo.rank") + ": " + habbo.getRank().getName() + " (" + habbo.getRank().getId() + ") \r" + Emulator.getTexts().getValue("command.cmd_userinfo.online") + ": " + (onlineHabbo == null ? Emulator.getTexts().getValue("generic.no") : Emulator.getTexts().getValue("generic.yes")) + "\r" + - ((habbo.getRank().hasPermission("acc_hide_mail", true)) ? "" : Emulator.getTexts().getValue("command.cmd_userinfo.email") + ": " + habbo.getMail() + "\r") + - ((habbo.getRank().hasPermission("acc_hide_ip", true)) ? "" : Emulator.getTexts().getValue("command.cmd_userinfo.ip_register") + ": " + habbo.getIpRegister() + "\r") + - ((habbo.getRank().hasPermission("acc_hide_ip", true)) || onlineHabbo == null ? "" : Emulator.getTexts().getValue("command.cmd_userinfo.ip_current") + ": " + onlineHabbo.getClient().getChannel().remoteAddress().toString() + "\r") + + ((habbo.getRank().hasPermission(Permission.ACC_HIDE_MAIL, true)) ? "" : Emulator.getTexts().getValue("command.cmd_userinfo.email") + ": " + habbo.getMail() + "\r") + + ((habbo.getRank().hasPermission(Permission.ACC_HIDE_IP, true)) ? "" : Emulator.getTexts().getValue("command.cmd_userinfo.ip_register") + ": " + habbo.getIpRegister() + "\r") + + ((habbo.getRank().hasPermission(Permission.ACC_HIDE_IP, true)) || onlineHabbo == null ? "" : Emulator.getTexts().getValue("command.cmd_userinfo.ip_current") + ": " + onlineHabbo.getClient().getChannel().remoteAddress().toString() + "\r") + (onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.achievement_score") + ": " + onlineHabbo.getHabboStats().achievementScore + "\r" : "")); ModToolBan ban = Emulator.getGameEnvironment().getModToolManager().checkForBan(habbo.getId()); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGuildGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGuildGate.java index d552d5a9..176ae78d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGuildGate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGuildGate.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomUnit; @@ -35,7 +36,7 @@ public class InteractionGuildGate extends InteractionGuildFurni { Habbo habbo = room.getHabbo(roomUnit); - return habbo != null && (habbo.getHabboStats().hasGuild(super.getGuildId()) || habbo.hasPermission("acc_guildgate")); + return habbo != null && (habbo.getHabboStats().hasGuild(super.getGuildId()) || habbo.hasPermission(Permission.ACC_GUILDGATE)); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java index a5a8c947..e61973e9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomUnit; @@ -116,7 +117,7 @@ public class WiredEffectGiveReward extends InteractionWiredEffect { public void onClick(GameClient client, Room room, Object[] objects) throws Exception { super.onClick(client, room, objects); - if (client.getHabbo().hasPermission("acc_superwired")) { + if (client.getHabbo().hasPermission(Permission.ACC_SUPERWIRED)) { client.getHabbo().whisper(Emulator.getTexts().getValue("hotel.wired.superwired.info"), RoomChatMessageBubbles.BOT); } } @@ -165,7 +166,7 @@ public class WiredEffectGiveReward extends InteractionWiredEffect { @Override public boolean saveData(ClientMessage packet, GameClient gameClient) { - if (gameClient.getHabbo().hasPermission("acc_superwired")) { + if (gameClient.getHabbo().hasPermission(Permission.ACC_SUPERWIRED)) { packet.readInt(); this.rewardTime = packet.readInt(); diff --git a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorHotelFilter.java b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorHotelFilter.java index ff1b74b1..0a7825a5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorHotelFilter.java +++ b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorHotelFilter.java @@ -19,7 +19,7 @@ public class NavigatorHotelFilter extends NavigatorFilter { @Override public List getResult(Habbo habbo) { - boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission(Permission.ACC_ANYROOMOWNER); + boolean showInvisible = habbo.hasPermission(Permission.ACC_ENTERANYROOM) || habbo.hasPermission(Permission.ACC_ANYROOMOWNER); List resultLists = new ArrayList<>(); int i = 0; @@ -41,7 +41,7 @@ public class NavigatorHotelFilter extends NavigatorFilter { @Override public List getResult(Habbo habbo, NavigatorFilterField filterField, String value, int roomCategory) { - boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission(Permission.ACC_ANYROOMOWNER); + boolean showInvisible = habbo.hasPermission(Permission.ACC_ENTERANYROOM) || habbo.hasPermission(Permission.ACC_ANYROOMOWNER); if (!filterField.databaseQuery.isEmpty()) { List resultLists = new ArrayList<>(); int i = 0; diff --git a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorPublicFilter.java b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorPublicFilter.java index 49be285d..4ab8c3bd 100644 --- a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorPublicFilter.java +++ b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorPublicFilter.java @@ -16,7 +16,7 @@ public class NavigatorPublicFilter extends NavigatorFilter { @Override public List getResult(Habbo habbo) { - boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission(Permission.ACC_ANYROOMOWNER); + boolean showInvisible = habbo.hasPermission(Permission.ACC_ENTERANYROOM) || habbo.hasPermission(Permission.ACC_ANYROOMOWNER); List resultLists = new ArrayList<>(); int i = 0; diff --git a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorRoomAdsFilter.java b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorRoomAdsFilter.java index 2e98a9c3..a27d3c69 100644 --- a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorRoomAdsFilter.java +++ b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorRoomAdsFilter.java @@ -16,7 +16,7 @@ public class NavigatorRoomAdsFilter extends NavigatorFilter { @Override public List getResult(Habbo habbo) { - boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission(Permission.ACC_ANYROOMOWNER); + boolean showInvisible = habbo.hasPermission(Permission.ACC_ENTERANYROOM) || habbo.hasPermission(Permission.ACC_ANYROOMOWNER); List resultList = new ArrayList<>(); resultList.add(new SearchResultList(0, "categories", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("categories", ListMode.LIST), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("official-root", DisplayMode.VISIBLE), Emulator.getGameEnvironment().getNavigatorManager().getRoomsForCategory("categories", habbo), false, showInvisible, DisplayOrder.ACTIVITY, 0)); return resultList; diff --git a/src/main/java/com/eu/habbo/habbohotel/permissions/Permission.java b/src/main/java/com/eu/habbo/habbohotel/permissions/Permission.java index ace827af..46dc72d5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/permissions/Permission.java +++ b/src/main/java/com/eu/habbo/habbohotel/permissions/Permission.java @@ -1,7 +1,7 @@ package com.eu.habbo.habbohotel.permissions; public class Permission { - public static String ACC_ANYCHATCOLOR = "acc_anychatcolor"; + public static String ACC_ANYCHATCOLOR = "acc_anychatcolor"; // allows them to pick and choose any color from the chat bubbles. public static String ACC_ANYROOMOWNER = "acc_anyroomowner"; public static String ACC_EMPTY_OTHERS = "acc_empty_others"; public static String ACC_ENABLE_OTHERS = "acc_enable_others"; @@ -18,15 +18,13 @@ public class Permission { public static String ACC_HIDE_MAIL = "acc_hide_mail"; public static String ACC_NOT_MIMICED = "acc_not_mimiced"; public static String ACC_CHAT_NO_FLOOD = "acc_chat_no_flood"; - public static String ACC_STAFF_CHAT = "acc_staff_chat"; public static String ACC_STAFF_PICK = "acc_staff_pick"; - public static String ACC_ENTERANYROOM = "acc_enteranyroom"; + public static String ACC_ENTERANYROOM = "acc_enteranyroom"; // public static String ACC_FULLROOMS = "acc_fullrooms"; public static String ACC_INFINITE_CREDITS = "acc_infinite_credits"; public static String ACC_INFINITE_PIXELS = "acc_infinite_pixels"; public static String ACC_INFINITE_POINTS = "acc_infinite_points"; public static String ACC_AMBASSADOR = "acc_ambassador"; - public static String ACC_DEBUG = "acc_debug"; public static String ACC_CHAT_NO_LIMIT = "acc_chat_no_limit"; public static String ACC_CHAT_NO_FILTER = "acc_chat_no_filter"; public static String ACC_NOMUTE = "acc_nomute"; diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index dfa02ad9..d8488b7e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -1197,7 +1197,7 @@ public class Room implements Comparable, ISerialize, Runnable { habbo.getHabboStats().mutedBubbleTracker = false; this.sendComposer(new RoomUserIgnoredComposer(habbo, RoomUserIgnoredComposer.UNIGNORED).compose()); } - if (!habbo.hasPermission("acc_chat_no_flood") && habbo.getHabboStats().chatCounter > 0) { + if (!habbo.hasPermission(Permission.ACC_CHAT_NO_FLOOD) && habbo.getHabboStats().chatCounter > 0) { //if (habbo.getRoomUnit().talkTimeOut == 0 || currentTimestamp - habbo.getRoomUnit().talkTimeOut < 0) { habbo.getHabboStats().chatCounter--; @@ -3088,14 +3088,14 @@ public class Room implements Comparable, ISerialize, Runnable { } if (!this.wordFilterWords.isEmpty()) { - if (!habbo.hasPermission("acc_chat_no_filter")) { + if (!habbo.hasPermission(Permission.ACC_CHAT_NO_FILTER)) { for (String string : this.wordFilterWords) { roomChatMessage.setMessage(roomChatMessage.getMessage().replace(string, "bobba")); } } } - if (!habbo.hasPermission("acc_nomute")) { + if (!habbo.hasPermission(Permission.ACC_NOMUTE)) { if (this.isMuted() && !this.hasRights(habbo)) { return; } @@ -3160,13 +3160,13 @@ public class Room implements Comparable, ISerialize, Runnable { continue; } - if (h.hasPermission("acc_see_whispers")) { + if (h.hasPermission(Permission.ACC_SEE_WHISPERS)) { h.getClient().sendResponse(staffMessage); } } } else if (chatType == RoomChatType.TALK) { ServerMessage message = new RoomUserTalkComposer(roomChatMessage).compose(); - boolean noChatLimit = habbo.hasPermission("acc_chat_no_limit"); + boolean noChatLimit = habbo.hasPermission(Permission.ACC_CHAT_NO_LIMIT); for (Habbo h : this.getHabbos()) { if ((h.getRoomUnit().getCurrentLocation().distance(habbo.getRoomUnit().getCurrentLocation()) <= this.chatDistance || @@ -4229,7 +4229,7 @@ public class Room implements Comparable, ISerialize, Runnable { for (Habbo habbo : this.getHabbos()) { if (habbo.getHabboInfo().getCurrentRoom() == this) { if (habbo.getHabboInfo().getId() != this.ownerId) { - if (!(habbo.hasPermission(Permission.ACC_ANYROOMOWNER) || habbo.hasPermission("acc_moverotate"))) + if (!(habbo.hasPermission(Permission.ACC_ANYROOMOWNER) || habbo.hasPermission(Permission.ACC_MOVEROTATE))) this.refreshRightsForHabbo(habbo); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java index 22a8b662..ba845ba4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.rooms; import com.eu.habbo.Emulator; import com.eu.habbo.core.DatabaseLoggable; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.ISerialize; import com.eu.habbo.messages.ServerMessage; @@ -51,7 +52,7 @@ public class RoomChatMessage implements Runnable, ISerialize, DatabaseLoggable { this.bubble = RoomChatMessageBubbles.NORMAL; } - if (!message.client.getHabbo().hasPermission("acc_anychatcolor")) { + if (!message.client.getHabbo().hasPermission(Permission.ACC_ANYCHATCOLOR)) { for (Integer i : RoomChatMessage.BANNED_BUBBLES) { if (i == this.bubble.getType()) { this.bubble = RoomChatMessageBubbles.NORMAL; @@ -173,7 +174,7 @@ public class RoomChatMessage implements Runnable, ISerialize, DatabaseLoggable { @Override public void serialize(ServerMessage message) { if (this.habbo != null && this.bubble.isOverridable()) { - if (!this.habbo.hasPermission("acc_anychatcolor")) { + if (!this.habbo.hasPermission(Permission.ACC_ANYCHATCOLOR)) { for (Integer i : RoomChatMessage.BANNED_BUBBLES) { if (i == this.bubble.getType()) { this.bubble = RoomChatMessageBubbles.NORMAL; @@ -209,7 +210,7 @@ public class RoomChatMessage implements Runnable, ISerialize, DatabaseLoggable { } if (Emulator.getConfig().getBoolean("hotel.wordfilter.enabled") && Emulator.getConfig().getBoolean("hotel.wordfilter.rooms")) { - if (!this.habbo.hasPermission("acc_chat_no_filter")) { + if (!this.habbo.hasPermission(Permission.ACC_CHAT_NO_FILTER)) { if (!Emulator.getGameEnvironment().getWordFilter().autoReportCheck(this)) { if (!Emulator.getGameEnvironment().getWordFilter().hideMessageCheck(this.message)) { Emulator.getGameEnvironment().getWordFilter().filter(this, this.habbo); diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java index 59dc8999..76917c82 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java @@ -510,7 +510,7 @@ public class RoomManager { } } - if (room.isBanned(habbo) && !habbo.hasPermission(Permission.ACC_ANYROOMOWNER) && !habbo.hasPermission("acc_enteranyroom")) { + if (room.isBanned(habbo) && !habbo.hasPermission(Permission.ACC_ANYROOMOWNER) && !habbo.hasPermission(Permission.ACC_ENTERANYROOM)) { habbo.getClient().sendResponse(new RoomEnterErrorComposer(RoomEnterErrorComposer.ROOM_ERROR_BANNED)); return; } @@ -528,7 +528,7 @@ public class RoomManager { room.getState() == RoomState.OPEN || room.getState() == RoomState.INVISIBLE || habbo.hasPermission(Permission.ACC_ANYROOMOWNER) || - habbo.hasPermission("acc_enteranyroom") || + habbo.hasPermission(Permission.ACC_ENTERANYROOM) || room.hasRights(habbo) || (room.hasGuild() && room.guildRightLevel(habbo) > 2)) { this.openRoom(habbo, room, doorLocation); @@ -620,7 +620,7 @@ public class RoomManager { return; } - if (room.getUserCount() >= room.getUsersMax() && !habbo.hasPermission("acc_fullrooms") && !room.hasRights(habbo)) { + if (room.getUserCount() >= room.getUsersMax() && !habbo.hasPermission(Permission.ACC_FULLROOMS) && !room.hasRights(habbo)) { habbo.getClient().sendResponse(new RoomEnterErrorComposer(RoomEnterErrorComposer.ROOM_ERROR_GUESTROOM_FULL)); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/ambassadors/AmbassadorAlertCommandEvent.java b/src/main/java/com/eu/habbo/messages/incoming/ambassadors/AmbassadorAlertCommandEvent.java index fe42366b..dc37847c 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/ambassadors/AmbassadorAlertCommandEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/ambassadors/AmbassadorAlertCommandEvent.java @@ -2,6 +2,7 @@ package com.eu.habbo.messages.incoming.ambassadors; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.modtool.ScripterManager; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer; @@ -11,7 +12,7 @@ import com.eu.habbo.plugin.events.support.SupportUserAlertedReason; public class AmbassadorAlertCommandEvent extends MessageHandler { @Override public void handle() throws Exception { - if (!this.client.getHabbo().hasPermission("acc_ambassador")) { + if (!this.client.getHabbo().hasPermission(Permission.ACC_AMBASSADOR)) { ScripterManager.scripterDetected(this.client, Emulator.getTexts().getValue("scripter.warning.modtools.alert").replace("%username%", client.getHabbo().getHabboInfo().getUsername()).replace("%message%", "${notification.ambassador.alert.warning.message}")); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/ambassadors/AmbassadorVisitCommandEvent.java b/src/main/java/com/eu/habbo/messages/incoming/ambassadors/AmbassadorVisitCommandEvent.java index 0a92bcab..867ff0d8 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/ambassadors/AmbassadorVisitCommandEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/ambassadors/AmbassadorVisitCommandEvent.java @@ -1,6 +1,7 @@ package com.eu.habbo.messages.incoming.ambassadors; import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.rooms.ForwardToRoomComposer; @@ -8,7 +9,7 @@ import com.eu.habbo.messages.outgoing.rooms.ForwardToRoomComposer; public class AmbassadorVisitCommandEvent extends MessageHandler { @Override public void handle() throws Exception { - if (this.client.getHabbo().hasPermission("acc_ambassador")) { + if (this.client.getHabbo().hasPermission(Permission.ACC_AMBASSADOR)) { String username = this.packet.readString(); Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(username); diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemAsGiftEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemAsGiftEvent.java index 8c08198a..f201cb83 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemAsGiftEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemAsGiftEvent.java @@ -10,6 +10,7 @@ import com.eu.habbo.habbohotel.items.FurnitureType; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.*; import com.eu.habbo.habbohotel.modtool.ScripterManager; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboBadge; import com.eu.habbo.habbohotel.users.HabboItem; @@ -347,15 +348,15 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler { AchievementManager.progressAchievement(userId, Emulator.getGameEnvironment().getAchievementManager().getAchievement("GiftReceiver")); - if (!this.client.getHabbo().hasPermission("acc_infinite_credits")) { + if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS)) { if (totalCredits > 0) { this.client.getHabbo().giveCredits(-totalCredits); } } if (totalPoints > 0) { - if (item.getPointsType() == 0 && !this.client.getHabbo().hasPermission("acc_infinite_pixels")) { + if (item.getPointsType() == 0 && !this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_PIXELS)) { this.client.getHabbo().getHabboInfo().addPixels(-totalPoints); - } else if (!this.client.getHabbo().hasPermission("acc_infinite_points")) { + } else if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_POINTS)) { this.client.getHabbo().getHabboInfo().addCurrencyAmount(item.getPointsType(), -totalPoints); } this.client.sendResponse(new UserPointsComposer(this.client.getHabbo().getHabboInfo().getCurrencyAmount(item.getPointsType()), -totalPoints, item.getPointsType())); diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java index b901e1ad..3e05fde7 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java @@ -166,10 +166,10 @@ public class CatalogBuyItemEvent extends MessageHandler { if (this.client.getHabbo().getHabboInfo().getCredits() < totalCredits) return; - if (!this.client.getHabbo().hasPermission("acc_infinite_credits")) + if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS)) this.client.getHabbo().getHabboInfo().addCredits(-totalCredits); - if (!this.client.getHabbo().hasPermission("acc_infinite_points")) + if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_POINTS)) this.client.getHabbo().getHabboInfo().addCurrencyAmount(item.getPointsType(), -totalDuckets); if (this.client.getHabbo().getHabboStats().getClubExpireTimestamp() <= Emulator.getIntUnixTimestamp()) diff --git a/src/main/java/com/eu/habbo/messages/incoming/floorplaneditor/FloorPlanEditorSaveEvent.java b/src/main/java/com/eu/habbo/messages/incoming/floorplaneditor/FloorPlanEditorSaveEvent.java index 113dd0e3..c819a940 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/floorplaneditor/FloorPlanEditorSaveEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/floorplaneditor/FloorPlanEditorSaveEvent.java @@ -21,7 +21,7 @@ public class FloorPlanEditorSaveEvent extends MessageHandler { @Override public void handle() throws Exception { - if (!this.client.getHabbo().hasPermission("acc_floorplan_editor")) { + if (!this.client.getHabbo().hasPermission(Permission.ACC_FLOORPLAN_EDITOR)) { this.client.sendResponse(new GenericAlertComposer(Emulator.getTexts().getValue("floorplan.permission"))); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/guides/RequestGuideToolEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guides/RequestGuideToolEvent.java index a3240e31..2c954c2a 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guides/RequestGuideToolEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guides/RequestGuideToolEvent.java @@ -1,6 +1,7 @@ package com.eu.habbo.messages.incoming.guides; import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.guides.GuideToolsComposer; @@ -14,13 +15,13 @@ public class RequestGuideToolEvent extends MessageHandler { boolean helperRequests = this.packet.readBoolean(); boolean bullyReports = this.packet.readBoolean(); - if (!this.client.getHabbo().hasPermission("acc_helper_use_guide_tool")) + if (!this.client.getHabbo().hasPermission(Permission.ACC_HELPER_USE_GUIDE_TOOL)) return; - if (helperRequests && !this.client.getHabbo().hasPermission("acc_helper_give_guide_tours")) + if (helperRequests && !this.client.getHabbo().hasPermission(Permission.ACC_HELPER_GIVE_GUIDE_TOURS)) helperRequests = false; - if (bullyReports && !this.client.getHabbo().hasPermission("acc_helper_judge_chat_reviews")) + if (bullyReports && !this.client.getHabbo().hasPermission(Permission.ACC_HELPER_JUDGE_CHAT_REVIEWS)) bullyReports = false; if (helperRequests) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildAcceptMembershipEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildAcceptMembershipEvent.java index 497d4c15..1f932ffb 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildAcceptMembershipEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildAcceptMembershipEvent.java @@ -4,6 +4,7 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.guilds.Guild; import com.eu.habbo.habbohotel.guilds.GuildMember; import com.eu.habbo.habbohotel.guilds.GuildRank; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.incoming.MessageHandler; @@ -20,7 +21,7 @@ public class GuildAcceptMembershipEvent extends MessageHandler { Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId); - if (guild == null || (guild.getOwnerId() != this.client.getHabbo().getHabboInfo().getId() && !Emulator.getGameEnvironment().getGuildManager().getOnlyAdmins(guild).containsKey(this.client.getHabbo().getHabboInfo().getId()) && !this.client.getHabbo().hasPermission("acc_guild_admin"))) + if (guild == null || (guild.getOwnerId() != this.client.getHabbo().getHabboInfo().getId() && !Emulator.getGameEnvironment().getGuildManager().getOnlyAdmins(guild).containsKey(this.client.getHabbo().getHabboInfo().getId()) && !this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN))) return; Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildChangeBadgeEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildChangeBadgeEvent.java index 1edbbd5f..965202d7 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildChangeBadgeEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildChangeBadgeEvent.java @@ -2,6 +2,7 @@ package com.eu.habbo.messages.incoming.guilds; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.guilds.Guild; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.plugin.events.guilds.GuildChangedBadgeEvent; @@ -13,7 +14,7 @@ public class GuildChangeBadgeEvent extends MessageHandler { Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId); if (guild != null) { - if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission("acc_guild_admin")) { + if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) { Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(guild.getRoomId()); if (room == null || room.getId() != guild.getRoomId()) diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildChangeColorsEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildChangeColorsEvent.java index ed496ded..fee78300 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildChangeColorsEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildChangeColorsEvent.java @@ -2,6 +2,7 @@ package com.eu.habbo.messages.incoming.guilds; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.guilds.Guild; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.plugin.events.guilds.GuildChangedColorsEvent; @@ -14,7 +15,7 @@ public class GuildChangeColorsEvent extends MessageHandler { Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId); if (guild != null) { - if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission("acc_guild_admin")) { + if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) { GuildChangedColorsEvent colorsEvent = new GuildChangedColorsEvent(guild, this.packet.readInt(), this.packet.readInt()); Emulator.getPluginManager().fireEvent(colorsEvent); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildChangeNameDescEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildChangeNameDescEvent.java index fc28261c..29eac532 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildChangeNameDescEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildChangeNameDescEvent.java @@ -2,6 +2,7 @@ package com.eu.habbo.messages.incoming.guilds; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.guilds.Guild; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.plugin.events.guilds.GuildChangedNameEvent; @@ -14,7 +15,7 @@ public class GuildChangeNameDescEvent extends MessageHandler { Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId); if (guild != null) { - if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission("acc_guild_admin")) { + if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) { GuildChangedNameEvent nameEvent = new GuildChangedNameEvent(guild, this.packet.readString(), this.packet.readString()); Emulator.getPluginManager().fireEvent(nameEvent); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildChangeSettingsEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildChangeSettingsEvent.java index 75e20dc5..2cb2d807 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildChangeSettingsEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildChangeSettingsEvent.java @@ -3,6 +3,7 @@ package com.eu.habbo.messages.incoming.guilds; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.guilds.Guild; import com.eu.habbo.habbohotel.guilds.GuildState; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.plugin.events.guilds.GuildChangedSettingsEvent; @@ -15,7 +16,7 @@ public class GuildChangeSettingsEvent extends MessageHandler { Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId); if (guild != null) { - if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission("acc_guild_admin")) { + if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) { Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(guild.getRoomId()); if (room == null) diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildConfirmRemoveMemberEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildConfirmRemoveMemberEvent.java index 9e04a545..0daebeab 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildConfirmRemoveMemberEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildConfirmRemoveMemberEvent.java @@ -4,6 +4,7 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.guilds.Guild; import com.eu.habbo.habbohotel.guilds.GuildMember; import com.eu.habbo.habbohotel.guilds.GuildRank; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.guilds.GuildConfirmRemoveMemberComposer; @@ -18,7 +19,7 @@ public class GuildConfirmRemoveMemberEvent extends MessageHandler { if (guild != null) { GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo()); - if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || (member != null && member.getRank().equals(GuildRank.OWNER)) || this.client.getHabbo().hasPermission("acc_guild_admin")) { + if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || (member != null && member.getRank().equals(GuildRank.OWNER)) || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) { Room room = Emulator.getGameEnvironment().getRoomManager().loadRoom(guild.getRoomId()); int count = 0; if (room != null) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildDeclineMembershipEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildDeclineMembershipEvent.java index e67945d6..d75a5ef1 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildDeclineMembershipEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildDeclineMembershipEvent.java @@ -4,6 +4,7 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.guilds.Guild; import com.eu.habbo.habbohotel.guilds.GuildMember; import com.eu.habbo.habbohotel.guilds.GuildRank; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.incoming.MessageHandler; @@ -22,7 +23,7 @@ public class GuildDeclineMembershipEvent extends MessageHandler { if (guild != null) { GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo()); - if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.OWNER) || this.client.getHabbo().hasPermission("acc_guild_admin")) { + if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.OWNER) || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) { guild.decreaseRequestCount(); Emulator.getGameEnvironment().getGuildManager().removeMember(guild, userId); this.client.sendResponse(new GuildMembersComposer(guild, Emulator.getGameEnvironment().getGuildManager().getGuildMembers(guild, 0, 0, ""), this.client.getHabbo(), 0, 0, "", true, Emulator.getGameEnvironment().getGuildManager().getGuildMembersCount(guild, 0, 0, ""))); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildDeleteEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildDeleteEvent.java index b5f4300b..03e9bd2a 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildDeleteEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildDeleteEvent.java @@ -2,6 +2,7 @@ package com.eu.habbo.messages.incoming.guilds; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.guilds.Guild; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.guilds.RemoveGuildFromRoomComposer; import com.eu.habbo.messages.outgoing.rooms.RoomDataComposer; @@ -15,7 +16,7 @@ public class GuildDeleteEvent extends MessageHandler { Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId); if (guild != null) { - if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission("acc_guild_admin")) //TODO Add staff permission override. + if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) //TODO Add staff permission override. { Emulator.getGameEnvironment().getGuildManager().deleteGuild(guild); Emulator.getPluginManager().fireEvent(new GuildDeletedEvent(guild, this.client.getHabbo())); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildRemoveAdminEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildRemoveAdminEvent.java index a26dbcc5..d017a5af 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildRemoveAdminEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildRemoveAdminEvent.java @@ -3,6 +3,7 @@ package com.eu.habbo.messages.incoming.guilds; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.guilds.Guild; import com.eu.habbo.habbohotel.guilds.GuildMember; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.incoming.MessageHandler; @@ -18,7 +19,7 @@ public class GuildRemoveAdminEvent extends MessageHandler { Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId); if (guild != null) { - if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission("acc_guild_admin")) { + if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) { int userId = this.packet.readInt(); Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(guild.getRoomId()); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildRemoveMemberEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildRemoveMemberEvent.java index beb69560..7652c0da 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildRemoveMemberEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildRemoveMemberEvent.java @@ -4,6 +4,7 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.guilds.Guild; import com.eu.habbo.habbohotel.guilds.GuildMember; import com.eu.habbo.habbohotel.guilds.GuildRank; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.incoming.MessageHandler; @@ -22,7 +23,7 @@ public class GuildRemoveMemberEvent extends MessageHandler { if (guild != null) { GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo()); - if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.OWNER) || this.client.getHabbo().hasPermission("acc_guild_admin")) { + if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.OWNER) || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) { Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId); GuildRemovedMemberEvent removedMemberEvent = new GuildRemovedMemberEvent(guild, userId, habbo); Emulator.getPluginManager().fireEvent(removedMemberEvent); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildSetAdminEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildSetAdminEvent.java index 6c91f4bc..7e60d6cf 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildSetAdminEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildSetAdminEvent.java @@ -3,6 +3,7 @@ package com.eu.habbo.messages.incoming.guilds; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.guilds.Guild; import com.eu.habbo.habbohotel.guilds.GuildMember; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.incoming.MessageHandler; @@ -18,7 +19,7 @@ public class GuildSetAdminEvent extends MessageHandler { Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId); if (guild != null) { - if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission("acc_guild_admin")) { + if (guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) { Emulator.getGameEnvironment().getGuildManager().setAdmin(guild, userId); Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildBuyEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildBuyEvent.java index fd969b85..7e613c42 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildBuyEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildBuyEvent.java @@ -3,6 +3,7 @@ package com.eu.habbo.messages.incoming.guilds; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.guilds.Guild; import com.eu.habbo.habbohotel.modtool.ScripterManager; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.incoming.MessageHandler; @@ -20,7 +21,7 @@ public class RequestGuildBuyEvent extends MessageHandler { @Override public void handle() throws Exception { - if (!this.client.getHabbo().hasPermission("acc_infinite_credits")) { + if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS)) { int guildPrice = Emulator.getConfig().getInt("catalog.guild.price"); if (this.client.getHabbo().getHabboInfo().getCredits() >= guildPrice) { this.client.getHabbo().giveCredits(-guildPrice); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildMembersEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildMembersEvent.java index f8ec7693..2423a900 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildMembersEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildMembersEvent.java @@ -4,6 +4,7 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.guilds.Guild; import com.eu.habbo.habbohotel.guilds.GuildMember; import com.eu.habbo.habbohotel.guilds.GuildRank; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.guilds.GuildMembersComposer; @@ -18,7 +19,7 @@ public class RequestGuildMembersEvent extends MessageHandler { Guild g = Emulator.getGameEnvironment().getGuildManager().getGuild(groupId); if (g != null) { - boolean isAdmin = this.client.getHabbo().hasPermission("acc_guild_admin"); + boolean isAdmin = this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN); if (!isAdmin && this.client.getHabbo().getHabboStats().hasGuild(g.getId())) { GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(g, this.client.getHabbo()); isAdmin = member != null && (member.getRank().equals(GuildRank.OWNER) || member.getRank().equals(GuildRank.ADMIN)); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumModerateMessageEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumModerateMessageEvent.java index 9f8ab11f..f7211d14 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumModerateMessageEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumModerateMessageEvent.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.guilds.GuildRank; import com.eu.habbo.habbohotel.guilds.forums.ForumThread; import com.eu.habbo.habbohotel.guilds.forums.ForumThreadComment; import com.eu.habbo.habbohotel.guilds.forums.ForumThreadState; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys; @@ -36,7 +37,7 @@ public class GuildForumModerateMessageEvent extends MessageHandler { return; } - boolean isStaff = this.client.getHabbo().hasPermission("acc_modtool_ticket_q"); + boolean isStaff = this.client.getHabbo().hasPermission(Permission.ACC_MODTOOL_TICKET_Q); GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, this.client.getHabbo().getHabboInfo().getId()); if (member == null) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumModerateThreadEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumModerateThreadEvent.java index 6fdea270..dfd1d31d 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumModerateThreadEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumModerateThreadEvent.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.guilds.GuildMember; import com.eu.habbo.habbohotel.guilds.GuildRank; import com.eu.habbo.habbohotel.guilds.forums.ForumThread; import com.eu.habbo.habbohotel.guilds.forums.ForumThreadState; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys; @@ -29,7 +30,7 @@ public class GuildForumModerateThreadEvent extends MessageHandler { return; } - boolean isStaff = this.client.getHabbo().hasPermission("acc_modtool_ticket_q"); + boolean isStaff = this.client.getHabbo().hasPermission(Permission.ACC_MODTOOL_TICKET_Q); GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, this.client.getHabbo().getHabboInfo().getId()); if (member == null) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumPostThreadEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumPostThreadEvent.java index a21ddc8f..5d3db9e1 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumPostThreadEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumPostThreadEvent.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.guilds.GuildMember; import com.eu.habbo.habbohotel.guilds.GuildRank; import com.eu.habbo.habbohotel.guilds.forums.ForumThread; import com.eu.habbo.habbohotel.guilds.forums.ForumThreadComment; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.guilds.forums.GuildForumAddCommentComposer; import com.eu.habbo.messages.outgoing.guilds.forums.GuildForumThreadMessagesComposer; @@ -38,7 +39,7 @@ public class GuildForumPostThreadEvent extends MessageHandler { return; } - boolean isStaff = this.client.getHabbo().hasPermission("acc_modtool_ticket_q"); + boolean isStaff = this.client.getHabbo().hasPermission(Permission.ACC_MODTOOL_TICKET_Q); GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, this.client.getHabbo().getHabboInfo().getId()); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumThreadUpdateEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumThreadUpdateEvent.java index a73b9b27..5611b934 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumThreadUpdateEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/forums/GuildForumThreadUpdateEvent.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.guilds.GuildMember; import com.eu.habbo.habbohotel.guilds.GuildRank; import com.eu.habbo.habbohotel.guilds.SettingsState; import com.eu.habbo.habbohotel.guilds.forums.ForumThread; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys; @@ -29,7 +30,7 @@ public class GuildForumThreadUpdateEvent extends MessageHandler { return; } - boolean isStaff = this.client.getHabbo().hasPermission("acc_modtool_ticket_q"); + boolean isStaff = this.client.getHabbo().hasPermission(Permission.ACC_MODTOOL_TICKET_Q); GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guildId, this.client.getHabbo().getHabboInfo().getId()); if (member == null) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestNewNavigatorRoomsEvent.java b/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestNewNavigatorRoomsEvent.java index 4fb1dec0..28a18a2b 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestNewNavigatorRoomsEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestNewNavigatorRoomsEvent.java @@ -123,7 +123,7 @@ public class RequestNewNavigatorRoomsEvent extends MessageHandler { } } - SearchResultList list = new SearchResultList(0, "query", "", SearchAction.NONE, ListMode.LIST, DisplayMode.VISIBLE, new ArrayList(searchRooms.values()), true, this.client.getHabbo().hasPermission("acc_enter_anyroom") || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER), DisplayOrder.ACTIVITY, -1); + SearchResultList list = new SearchResultList(0, "query", "", SearchAction.NONE, ListMode.LIST, DisplayMode.VISIBLE, new ArrayList(searchRooms.values()), true, this.client.getHabbo().hasPermission(Permission.ACC_ENTERANYROOM) || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER), DisplayOrder.ACTIVITY, -1); nList.add(list); return nList; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomBackgroundEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomBackgroundEvent.java index 038eba01..a53c8f1b 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomBackgroundEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomBackgroundEvent.java @@ -1,6 +1,7 @@ package com.eu.habbo.messages.incoming.rooms; import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.incoming.MessageHandler; @@ -15,7 +16,7 @@ public class RoomBackgroundEvent extends MessageHandler { if (room == null) return; - if (room.hasRights(this.client.getHabbo()) || this.client.getHabbo().hasPermission("acc_placefurni")) { + if (room.hasRights(this.client.getHabbo()) || this.client.getHabbo().hasPermission(Permission.ACC_PLACEFURNI)) { HabboItem item = room.getHabboItem(itemId); if (item == null) diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomPlacePaintEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomPlacePaintEvent.java index 6ec977c7..74855056 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomPlacePaintEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomPlacePaintEvent.java @@ -2,6 +2,7 @@ package com.eu.habbo.messages.incoming.rooms; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.achievements.AchievementManager; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.incoming.MessageHandler; @@ -16,7 +17,7 @@ public class RoomPlacePaintEvent extends MessageHandler { Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom(); - if (room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || room.hasRights(this.client.getHabbo()) || this.client.getHabbo().hasPermission("acc_placefurni")) { + if (room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || room.hasRights(this.client.getHabbo()) || this.client.getHabbo().hasPermission(Permission.ACC_PLACEFURNI)) { int itemId = this.packet.readInt(); HabboItem item = this.client.getHabbo().getInventory().getItemsComponent().getHabboItem(itemId); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomStaffPickEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomStaffPickEvent.java index 4a1ba8b8..0e3e320d 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomStaffPickEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomStaffPickEvent.java @@ -3,6 +3,7 @@ package com.eu.habbo.messages.incoming.rooms; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.achievements.AchievementManager; import com.eu.habbo.habbohotel.navigation.NavigatorPublicCategory; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.incoming.MessageHandler; @@ -11,7 +12,7 @@ import com.eu.habbo.messages.outgoing.rooms.RoomDataComposer; public class RoomStaffPickEvent extends MessageHandler { @Override public void handle() throws Exception { - if (this.client.getHabbo().hasPermission("acc_staff_pick")) { + if (this.client.getHabbo().hasPermission(Permission.ACC_STAFF_PICK)) { int roomId = this.packet.readInt(); Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(roomId); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/bots/BotSaveSettingsEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/bots/BotSaveSettingsEvent.java index aea766c0..2d217924 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/bots/BotSaveSettingsEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/bots/BotSaveSettingsEvent.java @@ -80,7 +80,7 @@ public class BotSaveSettingsEvent extends MessageHandler { String result = Emulator.getGameEnvironment().getWordFilter().filter(s, null); if (!result.isEmpty()) { - if (!this.client.getHabbo().hasPermission("acc_chat_no_filter")) { + if (!this.client.getHabbo().hasPermission(Permission.ACC_CHAT_NO_FILTER)) { result = Emulator.getGameEnvironment().getWordFilter().filter(result, this.client.getHabbo()); } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/MoveWallItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/MoveWallItemEvent.java index b583cff8..bb260add 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/MoveWallItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/MoveWallItemEvent.java @@ -1,5 +1,6 @@ package com.eu.habbo.messages.incoming.rooms.items; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.FurnitureMovementError; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.HabboItem; @@ -15,7 +16,7 @@ public class MoveWallItemEvent extends MessageHandler { if (room == null) return; - if (!room.hasRights(this.client.getHabbo()) && !this.client.getHabbo().hasPermission("acc_placefurni") && !(room.getGuildId() > 0 && room.guildRightLevel(this.client.getHabbo()) >= 2)) { + if (!room.hasRights(this.client.getHabbo()) && !this.client.getHabbo().hasPermission(Permission.ACC_PLACEFURNI) && !(room.getGuildId() > 0 && room.guildRightLevel(this.client.getHabbo()) >= 2)) { this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.key, FurnitureMovementError.NO_RIGHTS.errorCode)); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PetPickupEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PetPickupEvent.java index 29dd53f6..58dd3aa3 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PetPickupEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PetPickupEvent.java @@ -26,7 +26,7 @@ public class PetPickupEvent extends MessageHandler { if (pet != null) { if (this.client.getHabbo().getHabboInfo().getId() == pet.getId() || room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)) { - if (this.client.getHabbo().getInventory().getPetsComponent().getPets().size() >= Emulator.getConfig().getInt("hotel.pets.max.inventory") && !this.client.getHabbo().hasPermission("acc_unlimited_pets")) { + if (this.client.getHabbo().getInventory().getPetsComponent().getPets().size() >= Emulator.getConfig().getInt("hotel.pets.max.inventory") && !this.client.getHabbo().hasPermission(Permission.ACC_UNLIMITED_PETS)) { this.client.sendResponse(new RoomUserWhisperComposer(new RoomChatMessage(Emulator.getTexts().getValue("error.pets.max.inventory"), this.client.getHabbo(), this.client.getHabbo(), RoomChatMessageBubbles.ALERT))); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PetPlaceEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PetPlaceEvent.java index b43f8ab7..2af5c3af 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PetPlaceEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PetPlaceEvent.java @@ -17,7 +17,7 @@ public class PetPlaceEvent extends MessageHandler { if (room == null) return; - if (this.client.getHabbo().getHabboInfo().getId() != room.getOwnerId() && !room.isAllowPets() && !(this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasPermission("acc_placefurni"))) { + if (this.client.getHabbo().getHabboInfo().getId() != room.getOwnerId() && !room.isAllowPets() && !(this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasPermission(Permission.ACC_PLACEFURNI))) { this.client.sendResponse(new PetErrorComposer(PetErrorComposer.ROOM_ERROR_PETS_FORBIDDEN_IN_FLAT)); return; } @@ -29,7 +29,7 @@ public class PetPlaceEvent extends MessageHandler { if (pet == null) { return; } - if (room.getCurrentPets().size() >= Room.MAXIMUM_PETS && !this.client.getHabbo().hasPermission("acc_unlimited_pets")) { + if (room.getCurrentPets().size() >= Room.MAXIMUM_PETS && !this.client.getHabbo().hasPermission(Permission.ACC_UNLIMITED_PETS)) { this.client.sendResponse(new PetErrorComposer(PetErrorComposer.ROOM_ERROR_MAX_PETS)); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/promotions/BuyRoomPromotionEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/promotions/BuyRoomPromotionEvent.java index 2fa40246..511f9829 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/promotions/BuyRoomPromotionEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/promotions/BuyRoomPromotionEvent.java @@ -3,6 +3,7 @@ package com.eu.habbo.messages.incoming.rooms.promotions; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.catalog.CatalogItem; import com.eu.habbo.habbohotel.catalog.CatalogPage; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.catalog.AlertPurchaseFailedComposer; @@ -45,11 +46,11 @@ public class BuyRoomPromotionEvent extends MessageHandler { } if (room.isPromoted()) { - if (!this.client.getHabbo().hasPermission("acc_infinite_credits")) { + if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS)) { this.client.getHabbo().giveCredits(-item.getCredits()); } - if (!this.client.getHabbo().hasPermission("acc_infinite_points")) { + if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_POINTS)) { this.client.getHabbo().givePoints(item.getPointsType(), -item.getPoints()); } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserKickEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserKickEvent.java index 210a8d94..814b0599 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserKickEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserKickEvent.java @@ -41,7 +41,7 @@ public class RoomUserKickEvent extends MessageHandler { if (event.isCancelled()) return; - if (room.hasRights(this.client.getHabbo()) || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasPermission("acc_ambassador")) { + if (room.hasRights(this.client.getHabbo()) || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasPermission(Permission.ACC_AMBASSADOR)) { if (target.hasPermission(Permission.ACC_UNKICKABLE)) return; room.kickHabbo(target, true); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserMuteEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserMuteEvent.java index 7c6a770c..8acca3b2 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserMuteEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserMuteEvent.java @@ -2,6 +2,7 @@ package com.eu.habbo.messages.incoming.rooms.users; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.achievements.AchievementManager; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.incoming.MessageHandler; @@ -17,7 +18,7 @@ public class RoomUserMuteEvent extends MessageHandler { Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(roomId); if (room != null) { - if (room.hasRights(this.client.getHabbo()) || this.client.getHabbo().hasPermission("cmd_mute") || this.client.getHabbo().hasPermission("acc_ambassador")) { + if (room.hasRights(this.client.getHabbo()) || this.client.getHabbo().hasPermission("cmd_mute") || this.client.getHabbo().hasPermission(Permission.ACC_AMBASSADOR)) { Habbo habbo = room.getHabbo(userId); if (habbo != null) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/trading/TradeStartEvent.java b/src/main/java/com/eu/habbo/messages/incoming/trading/TradeStartEvent.java index c9c5cdb5..836424c5 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/trading/TradeStartEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/trading/TradeStartEvent.java @@ -1,6 +1,7 @@ package com.eu.habbo.messages.incoming.trading; import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTrade; import com.eu.habbo.habbohotel.rooms.RoomUnitStatus; @@ -20,7 +21,7 @@ public class TradeStartEvent extends MessageHandler { if (userId >= 0 && userId != this.client.getHabbo().getRoomUnit().getId()) { Habbo targetUser = room.getHabboByRoomUnitId(userId); - boolean tradeAnywhere = this.client.getHabbo().hasPermission("acc_trade_anywhere"); + boolean tradeAnywhere = this.client.getHabbo().hasPermission(Permission.ACC_TRADE_ANYWHERE); if (!RoomTrade.TRADING_ENABLED && !tradeAnywhere) { this.client.sendResponse(new TradeStartFailComposer(TradeStartFailComposer.HOTEL_TRADING_NOT_ALLOWED)); diff --git a/src/main/java/com/eu/habbo/messages/incoming/users/ChangeChatBubbleEvent.java b/src/main/java/com/eu/habbo/messages/incoming/users/ChangeChatBubbleEvent.java index 7557b387..46f6ab53 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/users/ChangeChatBubbleEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/users/ChangeChatBubbleEvent.java @@ -1,6 +1,7 @@ package com.eu.habbo.messages.incoming.users; import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.messages.incoming.MessageHandler; @@ -9,7 +10,7 @@ public class ChangeChatBubbleEvent extends MessageHandler { public void handle() throws Exception { int chatBubble = this.packet.readInt(); - if (!this.client.getHabbo().hasPermission("acc_anychatcolor")) { + if (!this.client.getHabbo().hasPermission(Permission.ACC_ANYCHATCOLOR)) { for (String s : Emulator.getConfig().getValue("commands.cmd_chatcolor.banned_numbers").split(";")) { if (Integer.valueOf(s) == chatBubble) { return; diff --git a/src/main/java/com/eu/habbo/messages/incoming/wired/WiredConditionSaveDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/wired/WiredConditionSaveDataEvent.java index 80302599..93972ee1 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/wired/WiredConditionSaveDataEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/wired/WiredConditionSaveDataEvent.java @@ -15,7 +15,7 @@ public class WiredConditionSaveDataEvent extends MessageHandler { Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom(); if (room != null) { - if (room.hasRights(this.client.getHabbo()) || room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasPermission("acc_moverotate")) { + if (room.hasRights(this.client.getHabbo()) || room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasPermission(Permission.ACC_MOVEROTATE)) { InteractionWiredCondition condition = room.getRoomSpecialTypes().getCondition(itemId); if (condition != null) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/wired/WiredEffectSaveDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/wired/WiredEffectSaveDataEvent.java index 0ad93f85..98ace187 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/wired/WiredEffectSaveDataEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/wired/WiredEffectSaveDataEvent.java @@ -15,7 +15,7 @@ public class WiredEffectSaveDataEvent extends MessageHandler { Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom(); if (room != null) { - if (room.hasRights(this.client.getHabbo()) || room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasPermission("acc_moverotate")) { + if (room.hasRights(this.client.getHabbo()) || room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasPermission(Permission.ACC_MOVEROTATE)) { InteractionWiredEffect effect = room.getRoomSpecialTypes().getEffect(itemId); if (effect != null) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/wired/WiredTriggerSaveDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/wired/WiredTriggerSaveDataEvent.java index c25591b2..8f62f60e 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/wired/WiredTriggerSaveDataEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/wired/WiredTriggerSaveDataEvent.java @@ -15,7 +15,7 @@ public class WiredTriggerSaveDataEvent extends MessageHandler { Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom(); if (room != null) { - if (room.hasRights(this.client.getHabbo()) || room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasPermission("acc_moverotate")) { + if (room.hasRights(this.client.getHabbo()) || room.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER) || this.client.getHabbo().hasPermission(Permission.ACC_MOVEROTATE)) { InteractionWiredTrigger trigger = room.getRoomSpecialTypes().getTrigger(itemId); if (trigger != null) { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPagesListComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPagesListComposer.java index a6bb52ca..829c48b3 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPagesListComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/CatalogPagesListComposer.java @@ -2,6 +2,7 @@ package com.eu.habbo.messages.outgoing.catalog; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.catalog.CatalogPage; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; @@ -21,7 +22,7 @@ public class CatalogPagesListComposer extends MessageComposer { public CatalogPagesListComposer(Habbo habbo, String mode) { this.habbo = habbo; this.mode = mode; - this.hasPermission = this.habbo.hasPermission("acc_catalog_ids"); + this.hasPermission = this.habbo.hasPermission(Permission.ACC_CATALOG_IDS); } @Override diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildInfoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildInfoComposer.java index a4d2206f..768e85ba 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildInfoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildInfoComposer.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.guilds.Guild; import com.eu.habbo.habbohotel.guilds.GuildMember; import com.eu.habbo.habbohotel.guilds.GuildMembershipStatus; import com.eu.habbo.habbohotel.guilds.GuildRank; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.Outgoing; @@ -27,7 +28,7 @@ public class GuildInfoComposer extends MessageComposer { @Override protected ServerMessage composeInternal() { - boolean adminPermissions = this.client.getHabbo().getHabboStats().hasGuild(this.guild.getId()) && this.client.getHabbo().hasPermission("acc_guild_admin"); + boolean adminPermissions = this.client.getHabbo().getHabboStats().hasGuild(this.guild.getId()) && this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN); this.response.init(Outgoing.GuildInfoComposer); this.response.appendInt(this.guild.getId()); this.response.appendBoolean(true); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumDataComposer.java index db555561..8e03ebd3 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/GuildForumDataComposer.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.guilds.GuildMember; import com.eu.habbo.habbohotel.guilds.GuildRank; import com.eu.habbo.habbohotel.guilds.forums.ForumThread; import com.eu.habbo.habbohotel.guilds.forums.ForumThreadComment; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; @@ -107,7 +108,7 @@ public class GuildForumDataComposer extends MessageComposer { GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, habbo); boolean isAdmin = member != null && (member.getRank().type < GuildRank.MEMBER.type || guild.getOwnerId() == this.habbo.getHabboInfo().getId()); - boolean isStaff = this.habbo.hasPermission("acc_modtool_ticket_q"); + boolean isStaff = this.habbo.hasPermission(Permission.ACC_MODTOOL_TICKET_Q); String errorRead = ""; String errorPost = ""; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolComposer.java index d534ffef..aacc82af 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolComposer.java @@ -4,6 +4,7 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.modtool.ModToolCategory; import com.eu.habbo.habbohotel.modtool.ModToolIssue; import com.eu.habbo.habbohotel.modtool.ModToolTicketState; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; @@ -25,7 +26,7 @@ public class ModToolComposer extends MessageComposer implements TObjectProcedure protected ServerMessage composeInternal() { this.response.init(Outgoing.ModToolComposer); - if (this.habbo.hasPermission("acc_modtool_ticket_q")) { + if (this.habbo.hasPermission(Permission.ACC_MODTOOL_TICKET_Q)) { THashSet openTickets = new THashSet<>(); THashMap tickets = Emulator.getGameEnvironment().getModToolManager().getTickets(); @@ -63,13 +64,13 @@ public class ModToolComposer extends MessageComposer implements TObjectProcedure Emulator.getGameEnvironment().getModToolManager().getCategory().forEachValue(this); - this.response.appendBoolean(this.habbo.hasPermission("acc_modtool_ticket_q")); //ticketQueueueuhuehuehuehue - this.response.appendBoolean(this.habbo.hasPermission("acc_modtool_user_logs")); //user chatlogs - this.response.appendBoolean(this.habbo.hasPermission("acc_modtool_user_alert")); //can send caution - this.response.appendBoolean(this.habbo.hasPermission("acc_modtool_user_kick")); //can send kick - this.response.appendBoolean(this.habbo.hasPermission("acc_modtool_user_ban")); //can send ban - this.response.appendBoolean(this.habbo.hasPermission("acc_modtool_room_info")); //room info ??Not sure - this.response.appendBoolean(this.habbo.hasPermission("acc_modtool_room_logs")); //room chatlogs ??Not sure + this.response.appendBoolean(this.habbo.hasPermission(Permission.ACC_MODTOOL_TICKET_Q)); //ticketQueueueuhuehuehuehue + this.response.appendBoolean(this.habbo.hasPermission(Permission.ACC_MODTOOL_USER_LOGS)); //user chatlogs + this.response.appendBoolean(this.habbo.hasPermission(Permission.ACC_MODTOOL_USER_ALERT)); //can send caution + this.response.appendBoolean(this.habbo.hasPermission(Permission.ACC_MODTOOL_USER_KICK)); //can send kick + this.response.appendBoolean(this.habbo.hasPermission(Permission.ACC_MODTOOL_USER_BAN)); //can send ban + this.response.appendBoolean(this.habbo.hasPermission(Permission.ACC_MODTOOL_ROOM_INFO)); //room info ??Not sure + this.response.appendBoolean(this.habbo.hasPermission(Permission.ACC_MODTOOL_ROOM_LOGS)); //room chatlogs ??Not sure synchronized (Emulator.getGameEnvironment().getModToolManager().getPresets()) { this.response.appendInt(Emulator.getGameEnvironment().getModToolManager().getPresets().get("room").size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UserPerksComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UserPerksComposer.java index d8d3262d..7c81d3c2 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UserPerksComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UserPerksComposer.java @@ -1,6 +1,7 @@ package com.eu.habbo.messages.outgoing.users; import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; @@ -20,7 +21,7 @@ public class UserPerksComposer extends MessageComposer { this.response.appendString("USE_GUIDE_TOOL"); this.response.appendString("requirement.unfulfilled.helper_level_4"); - this.response.appendBoolean(Emulator.getGameEnvironment().getPermissionsManager().hasPermission(this.habbo, "acc_helper_use_guide_tool")); + this.response.appendBoolean(Emulator.getGameEnvironment().getPermissionsManager().hasPermission(this.habbo, Permission.ACC_HELPER_USE_GUIDE_TOOL)); this.response.appendString("GIVE_GUIDE_TOURS"); this.response.appendString(""); @@ -48,7 +49,7 @@ public class UserPerksComposer extends MessageComposer { this.response.appendString("HEIGHTMAP_EDITOR_BETA"); this.response.appendString("requirement.unfulfilled.feature_disabled"); - this.response.appendBoolean(Emulator.getGameEnvironment().getPermissionsManager().hasPermission(this.habbo, "acc_floorplan_editor")); + this.response.appendBoolean(Emulator.getGameEnvironment().getPermissionsManager().hasPermission(this.habbo, Permission.ACC_FLOORPLAN_EDITOR)); this.response.appendString("BUILDER_AT_WORK"); this.response.appendString(""); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/users/UserPermissionsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/users/UserPermissionsComposer.java index 4a0d13d4..d7c5809e 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/users/UserPermissionsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/users/UserPermissionsComposer.java @@ -1,5 +1,6 @@ package com.eu.habbo.messages.outgoing.users; +import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; @@ -20,7 +21,7 @@ public class UserPermissionsComposer extends MessageComposer { this.response.init(Outgoing.UserPermissionsComposer); this.response.appendInt(this.clubLevel); this.response.appendInt(this.habbo.getHabboInfo().getRank().getLevel()); - this.response.appendBoolean(this.habbo.hasPermission("acc_ambassador")); + this.response.appendBoolean(this.habbo.hasPermission(Permission.ACC_AMBASSADOR)); return this.response; } } From d8bcb50e9b433e2c712f198c7cac08d694e26ec0 Mon Sep 17 00:00:00 2001 From: harmonic Date: Fri, 5 Jun 2020 16:35:08 +0100 Subject: [PATCH 123/215] Fixed emulator texts value, made it return so that it didn't pick up the bot if the limit was reached. --- src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java | 5 +++-- .../java/com/eu/habbo/habbohotel/permissions/Permission.java | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java index 598db052..b2cc203f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java @@ -174,8 +174,9 @@ public class BotManager { return; if (bot.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasPermission(Permission.ACC_ANYROOMOWNER)) { - if (!habbo.hasPermission(Permission.ACC_UNLIMITED_BOTS) && habbo.getInventory().getBotsComponent().getBots().size() >= MAXIMUM_BOT_INVENTORY_SIZE) { - habbo.alert(Emulator.getTexts().getValue("hotel.bot.max.amount.message").replace("%amount%", MAXIMUM_BOT_INVENTORY_SIZE + "")); + if (!habbo.hasPermission(Permission.ACC_UNLIMITED_BOTS) && habbo.getInventory().getBotsComponent().getBots().size() >= BotManager.MAXIMUM_BOT_INVENTORY_SIZE) { + habbo.alert(Emulator.getTexts().getValue("error.bots.max.inventory").replace("%amount%", BotManager.MAXIMUM_BOT_INVENTORY_SIZE + "")); + return; } bot.onPickUp(habbo, habbo.getHabboInfo().getCurrentRoom()); diff --git a/src/main/java/com/eu/habbo/habbohotel/permissions/Permission.java b/src/main/java/com/eu/habbo/habbohotel/permissions/Permission.java index ace827af..0e660d3a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/permissions/Permission.java +++ b/src/main/java/com/eu/habbo/habbohotel/permissions/Permission.java @@ -40,12 +40,10 @@ public class Permission { public static String ACC_MODTOOL_ROOM_INFO = "acc_modtool_room_info"; public static String ACC_MODTOOL_ROOM_LOGS = "acc_modtool_room_logs"; public static String ACC_TRADE_ANYWHERE = "acc_trade_anywhere"; - public static String ACC_UPDATE_NOTIFICATIONS = "acc_update_notifications"; public static String ACC_HELPER_USE_GUIDE_TOOL = "acc_helper_use_guide_tool"; public static String ACC_HELPER_GIVE_GUIDE_TOURS = "acc_helper_give_guide_tours"; public static String ACC_HELPER_JUDGE_CHAT_REVIEWS = "acc_helper_judge_chat_reviews"; public static String ACC_FLOORPLAN_EDITOR = "acc_floorplan_editor"; - public static String ACC_CAMERA = "acc_camera"; public final String key; public final PermissionSetting setting; public Permission(String key, PermissionSetting setting) { From d1f811ad949b3648c1d2514e24d04b1cced73abf Mon Sep 17 00:00:00 2001 From: harmonic Date: Fri, 5 Jun 2020 16:41:30 +0100 Subject: [PATCH 124/215] Fixed issue with compiling due to missing import. --- .../eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java index dff756b1..5e2fe085 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java @@ -9,6 +9,7 @@ import com.eu.habbo.habbohotel.catalog.ClubOffer; import com.eu.habbo.habbohotel.catalog.layouts.*; import com.eu.habbo.habbohotel.items.FurnitureType; import com.eu.habbo.habbohotel.permissions.Permission; +import com.eu.habbo.habbohotel.pets.PetManager; import com.eu.habbo.habbohotel.users.HabboBadge; import com.eu.habbo.habbohotel.users.HabboInventory; import com.eu.habbo.messages.incoming.MessageHandler; From f00c5136cde42b2f7ee8591e8bf32d7ec980222c Mon Sep 17 00:00:00 2001 From: harmonic Date: Fri, 5 Jun 2020 17:30:54 +0100 Subject: [PATCH 125/215] Fixed WiredEffectMatchFurni to no longer send furniture under users. (Like Habbo) --- .../interactions/wired/effects/WiredEffectMatchFurni.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java index f4642bf5..6b337571 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java @@ -89,11 +89,12 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect { if (t != null && t.state != RoomTileState.INVALID) { boolean canMove = true; - if (t.x == item.getX() && t.y == item.getY()) { + if (t.x == item.getX() && t.y == item.getY() || room.hasHabbosAt(t.x, t.y)) { canMove = !(room.getTopItemAt(t.x, t.y) == item); slideAnimation = false; } + if (canMove && !room.hasHabbosAt(t.x, t.y)) { THashSet tiles = room.getLayout().getTilesAt(t, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), setting.rotation); double highestZ = -1d; From 671a43e6c5e0c627b276e9ae491d840bffef10bd Mon Sep 17 00:00:00 2001 From: Harmonic Date: Fri, 5 Jun 2020 14:27:37 -0400 Subject: [PATCH 126/215] Revert "Merge branch 'fix-chat-exploit' into 'dev'" This reverts merge request !224 --- .../java/com/eu/habbo/habbohotel/rooms/Room.java | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index d8488b7e..9079713e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -3040,20 +3040,6 @@ public class Room implements Comparable, ISerialize, Runnable { if (habbo.getHabboInfo().getCurrentRoom() != this) return; - if (!habbo.hasPermission(Permission.ACC_CHAT_NO_FLOOD) && habbo.getHabboStats().chatCounter > 0) { - int chatCounter = habbo.getHabboStats().chatCounter - 1; - - if (chatCounter > 3 && !this.hasRights(habbo)) { - if (this.chatProtection == 0) { - this.floodMuteHabbo(habbo, 30); - } else if (this.chatProtection == 1 && chatCounter > 4) { - this.floodMuteHabbo(habbo, 30); - } else if (this.chatProtection == 2 && chatCounter > 5) { - this.floodMuteHabbo(habbo, 30); - } - } - } - long millis = System.currentTimeMillis(); if (HABBO_CHAT_DELAY) { if (millis - habbo.getHabboStats().lastChat < 750) { From 1efa38fefca86aea231eef064a04c2465c72aa55 Mon Sep 17 00:00:00 2001 From: Swirny Date: Fri, 22 May 2020 19:48:24 +0200 Subject: [PATCH 127/215] Added CFH counter --- .../eu/habbo/threading/runnables/UpdateModToolIssue.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java b/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java index 70ea304b..2f6d043c 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java +++ b/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java @@ -30,5 +30,12 @@ public class UpdateModToolIssue implements Runnable { } catch (SQLException e) { LOGGER.error("Caught SQL exception", e); } + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET cfh_send = cfh_send + ? WHERE user_id = ?")) { + statement.setInt(1, 1); + statement.setInt(2, this.issue.senderId); + statement.execute(); + } catch (SQLException e) { + LOGGER.error("Caught SQL exception", e); + } } } From b958c4dbfe60d7280e4880b052c27d4d041df66b Mon Sep 17 00:00:00 2001 From: Swirny <140-Swirny@users.noreply.git.krews.org> Date: Thu, 4 Jun 2020 05:18:32 -0400 Subject: [PATCH 128/215] Update UpdateModToolIssue.java --- .../com/eu/habbo/threading/runnables/UpdateModToolIssue.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java b/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java index 2f6d043c..f51a2a04 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java +++ b/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java @@ -30,8 +30,7 @@ public class UpdateModToolIssue implements Runnable { } catch (SQLException e) { LOGGER.error("Caught SQL exception", e); } - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET cfh_send = cfh_send + ? WHERE user_id = ?")) { - statement.setInt(1, 1); + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET cfh_send = cfh_send + 1 WHERE user_id = ?")) { statement.setInt(2, this.issue.senderId); statement.execute(); } catch (SQLException e) { From 4c92dbf277d3f11dc365e8a92dbbdd0c00feb833 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Sun, 7 Jun 2020 02:08:59 +0200 Subject: [PATCH 129/215] Fix entire merge request --- .../eu/habbo/threading/runnables/InsertModToolIssue.java | 8 ++++++++ .../eu/habbo/threading/runnables/UpdateModToolIssue.java | 9 ++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/eu/habbo/threading/runnables/InsertModToolIssue.java b/src/main/java/com/eu/habbo/threading/runnables/InsertModToolIssue.java index 9c7e8624..56742599 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/InsertModToolIssue.java +++ b/src/main/java/com/eu/habbo/threading/runnables/InsertModToolIssue.java @@ -43,5 +43,13 @@ public class InsertModToolIssue implements Runnable { } catch (SQLException e) { LOGGER.error("Caught SQL exception", e); } + + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); + PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET cfh_send = cfh_send + 1 WHERE user_id = ?")) { + statement.setInt(1, this.issue.senderId); + statement.execute(); + } catch (SQLException e) { + LOGGER.error("Caught SQL exception", e); + } } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java b/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java index f51a2a04..2a26db69 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java +++ b/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java @@ -20,7 +20,8 @@ public class UpdateModToolIssue implements Runnable { @Override public void run() { - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE support_tickets SET state = ?, type = ?, mod_id = ?, category = ? WHERE id = ?")) { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); + PreparedStatement statement = connection.prepareStatement("UPDATE support_tickets SET state = ?, type = ?, mod_id = ?, category = ? WHERE id = ?")) { statement.setInt(1, this.issue.state.getState()); statement.setInt(2, this.issue.type.getType()); statement.setInt(3, this.issue.modId); @@ -30,11 +31,5 @@ public class UpdateModToolIssue implements Runnable { } catch (SQLException e) { LOGGER.error("Caught SQL exception", e); } - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET cfh_send = cfh_send + 1 WHERE user_id = ?")) { - statement.setInt(2, this.issue.senderId); - statement.execute(); - } catch (SQLException e) { - LOGGER.error("Caught SQL exception", e); - } } } From e3e9286c513a22f5fcf91d9ca6af82e4d80529ae Mon Sep 17 00:00:00 2001 From: Swirny Date: Sat, 23 May 2020 11:50:26 +0200 Subject: [PATCH 130/215] Added MOD Tools Tradelocks counter --- .../commands/AllowTradingCommand.java | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/AllowTradingCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/AllowTradingCommand.java index d6ab608c..ad2a16b4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/AllowTradingCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/AllowTradingCommand.java @@ -38,20 +38,30 @@ public class AllowTradingCommand extends Command { return true; } else { boolean found; - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users_settings INNER JOIN users ON users.id = users_settings.id SET can_trade = ? WHERE users.username LIKE ?")) { - statement.setString(1, enabled ? "1" : "0"); - statement.setString(2, username); - found = statement.executeUpdate() > 0; - } + if (enabled == params[2].equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes"))) { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users_settings INNER JOIN users ON users.id = users_settings.id SET can_trade = ? WHERE users.username LIKE ?")) { + statement.setString(1, "1"); + statement.setString(2, username); + found = statement.executeUpdate() > 0; + } + } else if (enabled == params[2].equalsIgnoreCase(Emulator.getTexts().getValue("generic.no"))) { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users_settings INNER JOIN users ON users.id = users_settings.id SET can_trade = ?, tradelock_amount = tradelock_amount + ? WHERE users.username LIKE ?")) { + statement.setString(1, "0"); + statement.setInt(2, 1); + statement.setString(3, username); + found = statement.executeUpdate() > 0; + } - if (!found) { - gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_allow_trading.user_not_found").replace("%username%", params[1])); - return true; - } + if (!found) { + gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_allow_trading.user_not_found").replace("%username%", params[1])); + return true; + } - gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_allow_trading." + (enabled ? "enabled" : "disabled")).replace("%username%", params[1])); + gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_allow_trading." + (enabled ? "enabled" : "disabled")).replace("%username%", params[1])); + } } - } else { + } + else { gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_allow_trading.incorrect_setting").replace("%enabled%", Emulator.getTexts().getValue("generic.yes")).replace("%disabled%", Emulator.getTexts().getValue("generic.no"))); } return true; From 418bc882fa63044e1ea54196623d358b08f9f9e3 Mon Sep 17 00:00:00 2001 From: Swirny <140-Swirny@users.noreply.git.krews.org> Date: Sat, 23 May 2020 05:58:38 -0400 Subject: [PATCH 131/215] Update ModToolUserInfoComposer.java --- .../messages/outgoing/modtool/ModToolUserInfoComposer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java index e8ab502e..5e1b4111 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java @@ -38,7 +38,7 @@ public class ModToolUserInfoComposer extends MessageComposer { this.response.appendInt(this.set.getInt("cfh_abusive")); this.response.appendInt(this.set.getInt("cfh_warnings")); this.response.appendInt(this.set.getInt("cfh_bans")); - this.response.appendInt(0); //Trading lock count + this.response.appendInt(this.set.getInt("tradelock_amount")); this.response.appendString(""); //Trading lock expiry timestamp this.response.appendString(""); //Last Purchase Timestamp this.response.appendInt(this.set.getInt("user_id")); //Personal Identification # From a20dc373d744150bed8789ba524a63aab86fd44b Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Sun, 7 Jun 2020 02:42:54 +0200 Subject: [PATCH 132/215] Fix merge request --- sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql | 3 ++ .../commands/AllowTradingCommand.java | 52 +++++++++---------- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql index c8e18803..46a1f7fa 100644 --- a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql +++ b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql @@ -18,3 +18,6 @@ INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.allow.ignore.staf INSERT INTO `emulator_texts`(`key`, `value`) VALUES ('error.bots.max.inventory', 'You can\'t buy or pickup anymore bots until you place some, the maximum amount of bots you are allowed is %amount%.'); UPDATE `emulator_texts` SET `value` = 'You\'ve reached the maximum amount of pets in your inventory! The Limit is %amount%!' WHERE `key` = 'error.pets.max.inventory'; + +-- Tradelock counter +ALTER TABLE `users_settings` ADD `tradelock_amount` INT(11) NOT NULL DEFAULT '0' AFTER `helper_level`; \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/AllowTradingCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/AllowTradingCommand.java index ad2a16b4..649d5137 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/AllowTradingCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/AllowTradingCommand.java @@ -25,43 +25,43 @@ public class AllowTradingCommand extends Command { return true; } - if (params[2].equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes")) || params[2].equalsIgnoreCase(Emulator.getTexts().getValue("generic.no"))) { - String username = params[1]; - boolean enabled = params[2].equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes")); + final String username = params[1]; + final String option = params[2]; - Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(username); + if (option.equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes")) || option.equalsIgnoreCase(Emulator.getTexts().getValue("generic.no"))) { + final boolean enabled = option.equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes")); + final Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(username); if (habbo != null) { + if (!enabled) { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); + PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET tradelock_amount = tradelock_amount + 1 WHERE user_id = ?")) { + statement.setInt(1, habbo.getHabboInfo().getId()); + statement.executeUpdate(); + } + } habbo.getHabboStats().setAllowTrade(enabled); gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_allow_trading." + (enabled ? "enabled" : "disabled")).replace("%username%", params[1])); habbo.getClient().sendResponse(new UserPerksComposer(habbo)); return true; } else { boolean found; - if (enabled == params[2].equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes"))) { - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users_settings INNER JOIN users ON users.id = users_settings.id SET can_trade = ? WHERE users.username LIKE ?")) { - statement.setString(1, "1"); - statement.setString(2, username); - found = statement.executeUpdate() > 0; - } - } else if (enabled == params[2].equalsIgnoreCase(Emulator.getTexts().getValue("generic.no"))) { - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users_settings INNER JOIN users ON users.id = users_settings.id SET can_trade = ?, tradelock_amount = tradelock_amount + ? WHERE users.username LIKE ?")) { - statement.setString(1, "0"); - statement.setInt(2, 1); - statement.setString(3, username); - found = statement.executeUpdate() > 0; - } - - if (!found) { - gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_allow_trading.user_not_found").replace("%username%", params[1])); - return true; - } - - gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_allow_trading." + (enabled ? "enabled" : "disabled")).replace("%username%", params[1])); + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); + PreparedStatement statement = connection.prepareStatement("UPDATE users_settings INNER JOIN users ON users.id = users_settings.user_id SET can_trade = ?, tradelock_amount = tradelock_amount + ? WHERE users.username LIKE ?")) { + statement.setString(1, enabled ? "1" : "0"); + statement.setInt(2, enabled ? 0 : 1); + statement.setString(3, username); + found = statement.executeUpdate() > 0; } + + if (!found) { + gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_allow_trading.user_not_found").replace("%username%", params[1])); + return true; + } + + gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_allow_trading." + (enabled ? "enabled" : "disabled")).replace("%username%", params[1])); } - } - else { + } else { gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_allow_trading.incorrect_setting").replace("%enabled%", Emulator.getTexts().getValue("generic.yes")).replace("%disabled%", Emulator.getTexts().getValue("generic.no"))); } return true; From 88d68220d023f6e3ee0dd494ee6d27ee0080ddec Mon Sep 17 00:00:00 2001 From: Swirny Date: Sat, 23 May 2020 17:57:29 +0200 Subject: [PATCH 133/215] Added Ban counter to MOD Tools --- .../modtool/ModToolUserInfoComposer.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java index 5e1b4111..d0322384 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java @@ -11,8 +11,7 @@ import gnu.trove.map.hash.THashMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.ResultSet; -import java.sql.SQLException; +import java.sql.*; import java.util.ArrayList; public class ModToolUserInfoComposer extends MessageComposer { @@ -28,6 +27,17 @@ public class ModToolUserInfoComposer extends MessageComposer { protected ServerMessage composeInternal() { this.response.init(Outgoing.ModToolUserInfoComposer); try { + int totalBans = 0; + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT COUNT(*) AS amount FROM bans WHERE user_id = ?")) { + statement.setInt(1, this.set.getInt("user_id")); + try (ResultSet set = statement.executeQuery()) { + if (set.next()) { + totalBans = set.getInt("totalBans"); + } + } + } catch (SQLException e) { + LOGGER.error("Caught SQL exception", e); + } this.response.appendInt(this.set.getInt("user_id")); this.response.appendString(this.set.getString("username")); this.response.appendString(this.set.getString("look")); @@ -42,7 +52,7 @@ public class ModToolUserInfoComposer extends MessageComposer { this.response.appendString(""); //Trading lock expiry timestamp this.response.appendString(""); //Last Purchase Timestamp this.response.appendInt(this.set.getInt("user_id")); //Personal Identification # - this.response.appendInt(0); //Number of bans + this.response.appendInt(totalBans); //Number of bans this.response.appendString(this.set.getString("mail")); this.response.appendString("Rank (" + this.set.getInt("rank_id") + "): " + this.set.getString("rank_name")); //user_class_txt From 4ad8d3d077226d61d1ec22550754b2f26680b0b2 Mon Sep 17 00:00:00 2001 From: Swirny <140-Swirny@users.noreply.git.krews.org> Date: Sat, 23 May 2020 17:37:39 -0400 Subject: [PATCH 134/215] Removed optional exception logger --- .../messages/outgoing/modtool/ModToolUserInfoComposer.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java index d0322384..df4ce0d7 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java @@ -35,8 +35,6 @@ public class ModToolUserInfoComposer extends MessageComposer { totalBans = set.getInt("totalBans"); } } - } catch (SQLException e) { - LOGGER.error("Caught SQL exception", e); } this.response.appendInt(this.set.getInt("user_id")); this.response.appendString(this.set.getString("username")); From 5bd184a03affda6dd2088e222e9da3804a90a8a9 Mon Sep 17 00:00:00 2001 From: Swirny <140-Swirny@users.noreply.git.krews.org> Date: Sat, 23 May 2020 17:37:39 -0400 Subject: [PATCH 135/215] Revert "Removed optional exception logger" This reverts commit 4ad8d3d077226d61d1ec22550754b2f26680b0b2. --- .../messages/outgoing/modtool/ModToolUserInfoComposer.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java index df4ce0d7..d0322384 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java @@ -35,6 +35,8 @@ public class ModToolUserInfoComposer extends MessageComposer { totalBans = set.getInt("totalBans"); } } + } catch (SQLException e) { + LOGGER.error("Caught SQL exception", e); } this.response.appendInt(this.set.getInt("user_id")); this.response.appendString(this.set.getString("username")); From 10f860dc0ceb21a3bbd5d6757253cc85510afd60 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Sun, 7 Jun 2020 02:58:38 +0200 Subject: [PATCH 136/215] Add catch. --- .../messages/outgoing/modtool/ModToolUserInfoComposer.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java index d0322384..e1bb135c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java @@ -28,16 +28,21 @@ public class ModToolUserInfoComposer extends MessageComposer { this.response.init(Outgoing.ModToolUserInfoComposer); try { int totalBans = 0; - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT COUNT(*) AS amount FROM bans WHERE user_id = ?")) { + + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); + PreparedStatement statement = connection.prepareStatement("SELECT COUNT(*) AS amount FROM bans WHERE user_id = ?")) { statement.setInt(1, this.set.getInt("user_id")); try (ResultSet set = statement.executeQuery()) { if (set.next()) { totalBans = set.getInt("totalBans"); } + } catch (SQLException e) { + LOGGER.error("Caught SQL exception", e); } } catch (SQLException e) { LOGGER.error("Caught SQL exception", e); } + this.response.appendInt(this.set.getInt("user_id")); this.response.appendString(this.set.getString("username")); this.response.appendString(this.set.getString("look")); From 46d431e190a54c02f6c7a23e34f9647f22895835 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Sun, 7 Jun 2020 03:05:22 +0200 Subject: [PATCH 137/215] Fix bans count --- .../messages/outgoing/modtool/ModToolUserInfoComposer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java index e1bb135c..74fde87e 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java @@ -34,7 +34,7 @@ public class ModToolUserInfoComposer extends MessageComposer { statement.setInt(1, this.set.getInt("user_id")); try (ResultSet set = statement.executeQuery()) { if (set.next()) { - totalBans = set.getInt("totalBans"); + totalBans = set.getInt("amount"); } } catch (SQLException e) { LOGGER.error("Caught SQL exception", e); @@ -52,12 +52,12 @@ public class ModToolUserInfoComposer extends MessageComposer { this.response.appendInt(this.set.getInt("cfh_send")); this.response.appendInt(this.set.getInt("cfh_abusive")); this.response.appendInt(this.set.getInt("cfh_warnings")); - this.response.appendInt(this.set.getInt("cfh_bans")); + this.response.appendInt(totalBans); // Number of bans this.response.appendInt(this.set.getInt("tradelock_amount")); this.response.appendString(""); //Trading lock expiry timestamp this.response.appendString(""); //Last Purchase Timestamp this.response.appendInt(this.set.getInt("user_id")); //Personal Identification # - this.response.appendInt(totalBans); //Number of bans + this.response.appendInt(0); // Number of account bans this.response.appendString(this.set.getString("mail")); this.response.appendString("Rank (" + this.set.getInt("rank_id") + "): " + this.set.getString("rank_name")); //user_class_txt From 54519ac4e4a6c27f3093e9c30bb80b69c0cea084 Mon Sep 17 00:00:00 2001 From: Swirny Date: Mon, 25 May 2020 21:29:39 +0200 Subject: [PATCH 138/215] Added RateLimit to ScratchPetEvent --- .../habbo/messages/incoming/rooms/pets/ScratchPetEvent.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/ScratchPetEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/ScratchPetEvent.java index 6189f3e8..84807035 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/ScratchPetEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/ScratchPetEvent.java @@ -5,6 +5,12 @@ import com.eu.habbo.habbohotel.pets.Pet; import com.eu.habbo.messages.incoming.MessageHandler; public class ScratchPetEvent extends MessageHandler { + + @Override + public int getRatelimit() { + return 1000; + } + @Override public void handle() throws Exception { int petId = this.packet.readInt(); From 2e98d5d21c1f334ff8ab521b0c680372a59ffde7 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Sun, 7 Jun 2020 04:21:38 +0200 Subject: [PATCH 139/215] Proper monster plant fix --- .../habbohotel/pets/MonsterplantPet.java | 29 ++++++++++++++----- .../incoming/rooms/pets/ScratchPetEvent.java | 22 +++++++------- 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java b/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java index 7d4d0300..c362cf58 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java @@ -353,6 +353,19 @@ public class MonsterplantPet extends Pet implements IPetLook { } } + private boolean mayScratch() { + // Monsterplant petting is available when: + // ((energy / max_energy) < 0.98) = true + // You can find the minimum deathTimestamp by solving (insert a timestamp for timestamp, solve for death_timestamp): + // (((death_timestamp - timestamp) / 259200)) < 0.98 + // This information was found in the Habbo swf, com.sulake.habbo.ui.widget.infostand.InfoStandPetView.as + // this._Str_2304("pettreat", ((_local_3 / _local_4) < 0.98)); + final float energy = this.getEnergy(); + final float energyMax = this.getMaxEnergy(); + + return ((energy / energyMax) < 0.98); + } + @Override public int getMaxEnergy() { return MonsterplantPet.timeToLive; @@ -368,13 +381,15 @@ public class MonsterplantPet extends Pet implements IPetLook { } @Override - public void scratched(Habbo habbo) { - AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("MonsterPlantTreater"), 5); - this.setDeathTimestamp(Emulator.getIntUnixTimestamp() + MonsterplantPet.timeToLive); - this.addHappyness(10); - this.addExperience(10); - this.room.sendComposer(new PetStatusUpdateComposer(this).compose()); - this.room.sendComposer(new RoomPetRespectComposer(this, RoomPetRespectComposer.PET_TREATED).compose()); + public synchronized void scratched(Habbo habbo) { + if (this.mayScratch()) { + AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("MonsterPlantTreater"), 5); + this.setDeathTimestamp(Emulator.getIntUnixTimestamp() + MonsterplantPet.timeToLive); + this.addHappyness(10); + this.addExperience(10); + this.room.sendComposer(new PetStatusUpdateComposer(this).compose()); + this.room.sendComposer(new RoomPetRespectComposer(this, RoomPetRespectComposer.PET_TREATED).compose()); + } } @Override diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/ScratchPetEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/ScratchPetEvent.java index 84807035..4621c044 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/ScratchPetEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/ScratchPetEvent.java @@ -6,24 +6,22 @@ import com.eu.habbo.messages.incoming.MessageHandler; public class ScratchPetEvent extends MessageHandler { - @Override - public int getRatelimit() { - return 1000; - } - @Override public void handle() throws Exception { - int petId = this.packet.readInt(); + final int petId = this.packet.readInt(); - if (this.client.getHabbo().getHabboInfo().getCurrentRoom() == null) + if (this.client.getHabbo().getHabboInfo().getCurrentRoom() == null) { return; + } - Pet pet = this.client.getHabbo().getHabboInfo().getCurrentRoom().getPet(petId); + final Pet pet = this.client.getHabbo().getHabboInfo().getCurrentRoom().getPet(petId); - if (pet != null) { - if (this.client.getHabbo().getHabboStats().petRespectPointsToGive > 0 || pet instanceof MonsterplantPet) { - pet.scratched(this.client.getHabbo()); - } + if (pet == null) { + return; + } + + if (this.client.getHabbo().getHabboStats().petRespectPointsToGive > 0 || pet instanceof MonsterplantPet) { + pet.scratched(this.client.getHabbo()); } } } From 6615588b34bd95c711f3da3e5a5459f21873c8b5 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Sun, 7 Jun 2020 04:36:15 +0200 Subject: [PATCH 140/215] Fixes wordfilter permission checks (#670). --- .../rooms/RoomWordFilterModifyEvent.java | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomWordFilterModifyEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomWordFilterModifyEvent.java index 287a28f0..be680d50 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomWordFilterModifyEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomWordFilterModifyEvent.java @@ -1,28 +1,37 @@ package com.eu.habbo.messages.incoming.rooms; -import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.modtool.ScripterManager; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.messages.incoming.MessageHandler; public class RoomWordFilterModifyEvent extends MessageHandler { @Override public void handle() throws Exception { - int roomId = this.packet.readInt(); - boolean add = this.packet.readBoolean(); + final int roomId = this.packet.readInt(); + final boolean add = this.packet.readBoolean(); String word = this.packet.readString(); if (word.length() > 25) { word = word.substring(0, 24); } - Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(roomId); + // Get current room of user. + final Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom(); + if (room == null || room.getId() != roomId) { + return; + } - if (room != null) { - if (add) { - room.addToWordFilter(word); - } else { - room.removeFromWordFilter(word); - } + // Check if owner. + if (!room.isOwner(this.client.getHabbo())) { + ScripterManager.scripterDetected(this.client, String.format("User (%s) tried to change wordfilter for a not owned room.", this.client.getHabbo().getHabboInfo().getUsername())); + return; + } + + // Modify word filter. + if (add) { + room.addToWordFilter(word); + } else { + room.removeFromWordFilter(word); } } } From ff021608f56bdef2922c769131ed9b8e1b1b7683 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Sun, 7 Jun 2020 04:55:52 +0200 Subject: [PATCH 141/215] Fixes marketplace offers (#680). --- .../eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java index d408c063..031ff4f6 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java @@ -114,7 +114,7 @@ public class MarketPlace { public static List getOffers(int minPrice, int maxPrice, String search, int sort) { List offers = new ArrayList<>(10); - String query = "SELECT B.* FROM marketplace_items a INNER JOIN (SELECT b.item_id AS base_item_id, b.limited_data AS ltd_data, marketplace_items.*, AVG(price) as avg, MIN(marketplace_items.price) as minPrice, MAX(marketplace_items.price) as maxPrice, COUNT(*) as number, (SELECT COUNT(*) FROM marketplace_items c INNER JOIN items as items_b ON c.item_id = items_b.id WHERE state = 2 AND items_b.item_id = base_item_id AND DATE(from_unixtime(sold_timestamp)) = CURDATE()) as sold_count_today FROM marketplace_items INNER JOIN items b ON marketplace_items.item_id = b.id INNER JOIN items_base bi ON b.item_id = bi.id INNER JOIN catalog_items ci ON items_base.id = ci.item_ids WHERE price = (SELECT MIN(e.price) FROM marketplace_items e, items d WHERE e.item_id = d.id AND d.item_id = b.item_id AND e.state = 1 AND e.timestamp > ? GROUP BY d.item_id) AND state = 1 AND timestamp > ?"; + String query = "SELECT B.* FROM marketplace_items a INNER JOIN (SELECT b.item_id AS base_item_id, b.limited_data AS ltd_data, marketplace_items.*, AVG(price) as avg, MIN(marketplace_items.price) as minPrice, MAX(marketplace_items.price) as maxPrice, COUNT(*) as number, (SELECT COUNT(*) FROM marketplace_items c INNER JOIN items as items_b ON c.item_id = items_b.id WHERE state = 2 AND items_b.item_id = base_item_id AND DATE(from_unixtime(sold_timestamp)) = CURDATE()) as sold_count_today FROM marketplace_items INNER JOIN items b ON marketplace_items.item_id = b.id INNER JOIN items_base bi ON b.item_id = bi.id INNER JOIN catalog_items ci ON bi.id = ci.item_ids WHERE price = (SELECT MIN(e.price) FROM marketplace_items e, items d WHERE e.item_id = d.id AND d.item_id = b.item_id AND e.state = 1 AND e.timestamp > ? GROUP BY d.item_id) AND state = 1 AND timestamp > ?"; if (minPrice > 0) { query += " AND CEIL(price + (price / 100)) >= " + minPrice; } @@ -158,9 +158,10 @@ public class MarketPlace { try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement(query)) { statement.setInt(1, Emulator.getIntUnixTimestamp() - 172800); statement.setInt(2, Emulator.getIntUnixTimestamp() - 172800); - if (search.length() > 0) + if (search.length() > 0) { statement.setString(3, "%" + search + "%"); statement.setString(4, "%" + search + "%"); + } try (ResultSet set = statement.executeQuery()) { while (set.next()) { From db14789d6b0bc329683dc0b0f1986bed4059c45f Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Sun, 7 Jun 2020 14:52:07 +0300 Subject: [PATCH 142/215] Check guild membership --- .../habbohotel/catalog/CatalogManager.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java index eea7f628..255031af 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java @@ -1019,23 +1019,23 @@ public class CatalogManager { return; } - InteractionGuildFurni habboItem = (InteractionGuildFurni) Emulator.getGameEnvironment().getItemManager().createItem(habbo.getClient().getHabbo().getHabboInfo().getId(), baseItem, limitedStack, limitedNumber, extradata); - habboItem.setExtradata(""); - habboItem.needsUpdate(true); + Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId); - Emulator.getThreading().run(habboItem); - Emulator.getGameEnvironment().getGuildManager().setGuild(habboItem, guildId); - itemsList.add(habboItem); + if (guild != null && Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, habbo) != null) { + InteractionGuildFurni habboItem = (InteractionGuildFurni) Emulator.getGameEnvironment().getItemManager().createItem(habbo.getClient().getHabbo().getHabboInfo().getId(), baseItem, limitedStack, limitedNumber, extradata); + habboItem.setExtradata(""); + habboItem.needsUpdate(true); - if (baseItem.getName().equals("guild_forum")) { - Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId); - if (guild != null) { + Emulator.getThreading().run(habboItem); + Emulator.getGameEnvironment().getGuildManager().setGuild(habboItem, guildId); + itemsList.add(habboItem); + + if (baseItem.getName().equals("guild_forum")) { guild.setForum(true); guild.needsUpdate = true; guild.run(); } } - } else if (baseItem.getInteractionType().getType() == InteractionMusicDisc.class) { SoundTrack track = Emulator.getGameEnvironment().getItemManager().getSoundTrack(item.getExtradata()); From ed2ec3e6f34e30e0b387789788dc81dce24ce44a Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Sun, 7 Jun 2020 15:05:02 +0300 Subject: [PATCH 143/215] Validate room name and description when creating room & save trade mode --- .../com/eu/habbo/habbohotel/rooms/RoomManager.java | 9 +++++---- .../incoming/navigator/RequestCreateRoomEvent.java | 12 +++++++----- .../incoming/rooms/RoomSettingsSaveEvent.java | 7 ++++++- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java index 76917c82..32fc0cfb 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java @@ -327,10 +327,10 @@ public class RoomManager { } - public Room createRoom(int ownerId, String ownerName, String name, String description, String modelName, int usersMax, int categoryId) { + public Room createRoom(int ownerId, String ownerName, String name, String description, String modelName, int usersMax, int categoryId, int tradeType) { Room room = null; - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO rooms (owner_id, owner_name, name, description, model, users_max, category) VALUES (?, ?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS)) { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO rooms (owner_id, owner_name, name, description, model, users_max, category, trade_mode) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS)) { statement.setInt(1, ownerId); statement.setString(2, ownerName); statement.setString(3, name); @@ -338,6 +338,7 @@ public class RoomManager { statement.setString(5, modelName); statement.setInt(6, usersMax); statement.setInt(7, categoryId); + statement.setInt(8, tradeType); statement.execute(); try (ResultSet set = statement.getGeneratedKeys()) { if (set.next()) @@ -351,8 +352,8 @@ public class RoomManager { } - public Room createRoomForHabbo(Habbo habbo, String name, String description, String modelName, int usersMax, int categoryId) { - Room room = this.createRoom(habbo.getHabboInfo().getId(), habbo.getHabboInfo().getUsername(), name, description, modelName, usersMax, categoryId); + public Room createRoomForHabbo(Habbo habbo, String name, String description, String modelName, int usersMax, int categoryId, int tradeType) { + Room room = this.createRoom(habbo.getHabboInfo().getId(), habbo.getHabboInfo().getUsername(), name, description, modelName, usersMax, categoryId, tradeType); Emulator.getPluginManager().fireEvent(new NavigatorRoomCreatedEvent(habbo, room)); diff --git a/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestCreateRoomEvent.java b/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestCreateRoomEvent.java index 45ba380a..91f183de 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestCreateRoomEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestCreateRoomEvent.java @@ -41,6 +41,12 @@ public class RequestCreateRoomEvent extends MessageHandler { if (tradeType > 2) return; + if (name.length() < 3 || name.length() > 25 || !Emulator.getGameEnvironment().getWordFilter().filter(name, this.client.getHabbo()).equals(name)) + return; + + if (description.length() > 128 || !Emulator.getGameEnvironment().getWordFilter().filter(description, this.client.getHabbo()).equals(description)) + return; + int count = Emulator.getGameEnvironment().getRoomManager().getRoomsForHabbo(this.client.getHabbo()).size(); int max = this.client.getHabbo().getHabboStats().hasActiveClub() ? RoomManager.MAXIMUM_ROOMS_VIP : RoomManager.MAXIMUM_ROOMS_USER; @@ -49,13 +55,9 @@ public class RequestCreateRoomEvent extends MessageHandler { return; } - final Room room = Emulator.getGameEnvironment().getRoomManager().createRoomForHabbo(this.client.getHabbo(), name, description, modelName, maxUsers, categoryId); + final Room room = Emulator.getGameEnvironment().getRoomManager().createRoomForHabbo(this.client.getHabbo(), name, description, modelName, maxUsers, categoryId, tradeType); if (room != null) { - if (this.client.getHabbo().getHabboInfo().getCurrentRoom() != null) { - //Emulator.getGameEnvironment().getRoomManager().leaveRoom(this.client.getHabbo(), this.client.getHabbo().getHabboInfo().getCurrentRoom()); - } - this.client.sendResponse(new RoomCreatedComposer(room)); } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomSettingsSaveEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomSettingsSaveEvent.java index 415809d6..a45eeb89 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomSettingsSaveEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/RoomSettingsSaveEvent.java @@ -23,7 +23,7 @@ public class RoomSettingsSaveEvent extends MessageHandler { if (room.isOwner(this.client.getHabbo())) { String name = this.packet.readString(); - if (name.isEmpty()) { + if (name.trim().isEmpty() || name.length() > 60) { this.client.sendResponse(new RoomEditSettingsErrorComposer(room.getId(), RoomEditSettingsErrorComposer.ROOM_NAME_MISSING, "")); return; } @@ -34,6 +34,11 @@ public class RoomSettingsSaveEvent extends MessageHandler { } String description = this.packet.readString(); + + if (description.length() > 255) { + return; + } + if (!Emulator.getGameEnvironment().getWordFilter().filter(description, this.client.getHabbo()).equals(description)) { this.client.sendResponse(new RoomEditSettingsErrorComposer(room.getId(), RoomEditSettingsErrorComposer.ROOM_DESCRIPTION_BADWORDS, "")); return; From 3df2f8055de834e4a6e2aa05babcb98db73d8ce7 Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Sun, 7 Jun 2020 15:07:00 +0300 Subject: [PATCH 144/215] Ignore spaces when validating room name length on creation --- .../messages/incoming/navigator/RequestCreateRoomEvent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestCreateRoomEvent.java b/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestCreateRoomEvent.java index 91f183de..49328abf 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestCreateRoomEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestCreateRoomEvent.java @@ -41,7 +41,7 @@ public class RequestCreateRoomEvent extends MessageHandler { if (tradeType > 2) return; - if (name.length() < 3 || name.length() > 25 || !Emulator.getGameEnvironment().getWordFilter().filter(name, this.client.getHabbo()).equals(name)) + if (name.trim().length() < 3 || name.length() > 25 || !Emulator.getGameEnvironment().getWordFilter().filter(name, this.client.getHabbo()).equals(name)) return; if (description.length() > 128 || !Emulator.getGameEnvironment().getWordFilter().filter(description, this.client.getHabbo()).equals(description)) From e40d8c4f99e278beb23f5277aeef8de9dffa5bca Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Sun, 7 Jun 2020 15:16:39 +0300 Subject: [PATCH 145/215] Validate post-it color and remove debugging --- .../rooms/items/PostItSaveDataEvent.java | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItSaveDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItSaveDataEvent.java index ff4e1fb7..2922fc94 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItSaveDataEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItSaveDataEvent.java @@ -8,30 +8,25 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.incoming.MessageHandler; +import java.util.Arrays; +import java.util.List; + public class PostItSaveDataEvent extends MessageHandler { + private static List COLORS = Arrays.asList("9CCEFF", "FF9CFF", "9CFF9C", "FFFF33"); + @Override public void handle() throws Exception { int itemId = this.packet.readInt(); String color = this.packet.readString(); - String text = this.packet.readString(); + String text = this.packet.readString().replace(((char) 9) + "", ""); if (text.length() > Emulator.getConfig().getInt("postit.charlimit")) { - ScripterManager.scripterDetected(this.client, Emulator.getTexts().getValue("scripter.warning.sticky.size").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%amount%", text.length() + "").replace("%limit%", "366")); - - if (text.length() >= Emulator.getConfig().getInt("postit.charlimit") + 50) { - this.client.getHabbo().alert("8=====D~~~~~

Computer Says:NO"); - } + ScripterManager.scripterDetected(this.client, Emulator.getTexts().getValue("scripter.warning.sticky.size").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%amount%", text.length() + "").replace("%limit%", Emulator.getConfig().getInt("postit.charlimit") + "")); return; } - text = text.replace(((char) 9) + "", ""); - if (text.startsWith("#") || text.startsWith(" #")) { - String colorCheck = text.split(" ")[0].replace(" ", "").replace(" #", "").replace("#", ""); - - if (colorCheck.length() == 6) { - color = colorCheck; - text = text.replace("#" + colorCheck + " ", ""); - } + if (!COLORS.contains(color)) { + return; } Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom(); From 21c87145ea4e8e0c5d541387c0129789d18e3efa Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Sun, 7 Jun 2020 15:21:29 +0300 Subject: [PATCH 146/215] Prevent adding yourself as a friend --- .../java/com/eu/habbo/habbohotel/messenger/Messenger.java | 8 +++++++- .../messages/incoming/friends/FriendRequestEvent.java | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java b/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java index 15ef797a..59c6083a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java +++ b/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java @@ -214,7 +214,13 @@ public class Messenger { try (ResultSet set = statement.executeQuery()) { while (set.next()) { - this.friends.putIfAbsent(set.getInt("id"), new MessengerBuddy(set)); + MessengerBuddy buddy = new MessengerBuddy(set); + + if (buddy.getId() == habbo.getHabboInfo().getId()) { + continue; + } + + this.friends.putIfAbsent(set.getInt("id"), buddy); } } } catch (SQLException e) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java b/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java index 09f8ec6f..f595d730 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java @@ -25,6 +25,10 @@ public class FriendRequestEvent extends MessageHandler { String username = this.packet.readString(); Habbo habbo = Emulator.getGameServer().getGameClientManager().getHabbo(username); + if (habbo.getHabboInfo().getId() == this.client.getHabbo().getHabboInfo().getId()) { + return; + } + if (Emulator.getPluginManager().fireEvent(new UserRequestFriendshipEvent(this.client.getHabbo(), username, habbo)).isCancelled()) { this.client.sendResponse(new FriendRequestErrorComposer(2)); return; From 828d5110b0402ce4bcd9a734c81a8b3639481865 Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Sun, 7 Jun 2020 15:25:40 +0300 Subject: [PATCH 147/215] Prevent deletion of homeroom --- .../messages/incoming/navigator/RequestDeleteRoomEvent.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestDeleteRoomEvent.java b/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestDeleteRoomEvent.java index 3d7ebf41..84fb20cd 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestDeleteRoomEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestDeleteRoomEvent.java @@ -24,6 +24,10 @@ public class RequestDeleteRoomEvent extends MessageHandler { if (room != null) { if (room.isOwner(this.client.getHabbo())) { + if (room.getId() == this.client.getHabbo().getHabboInfo().getHomeRoom()) { + return; + } + if (Emulator.getPluginManager().fireEvent(new NavigatorRoomDeletedEvent(this.client.getHabbo(), room)).isCancelled()) { return; } From 8892c86e3d88b7734826bd60a194237d36a347a3 Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Sun, 7 Jun 2020 15:40:34 +0300 Subject: [PATCH 148/215] Pick up pets & bots on room deletion --- .../eu/habbo/habbohotel/bots/BotManager.java | 23 +++++++------ .../navigator/RequestDeleteRoomEvent.java | 32 +++++++++++++++++++ 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java index 32bbc7cb..a716e4e1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.*; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.outgoing.generic.alerts.BotErrorComposer; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer; @@ -165,30 +166,34 @@ public class BotManager { } public void pickUpBot(Bot bot, Habbo habbo) { + HabboInfo receiverInfo = habbo == null ? Emulator.getGameEnvironment().getHabboManager().getHabboInfo(bot.getOwnerId()) : habbo.getHabboInfo(); - if (bot != null && habbo != null) { + if (bot != null) { BotPickUpEvent pickedUpEvent = new BotPickUpEvent(bot, habbo); Emulator.getPluginManager().fireEvent(pickedUpEvent); if (pickedUpEvent.isCancelled()) return; - if (bot.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasPermission(Permission.ACC_ANYROOMOWNER)) { - if (!habbo.hasPermission(Permission.ACC_UNLIMITED_BOTS) && habbo.getInventory().getBotsComponent().getBots().size() >= BotManager.MAXIMUM_BOT_INVENTORY_SIZE) { + if (habbo == null || (bot.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasPermission(Permission.ACC_ANYROOMOWNER))) { + if (habbo != null && !habbo.hasPermission(Permission.ACC_UNLIMITED_BOTS) && habbo.getInventory().getBotsComponent().getBots().size() >= BotManager.MAXIMUM_BOT_INVENTORY_SIZE) { habbo.alert(Emulator.getTexts().getValue("error.bots.max.inventory").replace("%amount%", BotManager.MAXIMUM_BOT_INVENTORY_SIZE + "")); return; } - bot.onPickUp(habbo, habbo.getHabboInfo().getCurrentRoom()); - habbo.getHabboInfo().getCurrentRoom().removeBot(bot); + bot.onPickUp(habbo, receiverInfo.getCurrentRoom()); + receiverInfo.getCurrentRoom().removeBot(bot); bot.stopFollowingHabbo(); - bot.setOwnerId(habbo.getHabboInfo().getId()); - bot.setOwnerName(habbo.getHabboInfo().getUsername()); + bot.setOwnerId(receiverInfo.getId()); + bot.setOwnerName(receiverInfo.getUsername()); bot.needsUpdate(true); Emulator.getThreading().run(bot); - habbo.getInventory().getBotsComponent().addBot(bot); - habbo.getClient().sendResponse(new AddBotComposer(bot)); + Habbo receiver = habbo == null ? Emulator.getGameEnvironment().getHabboManager().getHabbo(receiverInfo.getId()) : habbo; + if (receiver != null) { + receiver.getInventory().getBotsComponent().addBot(bot); + receiver.getClient().sendResponse(new AddBotComposer(bot)); + } } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestDeleteRoomEvent.java b/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestDeleteRoomEvent.java index 84fb20cd..aaea208d 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestDeleteRoomEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/navigator/RequestDeleteRoomEvent.java @@ -1,10 +1,15 @@ package com.eu.habbo.messages.incoming.navigator; import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.guilds.Guild; import com.eu.habbo.habbohotel.modtool.ScripterManager; +import com.eu.habbo.habbohotel.pets.Pet; +import com.eu.habbo.habbohotel.pets.RideablePet; import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.incoming.MessageHandler; +import com.eu.habbo.messages.outgoing.inventory.AddPetComposer; import com.eu.habbo.plugin.events.navigator.NavigatorRoomDeletedEvent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -12,6 +17,8 @@ import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; public class RequestDeleteRoomEvent extends MessageHandler { private static final Logger LOGGER = LoggerFactory.getLogger(RequestDeleteRoomEvent.class); @@ -35,6 +42,31 @@ public class RequestDeleteRoomEvent extends MessageHandler { room.ejectAll(); room.ejectUserFurni(room.getOwnerId()); + List bots = new ArrayList<>(room.getCurrentBots().valueCollection()); + for (Bot bot : bots) { + Emulator.getGameEnvironment().getBotManager().pickUpBot(bot, null); + } + + List pets = new ArrayList<>(room.getCurrentPets().valueCollection()); + for (Pet pet : pets) { + if (pet instanceof RideablePet) { + RideablePet rideablePet = (RideablePet) pet; + if (rideablePet.getRider() != null) { + rideablePet.getRider().getHabboInfo().dismountPet(true); + } + } + + pet.removeFromRoom(); + Emulator.getThreading().run(pet); + + Habbo owner = Emulator.getGameEnvironment().getHabboManager().getHabbo(pet.getUserId()); + + if (owner != null) { + owner.getClient().sendResponse(new AddPetComposer(pet)); + owner.getInventory().getPetsComponent().addPet(pet); + } + } + if (room.getGuildId() > 0) { Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(room.getGuildId()); From 2af52de0ca6a0c3eb1ee9eeeb10371f9df5f1b0f Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Sun, 7 Jun 2020 15:44:57 +0300 Subject: [PATCH 149/215] Remove horse items properly when used --- .../messages/incoming/rooms/pets/PetUseItemEvent.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PetUseItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PetUseItemEvent.java index 7ec34b79..ff31e8e0 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PetUseItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PetUseItemEvent.java @@ -82,8 +82,11 @@ public class PetUseItemEvent extends MessageHandler { if (((HorsePet) pet).needsUpdate) { Emulator.getThreading().run(pet); this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RoomPetHorseFigureComposer((HorsePet) pet).compose()); - this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RemoveFloorItemComposer(item).compose()); - Emulator.getThreading().run(new QueryDeleteHabboItem(item.getId())); + + room.removeHabboItem(item); + room.sendComposer(new RemoveFloorItemComposer(item, true).compose()); + item.setRoomId(0); + Emulator.getGameEnvironment().getItemManager().deleteItem(item); } } else if (pet instanceof MonsterplantPet) { if (item.getBaseItem().getName().equalsIgnoreCase("mnstr_revival")) { From 0a0091e5634491dfbdc2ea196819d3c503672520 Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Sun, 7 Jun 2020 15:49:26 +0300 Subject: [PATCH 150/215] Disable avatar rotation with vending machines if on a chair --- .../items/interactions/InteractionVendingMachine.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java index 33e0679d..674dcef2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java @@ -164,6 +164,11 @@ public class InteractionVendingMachine extends HabboItem { } private void rotateToMachine(RoomUnit unit) { + if (unit.getCurrentLocation().getState() != RoomTileState.OPEN) { + // if sitting on a chair or laying on a bed, skip rotating altogether + return; + } + RoomUserRotation rotation = RoomUserRotation.values()[Rotation.Calculate(unit.getX(), unit.getY(), this.getX(), this.getY())]; boolean onlyHead = false; From ab04c491fd6cc53616be6035f7769b0741ba12ee Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Sun, 7 Jun 2020 15:54:08 +0300 Subject: [PATCH 151/215] Ignore case with room-specific wordfilter --- src/main/java/com/eu/habbo/habbohotel/rooms/Room.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 9079713e..5251c9b5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -85,6 +85,7 @@ import java.util.List; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; +import java.util.regex.Pattern; import java.util.stream.Collectors; public class Room implements Comparable, ISerialize, Runnable { @@ -3076,7 +3077,7 @@ public class Room implements Comparable, ISerialize, Runnable { if (!this.wordFilterWords.isEmpty()) { if (!habbo.hasPermission(Permission.ACC_CHAT_NO_FILTER)) { for (String string : this.wordFilterWords) { - roomChatMessage.setMessage(roomChatMessage.getMessage().replace(string, "bobba")); + roomChatMessage.setMessage(roomChatMessage.getMessage().replaceAll("(?i)" + Pattern.quote(string), "bobba")); } } } From 9e5a00b052f4ccf8b3ef3b9289de4fb6ae1a673a Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Sun, 7 Jun 2020 16:03:38 +0300 Subject: [PATCH 152/215] Make vending machines walkable if desired --- .../InteractionVendingMachine.java | 36 +------------------ 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java index 674dcef2..770c9732 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java @@ -18,7 +18,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.concurrent.ExecutionException; -public class InteractionVendingMachine extends HabboItem { +public class InteractionVendingMachine extends InteractionDefault { public InteractionVendingMachine(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); this.setExtradata("0"); @@ -29,16 +29,6 @@ public class InteractionVendingMachine extends HabboItem { this.setExtradata("0"); } - @Override - public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects) { - return true; - } - - @Override - public boolean isWalkable() { - return false; - } - @Override public void onClick(GameClient client, Room room, Object[] objects) throws Exception { super.onClick(client, room, objects); @@ -122,21 +112,6 @@ public class InteractionVendingMachine extends HabboItem { } } - @Override - public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { - - } - - @Override - public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { - - } - - @Override - public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { - - } - @Override public void run() { super.run(); @@ -149,15 +124,6 @@ public class InteractionVendingMachine extends HabboItem { } } - - @Override - public void serializeExtradata(ServerMessage serverMessage) { - serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); - - super.serializeExtradata(serverMessage); - } - @Override public boolean isUsable() { return true; From a0c1973622ec560cc4d5fc069b4627d183430b05 Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Sun, 7 Jun 2020 16:19:05 +0300 Subject: [PATCH 153/215] Customizable gift wrapping config & gift purchase validation --- sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql | 6 +++- .../catalog/CatalogBuyItemAsGiftEvent.java | 5 +++ .../catalog/GiftConfigurationComposer.java | 34 +++++++------------ .../com/eu/habbo/plugin/PluginManager.java | 5 +++ 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql index 46a1f7fa..8e71d599 100644 --- a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql +++ b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql @@ -20,4 +20,8 @@ INSERT INTO `emulator_texts`(`key`, `value`) VALUES ('error.bots.max.inventory', UPDATE `emulator_texts` SET `value` = 'You\'ve reached the maximum amount of pets in your inventory! The Limit is %amount%!' WHERE `key` = 'error.pets.max.inventory'; -- Tradelock counter -ALTER TABLE `users_settings` ADD `tradelock_amount` INT(11) NOT NULL DEFAULT '0' AFTER `helper_level`; \ No newline at end of file +ALTER TABLE `users_settings` ADD `tradelock_amount` INT(11) NOT NULL DEFAULT '0' AFTER `helper_level`; + +-- Gift wrapping configuration +INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.gifts.box_types', '0,1,2,3,4,5,6,8'); +INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.gifts.ribbon_types', '0,1,2,3,4,5,6,7,8,9,10'); diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemAsGiftEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemAsGiftEvent.java index f201cb83..7504c50a 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemAsGiftEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemAsGiftEvent.java @@ -75,6 +75,11 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler { return; } + if (!GiftConfigurationComposer.BOX_TYPES.contains(color) || !GiftConfigurationComposer.RIBBON_TYPES.contains(ribbonId)) { + this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose()); + return; + } + Integer iItemId = Emulator.getGameEnvironment().getCatalogManager().giftWrappers.get(spriteId); if (iItemId == null) diff --git a/src/main/java/com/eu/habbo/messages/outgoing/catalog/GiftConfigurationComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/catalog/GiftConfigurationComposer.java index cf66be10..77328100 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/catalog/GiftConfigurationComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/catalog/GiftConfigurationComposer.java @@ -5,9 +5,14 @@ import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.Outgoing; +import java.util.Arrays; +import java.util.List; import java.util.Map; public class GiftConfigurationComposer extends MessageComposer { + public static List BOX_TYPES = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 8); + public static List RIBBON_TYPES = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + @Override protected ServerMessage composeInternal() { this.response.init(Outgoing.GiftConfigurationComposer); @@ -19,28 +24,15 @@ public class GiftConfigurationComposer extends MessageComposer { this.response.appendInt(i); } - this.response.appendInt(8); - this.response.appendInt(0); - this.response.appendInt(1); - this.response.appendInt(2); - this.response.appendInt(3); - this.response.appendInt(4); - this.response.appendInt(5); - this.response.appendInt(6); - this.response.appendInt(8); + this.response.appendInt(BOX_TYPES.size()); + for (Integer type : BOX_TYPES) { + this.response.appendInt(type); + } - this.response.appendInt(11); - this.response.appendInt(0); - this.response.appendInt(1); - this.response.appendInt(2); - this.response.appendInt(3); - this.response.appendInt(4); - this.response.appendInt(5); - this.response.appendInt(6); - this.response.appendInt(7); - this.response.appendInt(8); - this.response.appendInt(9); - this.response.appendInt(10); + this.response.appendInt(RIBBON_TYPES.size()); + for (Integer type : RIBBON_TYPES) { + this.response.appendInt(type); + } this.response.appendInt(Emulator.getGameEnvironment().getCatalogManager().giftFurnis.size()); diff --git a/src/main/java/com/eu/habbo/plugin/PluginManager.java b/src/main/java/com/eu/habbo/plugin/PluginManager.java index 50565833..20b9b0c7 100644 --- a/src/main/java/com/eu/habbo/plugin/PluginManager.java +++ b/src/main/java/com/eu/habbo/plugin/PluginManager.java @@ -34,6 +34,7 @@ import com.eu.habbo.messages.incoming.hotelview.HotelViewRequestLTDAvailabilityE import com.eu.habbo.messages.incoming.rooms.promotions.BuyRoomPromotionEvent; import com.eu.habbo.messages.incoming.users.ChangeNameCheckUsernameEvent; import com.eu.habbo.messages.outgoing.catalog.DiscountComposer; +import com.eu.habbo.messages.outgoing.catalog.GiftConfigurationComposer; import com.eu.habbo.messages.outgoing.navigator.NewNavigatorEventCategoriesComposer; import com.eu.habbo.plugin.events.emulator.EmulatorConfigUpdatedEvent; import com.eu.habbo.plugin.events.emulator.EmulatorLoadedEvent; @@ -58,6 +59,7 @@ import java.net.URLClassLoader; import java.util.Arrays; import java.util.NoSuchElementException; import java.util.Objects; +import java.util.stream.Collectors; public class PluginManager { @@ -154,6 +156,9 @@ public class PluginManager { BotManager.MAXIMUM_BOT_INVENTORY_SIZE = Emulator.getConfig().getInt("hotel.bots.max.inventory"); PetManager.MAXIMUM_PET_INVENTORY_SIZE = Emulator.getConfig().getInt("hotel.pets.max.inventory"); + GiftConfigurationComposer.BOX_TYPES = Arrays.stream(Emulator.getConfig().getValue("hotel.gifts.box_types").split(",")).mapToInt(Integer::parseInt).boxed().collect(Collectors.toList()); + GiftConfigurationComposer.RIBBON_TYPES = Arrays.stream(Emulator.getConfig().getValue("hotel.gifts.ribbon_types").split(",")).mapToInt(Integer::parseInt).boxed().collect(Collectors.toList()); + NewNavigatorEventCategoriesComposer.CATEGORIES.clear(); for (String category : Emulator.getConfig().getValue("navigator.eventcategories", "").split(";")) { try { From 6bf8bd14dba47f83012f2a040eefd689ef4f578c Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Mon, 8 Jun 2020 14:01:41 +0300 Subject: [PATCH 154/215] Refactor trade start and disallow trading ignored users --- .../incoming/trading/TradeStartEvent.java | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/trading/TradeStartEvent.java b/src/main/java/com/eu/habbo/messages/incoming/trading/TradeStartEvent.java index 836424c5..a5e4ae13 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/trading/TradeStartEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/trading/TradeStartEvent.java @@ -33,25 +33,31 @@ public class TradeStartEvent extends MessageHandler { return; } - if (targetUser != null) { - if (!this.client.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.TRADING)) { - if (this.client.getHabbo().getHabboStats().allowTrade()) { - if (!targetUser.getRoomUnit().hasStatus(RoomUnitStatus.TRADING)) { - if (targetUser.getHabboStats().allowTrade()) { - room.startTrade(this.client.getHabbo(), targetUser); - } else { - this.client.sendResponse(new TradeStartFailComposer(TradeStartFailComposer.TARGET_TRADING_NOT_ALLOWED, targetUser.getHabboInfo().getUsername())); - } - } else { - this.client.sendResponse(new TradeStartFailComposer(TradeStartFailComposer.TARGET_ALREADY_TRADING, targetUser.getHabboInfo().getUsername())); - } - } else { - this.client.sendResponse(new TradeStartFailComposer(TradeStartFailComposer.YOU_TRADING_OFF)); - } - } else { - this.client.sendResponse(new TradeStartFailComposer(TradeStartFailComposer.YOU_ALREADY_TRADING)); - } + if (targetUser == null) return; + + if (targetUser.getHabboStats().userIgnored(this.client.getHabbo().getHabboInfo().getId())) return; + + if (this.client.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.TRADING)) { + this.client.sendResponse(new TradeStartFailComposer(TradeStartFailComposer.YOU_ALREADY_TRADING)); + return; } + + if (!this.client.getHabbo().getHabboStats().allowTrade()) { + this.client.sendResponse(new TradeStartFailComposer(TradeStartFailComposer.YOU_TRADING_OFF)); + return; + } + + if (targetUser.getRoomUnit().hasStatus(RoomUnitStatus.TRADING)) { + this.client.sendResponse(new TradeStartFailComposer(TradeStartFailComposer.TARGET_ALREADY_TRADING, targetUser.getHabboInfo().getUsername())); + return; + } + + if (!targetUser.getHabboStats().allowTrade() { + this.client.sendResponse(new TradeStartFailComposer(TradeStartFailComposer.TARGET_TRADING_NOT_ALLOWED, targetUser.getHabboInfo().getUsername())); + return; + } + + room.startTrade(this.client.getHabbo(), targetUser); } } } From 62ab54a3e3004b202ccd8668686516c7b36ddec1 Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Mon, 8 Jun 2020 14:03:31 +0300 Subject: [PATCH 155/215] Fix syntax error --- .../com/eu/habbo/messages/incoming/trading/TradeStartEvent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/trading/TradeStartEvent.java b/src/main/java/com/eu/habbo/messages/incoming/trading/TradeStartEvent.java index a5e4ae13..a776adcd 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/trading/TradeStartEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/trading/TradeStartEvent.java @@ -52,7 +52,7 @@ public class TradeStartEvent extends MessageHandler { return; } - if (!targetUser.getHabboStats().allowTrade() { + if (!targetUser.getHabboStats().allowTrade()) { this.client.sendResponse(new TradeStartFailComposer(TradeStartFailComposer.TARGET_TRADING_NOT_ALLOWED, targetUser.getHabboInfo().getUsername())); return; } From 8876f07147e13cd4bf2850d8154cae14d4bb225b Mon Sep 17 00:00:00 2001 From: ArpyAge Date: Mon, 8 Jun 2020 17:38:22 +0200 Subject: [PATCH 156/215] Buildheight Plugin Event --- .../com/eu/habbo/habbohotel/rooms/Room.java | 18 ++++++++++- .../furniture/FurnitureBuildheightEvent.java | 30 +++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/eu/habbo/plugin/events/furniture/FurnitureBuildheightEvent.java diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 5251c9b5..ef39ec82 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -4446,7 +4446,16 @@ public class Room implements Comparable, ISerialize, Runnable { return fits; } - item.setZ(tile.getStackHeight()); + double height = tile.getStackHeight(); + + if (Emulator.getPluginManager().isRegistered(FurnitureBuildheightEvent.class, true)) { + FurnitureBuildheightEvent event = (FurnitureBuildheightEvent) Emulator.getPluginManager().fireEvent(new FurnitureBuildheightEvent(item, owner, 0.00, height)); + if (event.hasChangedHeight()) { + height = event.getUpdatedHeight(); + } + } + + item.setZ(height); item.setX(tile.x); item.setY(tile.y); item.setRotation(rotation); @@ -4562,6 +4571,13 @@ public class Room implements Comparable, ISerialize, Runnable { height = this.getStackHeight(tile.x, tile.y, false, item); } + if (Emulator.getPluginManager().isRegistered(FurnitureBuildheightEvent.class, true)) { + FurnitureBuildheightEvent event = (FurnitureBuildheightEvent) Emulator.getPluginManager().fireEvent(new FurnitureBuildheightEvent(item, actor, 0.00, height)); + if (event.hasChangedHeight()) { + height = event.getUpdatedHeight(); + } + } + if(height > 40d) return FurnitureMovementError.CANT_STACK; item.setX(tile.x); diff --git a/src/main/java/com/eu/habbo/plugin/events/furniture/FurnitureBuildheightEvent.java b/src/main/java/com/eu/habbo/plugin/events/furniture/FurnitureBuildheightEvent.java new file mode 100644 index 00000000..ada589e7 --- /dev/null +++ b/src/main/java/com/eu/habbo/plugin/events/furniture/FurnitureBuildheightEvent.java @@ -0,0 +1,30 @@ +package com.eu.habbo.plugin.events.furniture; + +import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboItem; + +public class FurnitureBuildheightEvent extends FurnitureUserEvent { + + public final double oldHeight; + public final double newHeight; + + private double updatedHeight; + + private boolean changedHeight = false; + + public FurnitureBuildheightEvent(HabboItem furniture, Habbo habbo, double oldHeight, double newHeight) { + super(furniture, habbo); + + this.oldHeight = oldHeight; + this.newHeight = newHeight; + } + + public void setNewHeight(double updatedHeight) { + this.updatedHeight = updatedHeight; + this.changedHeight = true; + } + + public boolean hasChangedHeight() { return changedHeight; } + + public double getUpdatedHeight() { return updatedHeight; } +} From f18529c3df38449008e0b249010809af0e4753cc Mon Sep 17 00:00:00 2001 From: ArpyAge Date: Mon, 8 Jun 2020 17:46:19 +0200 Subject: [PATCH 157/215] Username Talk Plugin Event --- .../com/eu/habbo/habbohotel/rooms/Room.java | 18 ++++++++--- .../events/users/UsernameTalkEvent.java | 31 +++++++++++++++++++ 2 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/eu/habbo/plugin/events/users/UsernameTalkEvent.java diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 5251c9b5..57779c68 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -54,10 +54,7 @@ import com.eu.habbo.plugin.events.furniture.*; import com.eu.habbo.plugin.events.rooms.RoomLoadedEvent; import com.eu.habbo.plugin.events.rooms.RoomUnloadedEvent; import com.eu.habbo.plugin.events.rooms.RoomUnloadingEvent; -import com.eu.habbo.plugin.events.users.UserExitRoomEvent; -import com.eu.habbo.plugin.events.users.UserIdleEvent; -import com.eu.habbo.plugin.events.users.UserRightsTakenEvent; -import com.eu.habbo.plugin.events.users.UserRolledEvent; +import com.eu.habbo.plugin.events.users.*; import com.eu.habbo.threading.runnables.YouAreAPirate; import gnu.trove.TCollections; import gnu.trove.iterator.TIntObjectIterator; @@ -3110,7 +3107,18 @@ public class Room implements Comparable, ISerialize, Runnable { habbo.getHabboStats().chatCounter += 2; - ServerMessage prefixMessage = roomChatMessage.getHabbo().getHabboInfo().getRank().hasPrefix() ? new RoomUserNameChangedComposer(habbo, true).compose() : null; + ServerMessage prefixMessage = null; + + if (Emulator.getPluginManager().isRegistered(UsernameTalkEvent.class, true)) { + UsernameTalkEvent usernameTalkEvent = (UsernameTalkEvent) Emulator.getPluginManager().fireEvent(new UsernameTalkEvent(habbo, roomChatMessage, chatType)); + if (usernameTalkEvent.hasCustomComposer()) { + prefixMessage = usernameTalkEvent.getCustomComposer(); + } + } + + if(prefixMessage != null) { + prefixMessage = roomChatMessage.getHabbo().getHabboInfo().getRank().hasPrefix() ? new RoomUserNameChangedComposer(habbo, true).compose() : null; + } ServerMessage clearPrefixMessage = prefixMessage != null ? new RoomUserNameChangedComposer(habbo).compose() : null; Rectangle show = this.roomSpecialTypes.tentAt(habbo.getRoomUnit().getCurrentLocation()); diff --git a/src/main/java/com/eu/habbo/plugin/events/users/UsernameTalkEvent.java b/src/main/java/com/eu/habbo/plugin/events/users/UsernameTalkEvent.java new file mode 100644 index 00000000..752afdc9 --- /dev/null +++ b/src/main/java/com/eu/habbo/plugin/events/users/UsernameTalkEvent.java @@ -0,0 +1,31 @@ +package com.eu.habbo.plugin.events.users; + +import com.eu.habbo.habbohotel.rooms.RoomChatMessage; +import com.eu.habbo.habbohotel.rooms.RoomChatType; +import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.messages.ServerMessage; + +public class UsernameTalkEvent extends UserEvent { + public final RoomChatMessage chatMessage; + public final RoomChatType chatType; + + private ServerMessage customComposer = null; + + public UsernameTalkEvent(Habbo habbo, RoomChatMessage chatMessage, RoomChatType chatType) { + super(habbo); + this.chatMessage = chatMessage; + this.chatType = chatType; + } + + public void setCustomComposer(ServerMessage customComposer) { + this.customComposer = customComposer; + } + + public boolean hasCustomComposer() { + return this.customComposer != null; + } + + public ServerMessage getCustomComposer() { + return this.customComposer; + } +} From bc30623a051a671893a88069c028703b01efa552 Mon Sep 17 00:00:00 2001 From: Swirny <140-Swirny@users.noreply.git.krews.org> Date: Fri, 12 Jun 2020 14:53:40 -0400 Subject: [PATCH 158/215] Make flood time configurable --- sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql | 3 +++ src/main/java/com/eu/habbo/habbohotel/rooms/Room.java | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql index 8e71d599..cd58db0d 100644 --- a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql +++ b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql @@ -25,3 +25,6 @@ ALTER TABLE `users_settings` ADD `tradelock_amount` INT(11) NOT NULL DEFAULT '0' -- Gift wrapping configuration INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.gifts.box_types', '0,1,2,3,4,5,6,8'); INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.gifts.ribbon_types', '0,1,2,3,4,5,6,7,8,9,10'); + +-- Configurable mute time +INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.flood.mute.time', '30'); \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 5251c9b5..e0dee0a1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -204,6 +204,7 @@ public class Room implements Comparable, ISerialize, Runnable { private int idleCycles; private volatile int unitCounter; private volatile int rollerSpeed; + private int muteTime = Emulator.getConfig().getInt("hotel.flood.mute.time"); private long rollerCycle = System.currentTimeMillis(); private volatile int lastTimerReset = Emulator.getIntUnixTimestamp(); private volatile boolean muted; @@ -1209,11 +1210,11 @@ public class Room implements Comparable, ISerialize, Runnable { if (floodRights || !hasRights) { if (this.chatProtection == 0) { - this.floodMuteHabbo(habbo, 30); + this.floodMuteHabbo(habbo, muteTime); } else if (this.chatProtection == 1 && habbo.getHabboStats().chatCounter > 4) { - this.floodMuteHabbo(habbo, 30); + this.floodMuteHabbo(habbo, muteTime); } else if (this.chatProtection == 2 && habbo.getHabboStats().chatCounter > 5) { - this.floodMuteHabbo(habbo, 30); + this.floodMuteHabbo(habbo, muteTime); } } } From b5984259795f2510ccf4fdac1ea2934ca49900bd Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Fri, 12 Jun 2020 22:10:05 +0200 Subject: [PATCH 159/215] Fix flood race conditions --- .../com/eu/habbo/habbohotel/rooms/Room.java | 54 ++++++++++--------- .../eu/habbo/habbohotel/users/HabboStats.java | 2 +- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index e0dee0a1..27f8c25e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -204,12 +204,13 @@ public class Room implements Comparable, ISerialize, Runnable { private int idleCycles; private volatile int unitCounter; private volatile int rollerSpeed; - private int muteTime = Emulator.getConfig().getInt("hotel.flood.mute.time"); + private final int muteTime = Emulator.getConfig().getInt("hotel.flood.mute.time", 30); private long rollerCycle = System.currentTimeMillis(); private volatile int lastTimerReset = Emulator.getIntUnixTimestamp(); private volatile boolean muted; private RoomSpecialTypes roomSpecialTypes; private TraxManager traxManager; + private boolean cycleOdd; private long cycleTimestamp; public Room(ResultSet set) throws SQLException { @@ -1118,6 +1119,7 @@ public class Room implements Comparable, ISerialize, Runnable { } private void cycle() { + this.cycleOdd = !this.cycleOdd; this.cycleTimestamp = System.currentTimeMillis(); final boolean[] foundRightHolder = {false}; @@ -1199,28 +1201,10 @@ public class Room implements Comparable, ISerialize, Runnable { habbo.getHabboStats().mutedBubbleTracker = false; this.sendComposer(new RoomUserIgnoredComposer(habbo, RoomUserIgnoredComposer.UNIGNORED).compose()); } - if (!habbo.hasPermission(Permission.ACC_CHAT_NO_FLOOD) && habbo.getHabboStats().chatCounter > 0) { - //if (habbo.getRoomUnit().talkTimeOut == 0 || currentTimestamp - habbo.getRoomUnit().talkTimeOut < 0) - { - habbo.getHabboStats().chatCounter--; - if (habbo.getHabboStats().chatCounter > 3) { - final boolean floodRights = Emulator.getConfig().getBoolean("flood.with.rights"); - final boolean hasRights = this.hasRights(habbo); - - if (floodRights || !hasRights) { - if (this.chatProtection == 0) { - this.floodMuteHabbo(habbo, muteTime); - } else if (this.chatProtection == 1 && habbo.getHabboStats().chatCounter > 4) { - this.floodMuteHabbo(habbo, muteTime); - } else if (this.chatProtection == 2 && habbo.getHabboStats().chatCounter > 5) { - this.floodMuteHabbo(habbo, muteTime); - } - } - } - } - } else { - habbo.getHabboStats().chatCounter = 0; + // Substract 1 from the chatCounter every odd cycle, which is every (500ms * 2). + if (this.cycleOdd && habbo.getHabboStats().chatCounter.get() > 0) { + habbo.getHabboStats().chatCounter.decrementAndGet(); } if (this.cycleRoomUnit(habbo.getRoomUnit(), RoomUnitType.USER)) { @@ -3019,7 +3003,7 @@ public class Room implements Comparable, ISerialize, Runnable { public void floodMuteHabbo(Habbo habbo, int timeOut) { habbo.getHabboStats().mutedCount++; timeOut += (timeOut * (int) Math.ceil(Math.pow(habbo.getHabboStats().mutedCount, 2))); - habbo.getHabboStats().chatCounter = 0; + habbo.getHabboStats().chatCounter.set(0); habbo.mute(timeOut, true); } @@ -3050,7 +3034,7 @@ public class Room implements Comparable, ISerialize, Runnable { } habbo.getHabboStats().lastChat = millis; if (roomChatMessage != null && roomChatMessage.getMessage().equalsIgnoreCase("i am a pirate")) { - habbo.getHabboStats().chatCounter += 2; + habbo.getHabboStats().chatCounter.addAndGet(1); Emulator.getThreading().run(new YouAreAPirate(habbo, this)); return; } @@ -3109,7 +3093,27 @@ public class Room implements Comparable, ISerialize, Runnable { } } - habbo.getHabboStats().chatCounter += 2; + if (!habbo.hasPermission(Permission.ACC_CHAT_NO_FLOOD)) { + final int chatCounter = habbo.getHabboStats().chatCounter.addAndGet(1); + + if (chatCounter > 3) { + final boolean floodRights = Emulator.getConfig().getBoolean("flood.with.rights"); + final boolean hasRights = this.hasRights(habbo); + + if (floodRights || !hasRights) { + if (this.chatProtection == 0) { + this.floodMuteHabbo(habbo, muteTime); + return; + } else if (this.chatProtection == 1 && chatCounter > 4) { + this.floodMuteHabbo(habbo, muteTime); + return; + } else if (this.chatProtection == 2 && chatCounter > 5) { + this.floodMuteHabbo(habbo, muteTime); + return; + } + } + } + } ServerMessage prefixMessage = roomChatMessage.getHabbo().getHabboInfo().getRank().hasPrefix() ? new RoomUserNameChangedComposer(habbo, true).compose() : null; ServerMessage clearPrefixMessage = prefixMessage != null ? new RoomUserNameChangedComposer(habbo).compose() : null; diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java index d40f1682..d7b03956 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java @@ -71,7 +71,7 @@ public class HabboStats implements Runnable { public int helpersLevel; public boolean perkTrade; public long roomEnterTimestamp; - public int chatCounter; + public AtomicInteger chatCounter = new AtomicInteger(0); public long lastChat; public long lastUsersSearched; public boolean nux; From df40c69f79d71dc94bc78135af17f4b7cc91a317 Mon Sep 17 00:00:00 2001 From: ArpyAge Date: Sun, 21 Jun 2020 02:28:34 +0200 Subject: [PATCH 160/215] Made an oopsie, changed != to == --- src/main/java/com/eu/habbo/habbohotel/rooms/Room.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 57779c68..885a5140 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -3116,7 +3116,7 @@ public class Room implements Comparable, ISerialize, Runnable { } } - if(prefixMessage != null) { + if(prefixMessage == null) { prefixMessage = roomChatMessage.getHabbo().getHabboInfo().getRank().hasPrefix() ? new RoomUserNameChangedComposer(habbo, true).compose() : null; } ServerMessage clearPrefixMessage = prefixMessage != null ? new RoomUserNameChangedComposer(habbo).compose() : null; From 2f51d325117e206209ce275d41ba61f755a76870 Mon Sep 17 00:00:00 2001 From: Ilany Date: Wed, 1 Jul 2020 13:28:22 +0200 Subject: [PATCH 161/215] Fix visitor bot not including room owner anymore --- src/main/java/com/eu/habbo/habbohotel/bots/VisitorBot.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/VisitorBot.java b/src/main/java/com/eu/habbo/habbohotel/bots/VisitorBot.java index bfb9b297..dd6f0849 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/VisitorBot.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/VisitorBot.java @@ -56,7 +56,7 @@ public class VisitorBot extends Bot { public void onUserEnter(Habbo habbo) { if (!this.showedLog) { if (habbo.getHabboInfo().getCurrentRoom() != null) { - this.visits = Emulator.getGameEnvironment().getModToolManager().getVisitsForRoom(habbo.getHabboInfo().getCurrentRoom(), 10, true, habbo.getHabboInfo().getLastOnline(), Emulator.getIntUnixTimestamp()); + this.visits = Emulator.getGameEnvironment().getModToolManager().getVisitsForRoom(habbo.getHabboInfo().getCurrentRoom(), 10, true, habbo.getHabboInfo().getLastOnline(), Emulator.getIntUnixTimestamp(), habbo.getHabboInfo().getCurrentRoom().getOwnerName()); if (this.visits.isEmpty()) { this.talk(Emulator.getTexts().getValue("bots.visitor.no_visits")); From 7b799a4dd8c2a70120f2a3f518ed1547ed2b7896 Mon Sep 17 00:00:00 2001 From: Rodolfo-XDR Date: Thu, 2 Jul 2020 15:44:13 -0500 Subject: [PATCH 162/215] New Trax Manager and other fixes. --- .../commands/EmptyInventoryCommand.java | 8 + .../InteractionBackgroundToner.java | 9 +- .../interactions/InteractionJukeBox.java | 6 +- .../habbo/habbohotel/rooms/TraxManager.java | 291 +++++++++++++----- .../incoming/guilds/RequestGuildBuyEvent.java | 12 +- .../jukebox/JukeBoxAddSoundTrackEvent.java | 4 +- .../com/eu/habbo/plugin/PluginManager.java | 3 + 7 files changed, 243 insertions(+), 90 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/EmptyInventoryCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/EmptyInventoryCommand.java index ba7323a5..a75b176f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/EmptyInventoryCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/EmptyInventoryCommand.java @@ -2,8 +2,10 @@ package com.eu.habbo.habbohotel.commands; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; +import com.eu.habbo.habbohotel.items.interactions.InteractionJukeBox; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; +import com.eu.habbo.habbohotel.rooms.TraxManager; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.outgoing.inventory.InventoryItemsComposer; @@ -42,6 +44,12 @@ public class EmptyInventoryCommand extends Command { TIntObjectMap items = new TIntObjectHashMap<>(); items.putAll(habbo.getInventory().getItemsComponent().getItems()); habbo.getInventory().getItemsComponent().getItems().clear(); + + for (HabboItem item : items.valueCollection()) { + if(item instanceof InteractionJukeBox) + TraxManager.removeAllSongs((InteractionJukeBox) item); + } + Emulator.getThreading().run(new QueryDeleteHabboItems(items)); habbo.getClient().sendResponse(new InventoryRefreshComposer()); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBackgroundToner.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBackgroundToner.java index 840ede43..c74e91aa 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBackgroundToner.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBackgroundToner.java @@ -58,9 +58,12 @@ public class InteractionBackgroundToner extends HabboItem { public void onClick(GameClient client, Room room, Object[] objects) throws Exception { super.onClick(client, room, objects); - if (client.getHabbo().getRoomUnit().cmdSit && client.getHabbo().getRoomUnit().getEffectId() == 1337) { - Emulator.getThreading().run(new BackgroundAnimation(this, room)); - return; + if(client != null) + { + if (client.getHabbo().getRoomUnit().cmdSit && client.getHabbo().getRoomUnit().getEffectId() == 1337) { + new BackgroundAnimation(this, room).run(); + return; + } } if (this.getExtradata().split(":").length == 4) { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionJukeBox.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionJukeBox.java index 95eddcd3..bc5744cd 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionJukeBox.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionJukeBox.java @@ -61,15 +61,13 @@ public class InteractionJukeBox extends HabboItem { public void onPickUp(Room room) { super.onPickUp(room); this.setExtradata("0"); - - if (room.getTraxManager().isPlaying() && room.getRoomSpecialTypes().getItemsOfType(InteractionJukeBox.class).isEmpty()) { - room.getTraxManager().clearPlayList(); - } + room.getTraxManager().removeTraxOnRoom(this); } @Override public void onPlace(Room room) { super.onPlace(room); + room.getTraxManager().addTraxOnRoom(this); if (room.getTraxManager().isPlaying()) { this.setExtradata("1"); } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/TraxManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/TraxManager.java index c445158e..ff0b1437 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/TraxManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/TraxManager.java @@ -9,12 +9,15 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionJukeBox; import com.eu.habbo.habbohotel.items.interactions.InteractionMusicDisc; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; +import com.eu.habbo.messages.ServerMessage; +import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer; import com.eu.habbo.messages.outgoing.inventory.AddHabboItemComposer; import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer; 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.JukeBoxNowPlayingMessageComposer; import com.eu.habbo.messages.outgoing.rooms.items.jukebox.JukeBoxPlayListComposer; +import gnu.trove.map.hash.THashMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -27,8 +30,12 @@ import java.util.List; import java.util.stream.Collectors; public class TraxManager implements Disposable { + public static int NORMAL_JUKEBOX_LIMIT = 10; + public static int LARGE_JUKEBOX_LIMIT = 20; + private static final Logger LOGGER = LoggerFactory.getLogger(TraxManager.class); private final Room room; + private InteractionJukeBox jukeBox; private final List songs = new ArrayList<>(0); private int totalLength = 0; private int startedTimestamp = 0; @@ -36,27 +43,69 @@ public class TraxManager implements Disposable { private int playingIndex = 0; private int cycleStartedTimestamp = 0; private Habbo starter = null; + private int songsLimit = 0; private boolean disposed = false; public TraxManager(Room room) { this.room = room; - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM room_trax_playlist WHERE room_id = ?")) { + //Check if room has a Jukebox already on DB + this.jukeBox = this.loadRoomJukebox(); + + if (this.jukeBox == null) { + //Check again if there's a jukebox on room but has not been saved on DB before + for (HabboItem item : room.getRoomSpecialTypes().getItemsOfType(InteractionJukeBox.class)) + { + this.jukeBox = (InteractionJukeBox) item; + } + + if(this.jukeBox != null) + { + this.loadPlaylist(); + this.songsLimit = this.getSongsLimit(this.jukeBox); + } + } else { + this.loadPlaylist(); + this.songsLimit = this.getSongsLimit(this.jukeBox); + } + } + + public InteractionJukeBox loadRoomJukebox() { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM room_trax WHERE room_id = ?")) { statement.setInt(1, this.room.getId()); + try (ResultSet set = statement.executeQuery()) { + if (set.next()) { + HabboItem jukebox = Emulator.getGameEnvironment().getItemManager().loadHabboItem(set.getInt("trax_item_id")); + if(jukebox != null) { + if (!(jukebox instanceof InteractionJukeBox)) { + return null; + } else { + return (InteractionJukeBox) jukebox; + } + } + } + } + } catch (SQLException e) { + LOGGER.error("Caught SQL exception", e); + } + + return null; + } + + public void loadPlaylist() { + if(this.jukeBox == null) return; + + this.songs.clear(); + + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM trax_playlist WHERE trax_item_id = ?")) { + statement.setInt(1, this.jukeBox.getId()); try (ResultSet set = statement.executeQuery()) { while (set.next()) { HabboItem musicDisc = Emulator.getGameEnvironment().getItemManager().loadHabboItem(set.getInt("item_id")); if(musicDisc != null) { if (!(musicDisc instanceof InteractionMusicDisc) || musicDisc.getRoomId() != -1) { - try (PreparedStatement stmt = connection.prepareStatement("DELETE FROM room_trax_playlist WHERE room_id = ? AND item_id = ? LIMIT 1")) { - stmt.setInt(1, this.room.getId()); - stmt.setInt(2, musicDisc.getId()); - stmt.execute(); - } catch (SQLException e) { - LOGGER.error("Caught SQL exception", e); - return; - } + deleteSongFromPlaylist(this.jukeBox.getId(), musicDisc.getId()); } else { SoundTrack track = Emulator.getGameEnvironment().getItemManager().getSoundTrack(((InteractionMusicDisc) musicDisc).getSongId()); @@ -74,6 +123,54 @@ public class TraxManager implements Disposable { } } + public static void deleteSongFromPlaylist(int jukebox_id, int song_id) + { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM trax_playlist WHERE trax_item_id = ? AND item_id = ? LIMIT 1")) { + statement.setInt(1, jukebox_id); + statement.setInt(2, song_id); + statement.execute(); + } catch (SQLException e) { + LOGGER.error("Caught SQL exception", e); + } + } + + public void addTraxOnRoom(InteractionJukeBox jukeBox) { + if(this.jukeBox != null) return; + + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement_1 = connection.prepareStatement("INSERT INTO room_trax (room_id, trax_item_id) VALUES (?, ?)")) + { + statement_1.setInt(1, this.room.getId()); + statement_1.setInt(2, jukeBox.getId()); + statement_1.execute(); + } + catch (SQLException e) { + LOGGER.error("Caught SQL exception", e); + return; + } + + this.jukeBox = jukeBox; + this.loadPlaylist(); + this.songsLimit = this.getSongsLimit(this.jukeBox); + } + + public void removeTraxOnRoom(InteractionJukeBox jukeBox) { + if(this.jukeBox.getId() != jukeBox.getId()) return; + + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement_1 = connection.prepareStatement("DELETE FROM room_trax WHERE room_id = ?")) + { + statement_1.setInt(1, this.room.getId()); + statement_1.execute(); + } + catch (SQLException e) { + LOGGER.error("Caught SQL exception", e); + return; + } + + this.stop(); + this.jukeBox = null; + this.songs.clear(); + } + public void cycle() { if (this.isPlaying()) { if (this.timePlaying() >= this.totalLength) { @@ -93,10 +190,8 @@ public class TraxManager implements Disposable { public void play(int index, Habbo starter) { if (this.currentlyPlaying == null) { - for (HabboItem item : this.room.getRoomSpecialTypes().getItemsOfType(InteractionJukeBox.class)) { - item.setExtradata("1"); - this.room.updateItem(item); - } + this.jukeBox.setExtradata("1"); + this.room.updateItem(this.jukeBox); } if (!this.songs.isEmpty()) { @@ -133,10 +228,8 @@ public class TraxManager implements Disposable { this.starter = null; this.playingIndex = 0; - for (HabboItem item : this.room.getRoomSpecialTypes().getItemsOfType(InteractionJukeBox.class)) { - item.setExtradata("0"); - this.room.updateItem(item); - } + this.jukeBox.setExtradata("0"); + this.room.updateItem(this.jukeBox); this.room.sendComposer(new JukeBoxNowPlayingMessageComposer(null, -1, 0).compose()); } @@ -149,14 +242,25 @@ public class TraxManager implements Disposable { } public void addSong(InteractionMusicDisc musicDisc, Habbo habbo) { + if(this.jukeBox == null) return; + + if(this.songsLimit < this.songs.size() + 1) + { + THashMap codes = new THashMap<>(); + ServerMessage msg = new BubbleAlertComposer("${playlist.editor.alert.playlist.full.title}", "${playlist.editor.alert.playlist.full}").compose(); + habbo.getClient().sendResponse(msg); + return; + } + SoundTrack track = Emulator.getGameEnvironment().getItemManager().getSoundTrack(musicDisc.getSongId()); - if (track != null) { + if (track != null) + { this.totalLength += track.getLength(); this.songs.add(musicDisc); - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO room_trax_playlist (room_id, item_id) VALUES (?, ?)")) { - statement.setInt(1, this.room.getId()); + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO trax_playlist (trax_item_id, item_id) VALUES (?, ?)")) { + statement.setInt(1, this.jukeBox.getId()); statement.setInt(2, musicDisc.getId()); statement.execute(); } catch (SQLException e) { @@ -168,6 +272,7 @@ public class TraxManager implements Disposable { musicDisc.setRoomId(-1); musicDisc.needsUpdate(true); + Emulator.getThreading().run(musicDisc); habbo.getInventory().getItemsComponent().removeHabboItem(musicDisc); habbo.getClient().sendResponse(new RemoveHabboItemComposer(musicDisc.getGiftAdjustedId())); @@ -177,19 +282,14 @@ public class TraxManager implements Disposable { } public void removeSong(int itemId) { - InteractionMusicDisc musicDisc = this.fromItemId(itemId); + if(this.songs.isEmpty()) return; + + InteractionMusicDisc musicDisc = this.getSong(itemId); if (musicDisc != null) { this.songs.remove(musicDisc); - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM room_trax_playlist WHERE room_id = ? AND item_id = ? LIMIT 1")) { - statement.setInt(1, this.room.getId()); - statement.setInt(2, itemId); - statement.execute(); - } catch (SQLException e) { - LOGGER.error("Caught SQL exception", e); - return; - } + deleteSongFromPlaylist(this.jukeBox.getId(), itemId); this.totalLength -= Emulator.getGameEnvironment().getItemManager().getSoundTrack(musicDisc.getSongId()).getLength(); if (this.currentlyPlaying == musicDisc) { @@ -200,6 +300,7 @@ public class TraxManager implements Disposable { musicDisc.setRoomId(0); musicDisc.needsUpdate(true); + Emulator.getThreading().run(musicDisc); Habbo owner = Emulator.getGameEnvironment().getHabboManager().getHabbo(musicDisc.getUserId()); @@ -217,6 +318,87 @@ public class TraxManager implements Disposable { this.sendUpdatedSongList(); } + public static void removeAllSongs(InteractionJukeBox jukebox) + { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM trax_playlist WHERE trax_item_id = ?")) { + statement.setInt(1, jukebox.getId()); + try (ResultSet set = statement.executeQuery()) { + while (set.next()) { + HabboItem musicDisc = Emulator.getGameEnvironment().getItemManager().loadHabboItem(set.getInt("item_id")); + deleteSongFromPlaylist(jukebox.getId(), set.getInt("item_id")); + + if(musicDisc != null) { + if (musicDisc instanceof InteractionMusicDisc && musicDisc.getRoomId() == -1) { + musicDisc.setRoomId(0); + musicDisc.needsUpdate(true); + Emulator.getThreading().run(musicDisc); + + Habbo owner = Emulator.getGameEnvironment().getHabboManager().getHabbo(musicDisc.getUserId()); + + if (owner != null) { + owner.getInventory().getItemsComponent().addItem(musicDisc); + + GameClient client = owner.getClient(); + if (client != null) { + client.sendResponse(new AddHabboItemComposer(musicDisc)); + client.sendResponse(new InventoryRefreshComposer()); + } + } + } + } + } + } + } catch (SQLException e) { + LOGGER.error("Caught SQL exception", e); + } + } + + public List soundTrackList() { + List trax = new ArrayList<>(this.songs.size()); + + for (InteractionMusicDisc musicDisc : this.songs) { + SoundTrack track = Emulator.getGameEnvironment().getItemManager().getSoundTrack(musicDisc.getSongId()); + + if (track != null) { + trax.add(track); + } + } + + return trax; + } + + public List myList(Habbo habbo) { + return habbo.getInventory().getItemsComponent().getItems().valueCollection().stream() + .filter(i -> i instanceof InteractionMusicDisc && i.getRoomId() == 0) + .map(i -> (InteractionMusicDisc) i) + .collect(Collectors.toList()); + } + + public InteractionMusicDisc getSong(int itemId) { + for (InteractionMusicDisc musicDisc : this.songs) { + if (musicDisc != null && musicDisc.getId() == itemId) { + return musicDisc; + } + } + + return null; + } + + public int getSongsLimit(InteractionJukeBox jukeBox) { + if ("jukebox_big".equals(jukeBox.getBaseItem().getName())) { + return LARGE_JUKEBOX_LIMIT; + } + return NORMAL_JUKEBOX_LIMIT; + } + + public void updateCurrentPlayingSong(Habbo habbo) { + if (this.isPlaying()) { + habbo.getClient().sendResponse(new JukeBoxNowPlayingMessageComposer(Emulator.getGameEnvironment().getItemManager().getSoundTrack(this.currentlyPlaying.getSongId()), this.playingIndex, 1000 * (Emulator.getIntUnixTimestamp() - this.startedTimestamp))); + } else { + habbo.getClient().sendResponse(new JukeBoxNowPlayingMessageComposer(null, -1, 0)); + } + } + public void sendUpdatedSongList() { this.room.getHabbos().forEach(h -> { GameClient client = h.getClient(); @@ -243,53 +425,12 @@ public class TraxManager implements Disposable { return this.currentlyPlaying != null; } - public List soundTrackList() { - List trax = new ArrayList<>(this.songs.size()); - - for (InteractionMusicDisc musicDisc : this.songs) { - SoundTrack track = Emulator.getGameEnvironment().getItemManager().getSoundTrack(musicDisc.getSongId()); - - if (track != null) { - trax.add(track); - } - } - - return trax; + public int getSongsLimit() { + return this.songsLimit; } - public List myList(Habbo habbo) { - return habbo.getInventory().getItemsComponent().getItems().valueCollection().stream() - .filter(i -> i instanceof InteractionMusicDisc && i.getRoomId() == 0) - .map(i -> (InteractionMusicDisc) i) - .collect(Collectors.toList()); - } - - public InteractionMusicDisc fromItemId(int itemId) { - for (InteractionMusicDisc musicDisc : this.songs) { - if (musicDisc != null && musicDisc.getId() == itemId) { - return musicDisc; - } - } - - return null; - } - - public void clearPlayList() { - this.songs.clear(); - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM room_trax_playlist WHERE room_id = ?")) { - statement.setInt(1, this.room.getId()); - statement.execute(); - } catch (SQLException e) { - LOGGER.error("Caught SQL exception", e); - } - } - - public void updateCurrentPlayingSong(Habbo habbo) { - if (this.isPlaying()) { - habbo.getClient().sendResponse(new JukeBoxNowPlayingMessageComposer(Emulator.getGameEnvironment().getItemManager().getSoundTrack(this.currentlyPlaying.getSongId()), this.playingIndex, 1000 * (Emulator.getIntUnixTimestamp() - this.startedTimestamp))); - } else { - habbo.getClient().sendResponse(new JukeBoxNowPlayingMessageComposer(null, -1, 0)); - } + public InteractionJukeBox getJukeBox() { + return this.jukeBox; } @Override @@ -301,4 +442,4 @@ public class TraxManager implements Disposable { public boolean disposed() { return this.disposed; } -} +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildBuyEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildBuyEvent.java index 7e613c42..ae7142bd 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildBuyEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildBuyEvent.java @@ -21,6 +21,11 @@ public class RequestGuildBuyEvent extends MessageHandler { @Override public void handle() throws Exception { + if (Emulator.getConfig().getBoolean("catalog.guild.hc_required", true) && this.client.getHabbo().getHabboStats().getClubExpireTimestamp() < Emulator.getIntUnixTimestamp()) { + this.client.sendResponse(new GuildEditFailComposer(GuildEditFailComposer.HC_REQUIRED)); + return; + } + if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS)) { int guildPrice = Emulator.getConfig().getInt("catalog.guild.price"); if (this.client.getHabbo().getHabboInfo().getCredits() >= guildPrice) { @@ -31,11 +36,6 @@ public class RequestGuildBuyEvent extends MessageHandler { } } - if (Emulator.getConfig().getBoolean("catalog.guild.hc_required", true) && this.client.getHabbo().getHabboStats().getClubExpireTimestamp() < Emulator.getIntUnixTimestamp()) { - this.client.sendResponse(new GuildEditFailComposer(GuildEditFailComposer.HC_REQUIRED)); - return; - } - String name = this.packet.readString(); String description = this.packet.readString(); @@ -104,4 +104,4 @@ public class RequestGuildBuyEvent extends MessageHandler { } } } -} +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/jukebox/JukeBoxAddSoundTrackEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/jukebox/JukeBoxAddSoundTrackEvent.java index 8585c567..4934e1cb 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/jukebox/JukeBoxAddSoundTrackEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/jukebox/JukeBoxAddSoundTrackEvent.java @@ -12,14 +12,14 @@ public class JukeBoxAddSoundTrackEvent extends MessageHandler { if (!this.client.getHabbo().getHabboInfo().getCurrentRoom().hasRights(this.client.getHabbo())) return; int itemId = this.packet.readInt(); - int unknown = this.packet.readInt(); + int slotId = this.packet.readInt(); Habbo habbo = this.client.getHabbo(); if (habbo != null) { HabboItem item = habbo.getInventory().getItemsComponent().getHabboItem(itemId); - if (item != null && item instanceof InteractionMusicDisc && item.getRoomId() == 0) { + if (item instanceof InteractionMusicDisc && item.getRoomId() == 0) { this.client.getHabbo().getHabboInfo().getCurrentRoom().getTraxManager().addSong((InteractionMusicDisc) item, habbo); } } diff --git a/src/main/java/com/eu/habbo/plugin/PluginManager.java b/src/main/java/com/eu/habbo/plugin/PluginManager.java index 20b9b0c7..e3fc51b0 100644 --- a/src/main/java/com/eu/habbo/plugin/PluginManager.java +++ b/src/main/java/com/eu/habbo/plugin/PluginManager.java @@ -113,6 +113,8 @@ public class PluginManager { NavigatorManager.MAXIMUM_RESULTS_PER_PAGE = Emulator.getConfig().getInt("hotel.navigator.search.maxresults"); NavigatorManager.CATEGORY_SORT_USING_ORDER_NUM = Emulator.getConfig().getBoolean("hotel.navigator.sort.ordernum"); RoomChatMessage.MAXIMUM_LENGTH = Emulator.getConfig().getInt("hotel.chat.max.length"); + TraxManager.LARGE_JUKEBOX_LIMIT = Emulator.getConfig().getInt("hotel.jukebox.limit.large"); + TraxManager.NORMAL_JUKEBOX_LIMIT = Emulator.getConfig().getInt("hotel.jukebox.limit.normal"); String[] bannedBubbles = Emulator.getConfig().getValue("commands.cmd_chatcolor.banned_numbers").split(";"); RoomChatMessage.BANNED_BUBBLES = new int[bannedBubbles.length]; @@ -120,6 +122,7 @@ public class PluginManager { try { RoomChatMessage.BANNED_BUBBLES[i] = Integer.valueOf(bannedBubbles[i]); } catch (Exception e) { + LOGGER.error("Caught exception", e); } } From 599cd615d118dc205d3433435a27ba3f394a6201 Mon Sep 17 00:00:00 2001 From: Rodolfo-XDR Date: Thu, 2 Jul 2020 16:01:05 -0500 Subject: [PATCH 163/215] Wired Game Fix --- .../java/com/eu/habbo/habbohotel/games/Game.java | 14 ++++++++++---- .../com/eu/habbo/habbohotel/games/GameTeam.java | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/games/Game.java b/src/main/java/com/eu/habbo/habbohotel/games/Game.java index f8aa6c37..16783eb7 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/Game.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/Game.java @@ -122,6 +122,10 @@ public abstract class Game implements Runnable { for (HabboItem item : this.room.getRoomSpecialTypes().getItemsOfType(WiredBlob.class)) { ((WiredBlob) item).onGameStart(this.room); } + + for (GameTeam team : this.teams.values()) { + team.resetScores(); + } } public void onEnd() { @@ -137,9 +141,11 @@ public abstract class Game implements Runnable { } GameTeam winningTeam = null; - for (GameTeam team : this.teams.values()) { - if (winningTeam == null || team.getTotalScore() > winningTeam.getTotalScore()) { - winningTeam = team; + if(totalPointsGained > 0) { + for (GameTeam team : this.teams.values()) { + if (winningTeam == null || team.getTotalScore() > winningTeam.getTotalScore()) { + winningTeam = team; + } } } @@ -166,7 +172,7 @@ public abstract class Game implements Runnable { WiredHandler.handleCustomTrigger(WiredTriggerTeamLoses.class, player.getHabbo().getRoomUnit(), this.room, new Object[]{this}); } - if (team.getMembers().size() > 0) { + if (team.getMembers().size() > 0 && team.getTotalScore() > 0) { for (HabboItem item : this.room.getRoomSpecialTypes().getItemsOfType(InteractionWiredHighscore.class)) { Emulator.getGameEnvironment().getItemManager().getHighscoreManager().addHighscoreData(new WiredHighscoreDataEntry(item.getId(), team.getMembers().stream().map(m -> m.getHabbo().getHabboInfo().getId()).collect(Collectors.toList()), team.getTotalScore(), false, Emulator.getIntUnixTimestamp())); } diff --git a/src/main/java/com/eu/habbo/habbohotel/games/GameTeam.java b/src/main/java/com/eu/habbo/habbohotel/games/GameTeam.java index aad945b1..143974dd 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/GameTeam.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/GameTeam.java @@ -86,6 +86,8 @@ public class GameTeam { player.reset(); } + + this.teamScore = 0; } From b7f586475849337f273bf561e1e0603375ac7913 Mon Sep 17 00:00:00 2001 From: nttzx Date: Mon, 6 Jul 2020 12:09:25 -0400 Subject: [PATCH 164/215] Update UpdateNavigatorCommand.java --- .../eu/habbo/habbohotel/commands/UpdateNavigatorCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateNavigatorCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/UpdateNavigatorCommand.java index ee3b5f9a..c01c2e94 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UpdateNavigatorCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/UpdateNavigatorCommand.java @@ -13,7 +13,7 @@ public class UpdateNavigatorCommand extends Command { public boolean handle(GameClient gameClient, String[] params) throws Exception { Emulator.getGameEnvironment().getNavigatorManager().loadNavigator(); Emulator.getGameEnvironment().getRoomManager().loadRoomModels(); - + Emulator.getGameEnvironment().getRoomManager().loadPublicRooms(); gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_update_navigator"), RoomChatMessageBubbles.ALERT); return true; From 15e24f311496dbf96fa385516730506ae40b9a2c Mon Sep 17 00:00:00 2001 From: Dome Date: Tue, 7 Jul 2020 07:16:58 -0400 Subject: [PATCH 165/215] Fixed thread flood in Vending Machines --- .../InteractionVendingMachine.java | 143 +++++++++--------- 1 file changed, 72 insertions(+), 71 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java index 770c9732..04511206 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java @@ -6,8 +6,6 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.*; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboGender; -import com.eu.habbo.habbohotel.users.HabboItem; -import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.rooms.items.FloorItemUpdateComposer; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer; import com.eu.habbo.threading.runnables.RoomUnitGiveHanditem; @@ -17,6 +15,7 @@ import com.eu.habbo.util.pathfinding.Rotation; import java.sql.ResultSet; import java.sql.SQLException; import java.util.concurrent.ExecutionException; +import java.util.concurrent.ScheduledFuture; public class InteractionVendingMachine extends InteractionDefault { public InteractionVendingMachine(ResultSet set, Item baseItem) throws SQLException { @@ -32,83 +31,85 @@ public class InteractionVendingMachine extends InteractionDefault { @Override public void onClick(GameClient client, Room room, Object[] objects) throws Exception { super.onClick(client, room, objects); + + if (client == null) { + return; + } - if (client != null) { - RoomTile tile = this.getRequiredTile(client.getHabbo(), room); + RoomTile tile = this.getRequiredTile(client.getHabbo(), room); - if (tile != null) { - if (tile.equals(client.getHabbo().getRoomUnit().getCurrentLocation())) { - if (this.getExtradata().equals("0") || this.getExtradata().length() == 0) { - if (!client.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.SIT) && (!client.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.MOVE) || tile.equals(client.getHabbo().getRoomUnit().getGoal()))) { - room.updateHabbo(client.getHabbo()); - this.rotateToMachine(client.getHabbo().getRoomUnit()); - client.getHabbo().getRoomUnit().removeStatus(RoomUnitStatus.MOVE); - room.scheduledComposers.add(new RoomUserStatusComposer(client.getHabbo().getRoomUnit()).compose()); - } + if (tile != null && + tile.equals(client.getHabbo().getRoomUnit().getCurrentLocation())) { + if (!this.getExtradata().equals("0") || this.getExtradata().length() != 0) { + return; + } + + if (!client.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.SIT) && (!client.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.MOVE) || tile.equals(client.getHabbo().getRoomUnit().getGoal()))) { + room.updateHabbo(client.getHabbo()); + this.rotateToMachine(client.getHabbo().getRoomUnit()); + client.getHabbo().getRoomUnit().removeStatus(RoomUnitStatus.MOVE); + room.scheduledComposers.add(new RoomUserStatusComposer(client.getHabbo().getRoomUnit()).compose()); + } - super.onClick(client, room, new Object[]{"TOGGLE_OVERRIDE"}); + super.onClick(client, room, new Object[]{"TOGGLE_OVERRIDE"}); - this.setExtradata("1"); - room.scheduledComposers.add(new FloorItemUpdateComposer(this).compose()); + this.setExtradata("1"); + room.scheduledComposers.add(new FloorItemUpdateComposer(this).compose()); - Emulator.getThreading().run(() -> { - Emulator.getThreading().run(this, 1000); - this.giveVendingMachineItem(client.getHabbo(), room); - - if (this.getBaseItem().getEffectM() > 0 && client.getHabbo().getHabboInfo().getGender() == HabboGender.M) - room.giveEffect(client.getHabbo(), this.getBaseItem().getEffectM(), -1); - if (this.getBaseItem().getEffectF() > 0 && client.getHabbo().getHabboInfo().getGender() == HabboGender.F) - room.giveEffect(client.getHabbo(), this.getBaseItem().getEffectF(), -1); - }, 500); + this.runGiveItemThread(client, room); + } else { + if (!tile.isWalkable() && tile.state != RoomTileState.SIT && tile.state != RoomTileState.LAY) { + for (RoomTile t : room.getLayout().getTilesAround(room.getLayout().getTile(this.getX(), this.getY()))) { + if (t != null && t.isWalkable()) { + tile = t; + break; } - } else { - if (!tile.isWalkable() && tile.state != RoomTileState.SIT && tile.state != RoomTileState.LAY) { - for (RoomTile t : room.getLayout().getTilesAround(room.getLayout().getTile(this.getX(), this.getY()))) { - if (t != null && t.isWalkable()) { - tile = t; - break; - } - } - } - - RoomTile finalTile = tile; - client.getHabbo().getRoomUnit().setGoalLocation(tile); - - Emulator.getThreading().run(new RoomUnitWalkToLocation(client.getHabbo().getRoomUnit(), tile, room, () -> { - this.setExtradata("1"); - room.scheduledComposers.add(new FloorItemUpdateComposer(this).compose()); - - try { - super.onClick(client, room, new Object[]{"TOGGLE_OVERRIDE"}); - } catch (Exception e) { - e.printStackTrace(); - } - - Emulator.getThreading().run(() -> { - client.getHabbo().getRoomUnit().setMoveBlockingTask(Emulator.getThreading().run(() -> { - if (client.getHabbo().getRoomUnit().getCurrentLocation().equals(finalTile)) { - this.rotateToMachine(client.getHabbo().getRoomUnit()); - room.sendComposer(new RoomUserStatusComposer(client.getHabbo().getRoomUnit()).compose()); - } - - try { - Emulator.getThreading().run(() -> { - Emulator.getThreading().run(this, 1000); - this.giveVendingMachineItem(client.getHabbo(), room); - - if (this.getBaseItem().getEffectM() > 0 && client.getHabbo().getHabboInfo().getGender() == HabboGender.M) - room.giveEffect(client.getHabbo(), this.getBaseItem().getEffectM(), -1); - if (this.getBaseItem().getEffectF() > 0 && client.getHabbo().getHabboInfo().getGender() == HabboGender.F) - room.giveEffect(client.getHabbo(), this.getBaseItem().getEffectF(), -1); - }, 500).get(); - } catch (InterruptedException | ExecutionException e) { - e.printStackTrace(); - } - }, 300)); - }, 250); - }, null)); } } + + RoomTile finalTile = tile; + client.getHabbo().getRoomUnit().setGoalLocation(tile); + + Emulator.getThreading().run(new RoomUnitWalkToLocation(client.getHabbo().getRoomUnit(), tile, room, () -> { + this.setExtradata("1"); + room.scheduledComposers.add(new FloorItemUpdateComposer(this).compose()); + + try { + super.onClick(client, room, new Object[]{"TOGGLE_OVERRIDE"}); + } catch (Exception e) { + e.printStackTrace(); + } + + Emulator.getThreading().run(() -> client.getHabbo().getRoomUnit().setMoveBlockingTask(Emulator.getThreading().run(() -> { + if (client.getHabbo().getRoomUnit().getCurrentLocation().equals(finalTile)) { + this.rotateToMachine(client.getHabbo().getRoomUnit()); + room.sendComposer(new RoomUserStatusComposer(client.getHabbo().getRoomUnit()).compose()); + } + + this.runGiveItemThread(client, room); + }, 300)), 250); + }, null)); + } + } + + private void runGiveItemThread(GameClient client, Room room) { + try { + ScheduledFuture thread = Emulator.getThreading().run(() -> { + Emulator.getThreading().run(this, 1000); + this.giveVendingMachineItem(client.getHabbo(), room); + + if (this.getBaseItem().getEffectM() > 0 && client.getHabbo().getHabboInfo().getGender() == HabboGender.M) + room.giveEffect(client.getHabbo(), this.getBaseItem().getEffectM(), -1); + if (this.getBaseItem().getEffectF() > 0 && client.getHabbo().getHabboInfo().getGender() == HabboGender.F) + room.giveEffect(client.getHabbo(), this.getBaseItem().getEffectF(), -1); + }, 500); + + if (thread.isDone()) { + thread.get(); + } + + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); } } From fb7531a36ddecebeffd05b72b7a4add5d3de80a5 Mon Sep 17 00:00:00 2001 From: Cam Date: Thu, 9 Jul 2020 16:57:45 -0400 Subject: [PATCH 166/215] Modtools Room Tools Fix for all SWFS. --- .../messages/outgoing/modtool/ModToolRoomInfoComposer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolRoomInfoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolRoomInfoComposer.java index 17303cb7..c62423fb 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolRoomInfoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolRoomInfoComposer.java @@ -20,7 +20,7 @@ public class ModToolRoomInfoComposer extends MessageComposer { this.response.appendBoolean(this.room.getHabbo(this.room.getOwnerId()) != null); this.response.appendInt(this.room.getOwnerId()); this.response.appendString(this.room.getOwnerName()); - this.response.appendBoolean(this.room.isPublicRoom()); + this.response.appendBoolean(true); this.response.appendString(this.room.getName()); this.response.appendString(this.room.getDescription()); this.response.appendInt(this.room.getTags().split(";").length); From bf07e19864d7d624356379006da99dc60e3128a7 Mon Sep 17 00:00:00 2001 From: harmonic Date: Fri, 10 Jul 2020 15:08:52 +0100 Subject: [PATCH 167/215] Fixed Teleport invisible user glitch. Credits to Dome and Necmi. --- src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java index e6eb506d..9521a75c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java @@ -730,6 +730,7 @@ public class RoomUnit { } public void addOverrideTile(RoomTile tile) { + if (!this.canOverrideTile(tile)) { return; } // Test if the Tile is overridable int tileIndex = (room.getLayout().getMapSizeY() * tile.y) + tile.x + 1; if (!this.overridableTiles.contains(tileIndex)) { this.overridableTiles.add(tileIndex); From a528da5c310a79db2c025808d215e56c0567e584 Mon Sep 17 00:00:00 2001 From: harmonic Date: Fri, 10 Jul 2020 15:46:30 +0100 Subject: [PATCH 168/215] Updated sql file. --- sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql index cd58db0d..548550d2 100644 --- a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql +++ b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql @@ -27,4 +27,23 @@ INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.gifts.box_types', INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.gifts.ribbon_types', '0,1,2,3,4,5,6,7,8,9,10'); -- Configurable mute time -INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.flood.mute.time', '30'); \ No newline at end of file +INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.flood.mute.time', '30'); + +-- TraxManager Jukebox Limits +INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('jukebox.limit.large', '20'); +INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('jukebox.limit.normal', '10'); + +-- Table structure for room_trax +DROP TABLE IF EXISTS `room_trax`; +CREATE TABLE `room_trax` ( + `room_id` int(11) NOT NULL, + `trax_item_id` int(11) NOT NULL +) ENGINE = InnoDB CHARACTER SET = armscii8 COLLATE = armscii8_general_ci ROW_FORMAT = Compact; + +-- Table structure for trax_playlist +DROP TABLE IF EXISTS `trax_playlist`; +CREATE TABLE `trax_playlist` ( + `trax_item_id` int(11) NOT NULL, + `item_id` int(11) NOT NULL +) ENGINE = InnoDB CHARACTER SET = armscii8 COLLATE = armscii8_general_ci ROW_FORMAT = Compact; + From e45d2867efe78b8a08d3a4c71157ebb6e08af4ab Mon Sep 17 00:00:00 2001 From: harmonic Date: Fri, 10 Jul 2020 16:03:27 +0100 Subject: [PATCH 169/215] Fixed typo in sql file. --- sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql index 548550d2..21b6af39 100644 --- a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql +++ b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql @@ -30,8 +30,8 @@ INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.gifts.ribbon_type INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.flood.mute.time', '30'); -- TraxManager Jukebox Limits -INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('jukebox.limit.large', '20'); -INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('jukebox.limit.normal', '10'); +INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.jukebox.limit.large', '20'); +INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.jukebox.limit.normal', '10'); -- Table structure for room_trax DROP TABLE IF EXISTS `room_trax`; From 8005c5cf1f25507f2b7e7517c410dc2d4946c920 Mon Sep 17 00:00:00 2001 From: harmonic Date: Fri, 10 Jul 2020 16:15:14 +0100 Subject: [PATCH 170/215] Fixes issue with Bot Wired. --- .../interactions/wired/effects/WiredEffectBotFollowHabbo.java | 3 +++ .../wired/effects/WiredEffectBotGiveHandItem.java | 3 +++ .../items/interactions/wired/effects/WiredEffectBotTalk.java | 3 +++ .../interactions/wired/effects/WiredEffectBotTalkToHabbo.java | 3 +++ .../interactions/wired/effects/WiredEffectBotTeleport.java | 4 +++- .../interactions/wired/effects/WiredEffectBotWalkToFurni.java | 3 +++ 6 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java index e7aab43c..b92cc1a3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java @@ -89,6 +89,9 @@ public class WiredEffectBotFollowHabbo extends InteractionWiredEffect { if (habbo != null) { List bots = room.getBots(this.botName); for (Bot bot : bots) { + if (bots.size() > 1) { + return false; + } if (this.mode == 1) bot.startFollowingHabbo(habbo); else diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java index 918f12fb..d01284ab 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java @@ -93,6 +93,9 @@ public class WiredEffectBotGiveHandItem extends InteractionWiredEffect { List bots = room.getBots(this.botName); for (Bot bot : bots) { + if (bots.size() > 1) { + return false; + } List tasks = new ArrayList<>(); tasks.add(new RoomUnitGiveHanditem(habbo.getRoomUnit(), room, this.itemId)); tasks.add(new RoomUnitGiveHanditem(bot.getRoomUnit(), room, 0)); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java index 96815685..7a1dc565 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java @@ -86,6 +86,9 @@ public class WiredEffectBotTalk extends InteractionWiredEffect { List bots = room.getBots(this.botName); for (Bot bot : bots) { + if (bots.size() > 1) { + return false; + } if (this.mode == 1) bot.shout(message); else diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java index 82f8ad59..cccf1c0e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java @@ -105,6 +105,9 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect { List bots = room.getBots(this.botName); for (Bot bot : bots) { + if (bots.size() > 1) { + return false; + } if (this.mode == 1) { bot.whisper(m, habbo); } else { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java index 487b88f6..198944cc 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java @@ -13,7 +13,6 @@ import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.threading.runnables.RoomUnitTeleport; -import com.eu.habbo.threading.runnables.SendRoomUnitEffectComposer; import gnu.trove.set.hash.THashSet; import java.sql.ResultSet; @@ -99,6 +98,9 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect { return false; for (Bot bot : bots) { + if (bots.size() > 1) { + return false; + } int i = Emulator.getRandom().nextInt(this.items.size()) + 1; int j = 1; for (HabboItem item : this.items) { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java index a5f5a0c0..5b224122 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java @@ -109,6 +109,9 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect { if (this.items.size() > 0) { for (Bot bot : bots) { + if (bots.size() > 1) { + return false; + } int i = Emulator.getRandom().nextInt(this.items.size()) + 1; int j = 1; for (HabboItem item : this.items) { From 3b50122d746d0f64a40c12a854dc18384ab5e114 Mon Sep 17 00:00:00 2001 From: harmonic Date: Fri, 10 Jul 2020 16:26:16 +0100 Subject: [PATCH 171/215] Cleanup of previous commit. --- .../interactions/wired/effects/WiredEffectBotClothes.java | 3 +++ .../wired/effects/WiredEffectBotFollowHabbo.java | 6 +++--- .../wired/effects/WiredEffectBotGiveHandItem.java | 7 +++---- .../interactions/wired/effects/WiredEffectBotTalk.java | 7 +++---- .../wired/effects/WiredEffectBotTalkToHabbo.java | 7 +++---- .../interactions/wired/effects/WiredEffectBotTeleport.java | 6 +++--- .../wired/effects/WiredEffectBotWalkToFurni.java | 6 +++--- src/main/java/com/eu/habbo/plugin/PluginManager.java | 6 ++++-- 8 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java index c49ff4a5..9082ba12 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java @@ -68,6 +68,9 @@ public class WiredEffectBotClothes extends InteractionWiredEffect { @Override public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { List bots = room.getBots(this.botName); + if (bots.size() > 1) { + return false; + } for (Bot bot : bots) { bot.setFigure(this.botLook); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java index b92cc1a3..cf46e5ff 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java @@ -88,10 +88,10 @@ public class WiredEffectBotFollowHabbo extends InteractionWiredEffect { if (habbo != null) { List bots = room.getBots(this.botName); + if (bots.size() > 1) { + return false; + } for (Bot bot : bots) { - if (bots.size() > 1) { - return false; - } if (this.mode == 1) bot.startFollowingHabbo(habbo); else diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java index d01284ab..d8f03705 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java @@ -91,11 +91,10 @@ public class WiredEffectBotGiveHandItem extends InteractionWiredEffect { if (habbo != null) { List bots = room.getBots(this.botName); - + if (bots.size() > 1) { + return false; + } for (Bot bot : bots) { - if (bots.size() > 1) { - return false; - } List tasks = new ArrayList<>(); tasks.add(new RoomUnitGiveHanditem(habbo.getRoomUnit(), room, this.itemId)); tasks.add(new RoomUnitGiveHanditem(bot.getRoomUnit(), room, 0)); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java index 7a1dc565..b8f95349 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java @@ -84,11 +84,10 @@ public class WiredEffectBotTalk extends InteractionWiredEffect { .replace(Emulator.getTexts().getValue("wired.variable.points"), habbo.getHabboInfo().getCurrencyAmount(Emulator.getConfig().getInt("seasonal.primary.type")) + ""); } List bots = room.getBots(this.botName); - + if (bots.size() > 1) { + return false; + } for (Bot bot : bots) { - if (bots.size() > 1) { - return false; - } if (this.mode == 1) bot.shout(message); else diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java index cccf1c0e..7e90eb02 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java @@ -103,11 +103,10 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect { .replace(Emulator.getTexts().getValue("wired.variable.points"), habbo.getHabboInfo().getCurrencyAmount(Emulator.getConfig().getInt("seasonal.primary.type")) + ""); List bots = room.getBots(this.botName); - + if (bots.size() > 1) { + return false; + } for (Bot bot : bots) { - if (bots.size() > 1) { - return false; - } if (this.mode == 1) { bot.whisper(m, habbo); } else { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java index 198944cc..8f001d53 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java @@ -97,10 +97,10 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect { if (bots.isEmpty()) return false; + if (bots.size() > 1) { + return false; + } for (Bot bot : bots) { - if (bots.size() > 1) { - return false; - } int i = Emulator.getRandom().nextInt(this.items.size()) + 1; int j = 1; for (HabboItem item : this.items) { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java index 5b224122..484e9fca 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java @@ -108,10 +108,10 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect { } if (this.items.size() > 0) { + if (bots.size() > 1) { + return false; + } for (Bot bot : bots) { - if (bots.size() > 1) { - return false; - } int i = Emulator.getRandom().nextInt(this.items.size()) + 1; int j = 1; for (HabboItem item : this.items) { diff --git a/src/main/java/com/eu/habbo/plugin/PluginManager.java b/src/main/java/com/eu/habbo/plugin/PluginManager.java index e3fc51b0..0355c04d 100644 --- a/src/main/java/com/eu/habbo/plugin/PluginManager.java +++ b/src/main/java/com/eu/habbo/plugin/PluginManager.java @@ -70,6 +70,7 @@ public class PluginManager { @EventHandler public static void globalOnConfigurationUpdated(EmulatorConfigUpdatedEvent event) { + ItemManager.RECYCLER_ENABLED = Emulator.getConfig().getBoolean("hotel.catalog.recycler.enabled"); MarketPlace.MARKETPLACE_ENABLED = Emulator.getConfig().getBoolean("hotel.marketplace.enabled"); MarketPlace.MARKETPLACE_CURRENCY = Emulator.getConfig().getInt("hotel.marketplace.currency"); @@ -159,8 +160,6 @@ public class PluginManager { BotManager.MAXIMUM_BOT_INVENTORY_SIZE = Emulator.getConfig().getInt("hotel.bots.max.inventory"); PetManager.MAXIMUM_PET_INVENTORY_SIZE = Emulator.getConfig().getInt("hotel.pets.max.inventory"); - GiftConfigurationComposer.BOX_TYPES = Arrays.stream(Emulator.getConfig().getValue("hotel.gifts.box_types").split(",")).mapToInt(Integer::parseInt).boxed().collect(Collectors.toList()); - GiftConfigurationComposer.RIBBON_TYPES = Arrays.stream(Emulator.getConfig().getValue("hotel.gifts.ribbon_types").split(",")).mapToInt(Integer::parseInt).boxed().collect(Collectors.toList()); NewNavigatorEventCategoriesComposer.CATEGORIES.clear(); for (String category : Emulator.getConfig().getValue("navigator.eventcategories", "").split(";")) { @@ -172,6 +171,9 @@ public class PluginManager { } if (Emulator.isReady) { + GiftConfigurationComposer.BOX_TYPES = Arrays.stream(Emulator.getConfig().getValue("hotel.gifts.box_types").split(",")).mapToInt(Integer::parseInt).boxed().collect(Collectors.toList()); + GiftConfigurationComposer.RIBBON_TYPES = Arrays.stream(Emulator.getConfig().getValue("hotel.gifts.ribbon_types").split(",")).mapToInt(Integer::parseInt).boxed().collect(Collectors.toList()); + Emulator.getGameEnvironment().getCreditsScheduler().reloadConfig(); Emulator.getGameEnvironment().getPointsScheduler().reloadConfig(); Emulator.getGameEnvironment().getPixelScheduler().reloadConfig(); From 69900e4afdaab5f8ef4f97e80960f5c317de5cfa Mon Sep 17 00:00:00 2001 From: harmonic Date: Fri, 10 Jul 2020 18:58:04 +0100 Subject: [PATCH 172/215] Fixes Teleport Issue with bots. Fixes #717 --- .../wired/effects/WiredEffectBotTeleport.java | 53 ++++++++++++++++--- 1 file changed, 47 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java index 8f001d53..7920c8d2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java @@ -6,17 +6,22 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.habbohotel.rooms.RoomTile; +import com.eu.habbo.habbohotel.rooms.RoomTileState; import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ServerMessage; +import com.eu.habbo.messages.outgoing.rooms.users.RoomUserEffectComposer; import com.eu.habbo.threading.runnables.RoomUnitTeleport; +import com.eu.habbo.threading.runnables.SendRoomUnitEffectComposer; import gnu.trove.set.hash.THashSet; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.Collections; import java.util.List; public class WiredEffectBotTeleport extends InteractionWiredEffect { @@ -35,6 +40,46 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect { this.items = new THashSet<>(); } + public static void teleportUnitToTile(RoomUnit roomUnit, RoomTile tile) { + if (roomUnit == null || tile == null || roomUnit.isWiredTeleporting) + return; + + Room room = roomUnit.getRoom(); + + if (room == null) { + return; + } + + // makes a temporary effect + + roomUnit.getRoom().unIdle(roomUnit.getRoom().getHabbo(roomUnit)); + room.sendComposer(new RoomUserEffectComposer(roomUnit, 4).compose()); + Emulator.getThreading().run(new SendRoomUnitEffectComposer(room, roomUnit), WiredHandler.TELEPORT_DELAY + 1000); + + if (tile == roomUnit.getCurrentLocation()) { + return; + } + + if (tile.state == RoomTileState.INVALID || tile.state == RoomTileState.BLOCKED) { + RoomTile alternativeTile = null; + List optionalTiles = room.getLayout().getTilesAround(tile); + + Collections.reverse(optionalTiles); + for (RoomTile optionalTile : optionalTiles) { + if (optionalTile.state != RoomTileState.INVALID && optionalTile.state != RoomTileState.BLOCKED) { + alternativeTile = optionalTile; + break; + } + } + + if (alternativeTile != null) { + tile = alternativeTile; + } + } + + Emulator.getThreading().run(new RoomUnitTeleport(roomUnit, room, tile.x, tile.y, tile.getStackHeight() + (tile.state == RoomTileState.SIT ? -0.5 : 0), roomUnit.getEffectId()), WiredHandler.TELEPORT_DELAY); + } + @Override public void serializeWiredData(ServerMessage message, Room room) { THashSet items = new THashSet<>(); @@ -106,12 +151,8 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect { for (HabboItem item : this.items) { if (item.getRoomId() != 0 && item.getRoomId() == bot.getRoom().getId()) { if (i == j) { - int currentEffect = bot.getRoomUnit().getEffectId(); - - room.giveEffect(bot.getRoomUnit(), 4, -1); - Emulator.getThreading().run(() -> room.giveEffect(bot.getRoomUnit(), 0, -1), WiredHandler.TELEPORT_DELAY + 1000); - Emulator.getThreading().run(new RoomUnitTeleport(bot.getRoomUnit(), room, item.getX(), item.getY(), item.getZ() + item.getBaseItem().getHeight() + (item.getBaseItem().allowSit() ? -0.50 : 0D), currentEffect), WiredHandler.TELEPORT_DELAY); - break; + teleportUnitToTile(bot.getRoomUnit(), room.getLayout().getTile(item.getX(), item.getY())); + return true; } else { j++; } From a7e70d206128afc58c6a9f0d528f9b6a7d7c180d Mon Sep 17 00:00:00 2001 From: harmonic Date: Fri, 10 Jul 2020 19:05:45 +0100 Subject: [PATCH 173/215] Remove CF_diamond, which should be used for official habbo furniture. Use DF_5_furniname instead. --- .../com/eu/habbo/habbohotel/commands/RedeemCommand.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/RedeemCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/RedeemCommand.java index b88d5352..21db5c7f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/RedeemCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/RedeemCommand.java @@ -52,12 +52,6 @@ public class RedeemCommand extends Command { pointsAmount = Integer.valueOf(item.getBaseItem().getName().split("_")[2]); points.adjustOrPutValue(pointsType, pointsAmount, pointsAmount); - } else if (item.getBaseItem().getName().startsWith("CF_diamond_")) { - try { - int amount = Integer.valueOf(item.getBaseItem().getName().split("_")[2]); - points.adjustOrPutValue(5, amount, amount); - } catch (Exception e) { - } } } } From 4c279172732daaa85396fd9237207cd943d180be Mon Sep 17 00:00:00 2001 From: necmi <183-necmi@users.noreply.git.krews.org> Date: Fri, 10 Jul 2020 21:18:45 -0400 Subject: [PATCH 174/215] Refactored bot wired. --- .../wired/effects/WiredEffectBotClothes.java | 9 +++--- .../effects/WiredEffectBotFollowHabbo.java | 19 ++++++------ .../effects/WiredEffectBotGiveHandItem.java | 25 +++++++--------- .../wired/effects/WiredEffectBotTalk.java | 17 +++++++---- .../effects/WiredEffectBotTalkToHabbo.java | 17 ++++++----- .../wired/effects/WiredEffectBotTeleport.java | 29 +++++++++--------- .../effects/WiredEffectBotWalkToFurni.java | 30 ++++++++----------- 7 files changed, 72 insertions(+), 74 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java index 9082ba12..ec22bf63 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java @@ -68,12 +68,13 @@ public class WiredEffectBotClothes extends InteractionWiredEffect { @Override public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { List bots = room.getBots(this.botName); - if (bots.size() > 1) { + + if (bots.size() != 1) { return false; } - for (Bot bot : bots) { - bot.setFigure(this.botLook); - } + + Bot bot = bots.get(0); + bot.setFigure(this.botLook); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java index cf46e5ff..928068af 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java @@ -86,16 +86,15 @@ public class WiredEffectBotFollowHabbo extends InteractionWiredEffect { public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { Habbo habbo = room.getHabbo(roomUnit); - if (habbo != null) { - List bots = room.getBots(this.botName); - if (bots.size() > 1) { - return false; - } - for (Bot bot : bots) { - if (this.mode == 1) - bot.startFollowingHabbo(habbo); - else - bot.stopFollowingHabbo(); + List bots = room.getBots(this.botName); + + if (habbo != null && bots.size() == 1) { + Bot bot = bots.get(0); + + if (this.mode == 1) { + bot.startFollowingHabbo(habbo); + } else { + bot.stopFollowingHabbo(); } return true; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java index d8f03705..94173cdd 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java @@ -88,24 +88,21 @@ public class WiredEffectBotGiveHandItem extends InteractionWiredEffect { @Override public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { Habbo habbo = room.getHabbo(roomUnit); + List bots = room.getBots(this.botName); - if (habbo != null) { - List bots = room.getBots(this.botName); - if (bots.size() > 1) { - return false; - } - for (Bot bot : bots) { - List tasks = new ArrayList<>(); - tasks.add(new RoomUnitGiveHanditem(habbo.getRoomUnit(), room, this.itemId)); - tasks.add(new RoomUnitGiveHanditem(bot.getRoomUnit(), room, 0)); + if (habbo != null && bots.size() == 1) { + Bot bot = bots.get(0); - Emulator.getThreading().run(new RoomUnitGiveHanditem(bot.getRoomUnit(), room, this.itemId)); + List tasks = new ArrayList<>(); + tasks.add(new RoomUnitGiveHanditem(habbo.getRoomUnit(), room, this.itemId)); + tasks.add(new RoomUnitGiveHanditem(bot.getRoomUnit(), room, 0)); - List failedReach = new ArrayList<>(); - failedReach.add(() -> tasks.forEach(Runnable::run)); + Emulator.getThreading().run(new RoomUnitGiveHanditem(bot.getRoomUnit(), room, this.itemId)); - Emulator.getThreading().run(new RoomUnitWalkToRoomUnit(bot.getRoomUnit(), habbo.getRoomUnit(), room, tasks, failedReach)); - } + List failedReach = new ArrayList<>(); + failedReach.add(() -> tasks.forEach(Runnable::run)); + + Emulator.getThreading().run(new RoomUnitWalkToRoomUnit(bot.getRoomUnit(), habbo.getRoomUnit(), room, tasks, failedReach)); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java index b8f95349..e73978a0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java @@ -83,16 +83,21 @@ public class WiredEffectBotTalk extends InteractionWiredEffect { .replace(Emulator.getTexts().getValue("wired.variable.pixels"), habbo.getHabboInfo().getPixels() + "") .replace(Emulator.getTexts().getValue("wired.variable.points"), habbo.getHabboInfo().getCurrencyAmount(Emulator.getConfig().getInt("seasonal.primary.type")) + ""); } + List bots = room.getBots(this.botName); - if (bots.size() > 1) { + + if (bots.size() != 1) { return false; } - for (Bot bot : bots) { - if (this.mode == 1) - bot.shout(message); - else - bot.talk(message); + + Bot bot = bots.get(0); + + if (this.mode == 1) { + bot.shout(message); + } else { + bot.talk(message); } + return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java index 7e90eb02..aec24c88 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java @@ -103,19 +103,22 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect { .replace(Emulator.getTexts().getValue("wired.variable.points"), habbo.getHabboInfo().getCurrencyAmount(Emulator.getConfig().getInt("seasonal.primary.type")) + ""); List bots = room.getBots(this.botName); - if (bots.size() > 1) { + + if (bots.size() != 1) { return false; } - for (Bot bot : bots) { - if (this.mode == 1) { - bot.whisper(m, habbo); - } else { - bot.talk(habbo.getHabboInfo().getUsername() + ": " + m); - } + + Bot bot = bots.get(0); + + if (this.mode == 1) { + bot.whisper(m, habbo); + } else { + bot.talk(habbo.getHabboInfo().getUsername() + ": " + m); } return true; } + return false; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java index 7920c8d2..b88e7877 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java @@ -139,23 +139,22 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect { List bots = room.getBots(this.botName); - if (bots.isEmpty()) - return false; - - if (bots.size() > 1) { + if (bots.size() != 1) { return false; } - for (Bot bot : bots) { - int i = Emulator.getRandom().nextInt(this.items.size()) + 1; - int j = 1; - for (HabboItem item : this.items) { - if (item.getRoomId() != 0 && item.getRoomId() == bot.getRoom().getId()) { - if (i == j) { - teleportUnitToTile(bot.getRoomUnit(), room.getLayout().getTile(item.getX(), item.getY())); - return true; - } else { - j++; - } + + Bot bot = bots.get(0); + + int i = Emulator.getRandom().nextInt(this.items.size()) + 1; + int j = 1; + + for (HabboItem item : this.items) { + if (item.getRoomId() != 0 && item.getRoomId() == bot.getRoom().getId()) { + if (i == j) { + teleportUnitToTile(bot.getRoomUnit(), room.getLayout().getTile(item.getX(), item.getY())); + return true; + } else { + j++; } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java index 484e9fca..1b0efe08 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java @@ -88,14 +88,13 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect { @Override public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - if (this.items.isEmpty()) - return false; - List bots = room.getBots(this.botName); - if (bots.isEmpty()) + if (this.items.isEmpty() || bots.size() != 1) { return false; + } + Bot bot = bots.get(0); THashSet items = new THashSet<>(); for (HabboItem item : this.items) { @@ -108,20 +107,15 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect { } if (this.items.size() > 0) { - if (bots.size() > 1) { - return false; - } - for (Bot bot : bots) { - int i = Emulator.getRandom().nextInt(this.items.size()) + 1; - int j = 1; - for (HabboItem item : this.items) { - if (item.getRoomId() != 0 && item.getRoomId() == bot.getRoom().getId()) { - if (i == j) { - bot.getRoomUnit().setGoalLocation(room.getLayout().getTile(item.getX(), item.getY())); - break; - } else { - j++; - } + int i = Emulator.getRandom().nextInt(this.items.size()) + 1; + int j = 1; + for (HabboItem item : this.items) { + if (item.getRoomId() != 0 && item.getRoomId() == bot.getRoom().getId()) { + if (i == j) { + bot.getRoomUnit().setGoalLocation(room.getLayout().getTile(item.getX(), item.getY())); + break; + } else { + j++; } } } From f67c03df8ef265efd7bab7dd0a2191dc7a6f05db Mon Sep 17 00:00:00 2001 From: necmi <183-necmi@users.noreply.git.krews.org> Date: Sat, 11 Jul 2020 06:02:21 +0200 Subject: [PATCH 175/215] fixed multiple bots on one tile and refactored code --- src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java | 5 +++++ src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java | 2 +- .../generic/alerts/GenericErrorMessagesComposer.java | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java index a716e4e1..ee364c4f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java @@ -122,6 +122,11 @@ public class BotManager { if (room.hasHabbosAt(location.x, location.y) || (!location.isWalkable() && location.state != RoomTileState.SIT && location.state != RoomTileState.LAY)) return; + if (room.hasBotsAt(location.x, location.y)) { + habbo.getClient().sendResponse(new BotErrorComposer(BotErrorComposer.ROOM_ERROR_BOTS_SELECTED_TILE_NOT_FREE)); + return; + } + RoomUnit roomUnit = new RoomUnit(); roomUnit.setRotation(RoomUserRotation.SOUTH); roomUnit.setLocation(location); diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java index 32fc0cfb..73a29cab 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java @@ -559,7 +559,7 @@ public class RoomManager { if (room.getPassword().equalsIgnoreCase(password)) this.openRoom(habbo, room, doorLocation); else { - habbo.getClient().sendResponse(new GenericErrorMessagesComposer(-100002)); + habbo.getClient().sendResponse(new GenericErrorMessagesComposer(GenericErrorMessagesComposer.WRONG_PASSWORD_USED)); habbo.getClient().sendResponse(new HotelViewComposer()); habbo.getHabboInfo().setLoadingRoom(0); } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/GenericErrorMessagesComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/GenericErrorMessagesComposer.java index 2674f7d0..7757cdd6 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/GenericErrorMessagesComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/GenericErrorMessagesComposer.java @@ -11,6 +11,7 @@ public class GenericErrorMessagesComposer extends MessageComposer { public static final int NEED_TO_BE_VIP = 4009; public static final int ROOM_NAME_UNACCEPTABLE = 4010; public static final int CANNOT_BAN_GROUP_MEMBER = 4011; + public static final int WRONG_PASSWORD_USED = -100002; private final int errorCode; From cf0de8efbfae2642236a261f8767a4737817cce0 Mon Sep 17 00:00:00 2001 From: Cam Date: Sun, 12 Jul 2020 07:46:14 -0400 Subject: [PATCH 176/215] Fixed issue caused by Mod Tools Disconnect Fix. --- src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java index 73a29cab..3d265404 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java @@ -394,7 +394,7 @@ public class RoomManager { public void clearInactiveRooms() { THashSet roomsToDispose = new THashSet<>(); for (Room room : this.activeRooms.values()) { - if (!room.isPublicRoom() && !room.isStaffPromotedRoom() && !Emulator.getGameServer().getGameClientManager().containsHabbo(room.getOwnerId()) && room.isPreLoaded() && !this.roomCategories.get(room.getCategory()).isPublic()) { + if (!room.isPublicRoom() && !room.isStaffPromotedRoom() && !Emulator.getGameServer().getGameClientManager().containsHabbo(room.getOwnerId()) && room.isPreLoaded()) { roomsToDispose.add(room); } } From 016519185e377cca3fcc45addc82390b33371f2f Mon Sep 17 00:00:00 2001 From: necmi <183-necmi@users.noreply.git.krews.org> Date: Mon, 13 Jul 2020 17:02:56 -0400 Subject: [PATCH 177/215] fixed issue #698 --- sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql | 3 +++ .../interactions/InteractionBackgroundToner.java | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql index 21b6af39..960943ef 100644 --- a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql +++ b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql @@ -33,6 +33,9 @@ INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.flood.mute.time', INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.jukebox.limit.large', '20'); INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.jukebox.limit.normal', '10'); +-- Background Toner Scripter Warning +INSERT INTO `emulator_texts`(`key`, `value`) VALUES ('scripter.warning.item.bgtoner.permission', '%username% tried to change the background toner without rights in %room% owned by %owner%'); + -- Table structure for room_trax DROP TABLE IF EXISTS `room_trax`; CREATE TABLE `room_trax` ( diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBackgroundToner.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBackgroundToner.java index c74e91aa..813ce782 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBackgroundToner.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBackgroundToner.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.modtool.ScripterManager; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.users.HabboItem; @@ -60,6 +61,16 @@ public class InteractionBackgroundToner extends HabboItem { if(client != null) { + if (!client.getHabbo().getRoomUnit().getRoom().hasRights(client.getHabbo())) { + ScripterManager.scripterDetected( + client, + Emulator.getTexts().getValue("scripter.warning.item.bgtoner.permission").replace("%username%", client.getHabbo().getHabboInfo().getUsername()) + .replace("%room%", room.getName()) + .replace("%owner%", room.getOwnerName()) + ); + return; + } + if (client.getHabbo().getRoomUnit().cmdSit && client.getHabbo().getRoomUnit().getEffectId() == 1337) { new BackgroundAnimation(this, room).run(); return; From 0b81268a9d02bd9c9bd915b777de31c9fcad1361 Mon Sep 17 00:00:00 2001 From: Rodolfo-XDR Date: Mon, 13 Jul 2020 19:20:11 -0500 Subject: [PATCH 178/215] Fixed Empty Commands, Added %username% to Succes** Message. --- .../commands/EmptyBotsInventoryCommand.java | 21 +++++++++--------- .../commands/EmptyInventoryCommand.java | 21 +++++------------- .../commands/EmptyPetsInventoryCommand.java | 22 +++++++++---------- 3 files changed, 27 insertions(+), 37 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/EmptyBotsInventoryCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/EmptyBotsInventoryCommand.java index 2745aa0c..64ff8513 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/EmptyBotsInventoryCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/EmptyBotsInventoryCommand.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.messages.outgoing.inventory.InventoryBotsComposer; import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer; import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.procedure.TObjectProcedure; @@ -30,26 +31,24 @@ public class EmptyBotsInventoryCommand extends Command { } if (params.length >= 2 && params[1].equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes"))) { - Habbo habbo = gameClient.getHabbo(); - if (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) { - habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]); - } + + Habbo habbo = (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) ? Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]) : gameClient.getHabbo(); if (habbo != null) { TIntObjectHashMap bots = new TIntObjectHashMap<>(); bots.putAll(habbo.getInventory().getBotsComponent().getBots()); habbo.getInventory().getBotsComponent().getBots().clear(); - bots.forEachValue(new TObjectProcedure() { - @Override - public boolean execute(Bot object) { - Emulator.getGameEnvironment().getBotManager().deleteBot(object); - return true; - } + bots.forEachValue(object -> { + Emulator.getGameEnvironment().getBotManager().deleteBot(object); + return true; }); habbo.getClient().sendResponse(new InventoryRefreshComposer()); + habbo.getClient().sendResponse(new InventoryBotsComposer(habbo)); - gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_empty_bots.cleared"), RoomChatMessageBubbles.ALERT); + gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_empty_bots.cleared").replace("%username%", habbo.getHabboInfo().getUsername()), RoomChatMessageBubbles.ALERT); + } else { + gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_empty_bots"), RoomChatMessageBubbles.ALERT); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/EmptyInventoryCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/EmptyInventoryCommand.java index a75b176f..779dd3e5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/EmptyInventoryCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/EmptyInventoryCommand.java @@ -2,10 +2,8 @@ package com.eu.habbo.habbohotel.commands; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.habbohotel.items.interactions.InteractionJukeBox; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; -import com.eu.habbo.habbohotel.rooms.TraxManager; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.outgoing.inventory.InventoryItemsComposer; @@ -34,31 +32,24 @@ public class EmptyInventoryCommand extends Command { } if (params.length >= 2 && params[1].equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes"))) { - Habbo habbo = gameClient.getHabbo(); - if (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) { - habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]); - } + + Habbo habbo = (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) ? Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]) : gameClient.getHabbo(); if (habbo != null) { - TIntObjectMap items = new TIntObjectHashMap<>(); items.putAll(habbo.getInventory().getItemsComponent().getItems()); habbo.getInventory().getItemsComponent().getItems().clear(); - - for (HabboItem item : items.valueCollection()) { - if(item instanceof InteractionJukeBox) - TraxManager.removeAllSongs((InteractionJukeBox) item); - } - Emulator.getThreading().run(new QueryDeleteHabboItems(items)); habbo.getClient().sendResponse(new InventoryRefreshComposer()); habbo.getClient().sendResponse(new InventoryItemsComposer(0, 1, gameClient.getHabbo().getInventory().getItemsComponent().getItems())); - gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_empty.cleared"), RoomChatMessageBubbles.ALERT); + gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_empty.cleared").replace("%username%", habbo.getHabboInfo().getUsername()), RoomChatMessageBubbles.ALERT); + } else { + gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_empty"), RoomChatMessageBubbles.ALERT); } } return true; } -} +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/EmptyPetsInventoryCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/EmptyPetsInventoryCommand.java index 6ab16663..f4b40793 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/EmptyPetsInventoryCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/EmptyPetsInventoryCommand.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.pets.Pet; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.messages.outgoing.inventory.InventoryPetsComposer; import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer; import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.procedure.TObjectProcedure; @@ -30,25 +31,24 @@ public class EmptyPetsInventoryCommand extends Command { } if (params.length >= 2 && params[1].equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes"))) { - Habbo habbo = gameClient.getHabbo(); - if (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) { - habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]); - } + + Habbo habbo = (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) ? Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]) : gameClient.getHabbo(); if (habbo != null) { TIntObjectHashMap pets = new TIntObjectHashMap<>(); pets.putAll(habbo.getInventory().getPetsComponent().getPets()); habbo.getInventory().getPetsComponent().getPets().clear(); - pets.forEachValue(new TObjectProcedure() { - @Override - public boolean execute(Pet object) { - Emulator.getGameEnvironment().getPetManager().deletePet(object); - return true; - } + pets.forEachValue(object -> { + Emulator.getGameEnvironment().getPetManager().deletePet(object); + return true; }); habbo.getClient().sendResponse(new InventoryRefreshComposer()); - gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_empty_pets.cleared"), RoomChatMessageBubbles.ALERT); + habbo.getClient().sendResponse(new InventoryPetsComposer(habbo)); + + gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_empty_pets.cleared").replace("%username%", habbo.getHabboInfo().getUsername()), RoomChatMessageBubbles.ALERT); + } else { + gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_empty_pets"), RoomChatMessageBubbles.ALERT); } } From 6a3a7a7963c9a5b50af3490399ff96ff26a8df18 Mon Sep 17 00:00:00 2001 From: Swirny <140-Swirny@users.noreply.git.krews.org> Date: Fri, 17 Jul 2020 07:25:15 -0400 Subject: [PATCH 179/215] Fixed friend request for offline habbos --- .../habbo/messages/incoming/friends/FriendRequestEvent.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java b/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java index f595d730..09f8ec6f 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java @@ -25,10 +25,6 @@ public class FriendRequestEvent extends MessageHandler { String username = this.packet.readString(); Habbo habbo = Emulator.getGameServer().getGameClientManager().getHabbo(username); - if (habbo.getHabboInfo().getId() == this.client.getHabbo().getHabboInfo().getId()) { - return; - } - if (Emulator.getPluginManager().fireEvent(new UserRequestFriendshipEvent(this.client.getHabbo(), username, habbo)).isCancelled()) { this.client.sendResponse(new FriendRequestErrorComposer(2)); return; From ddce8ce48d440c3a7b5e68b866aa9c145a25caf9 Mon Sep 17 00:00:00 2001 From: Dank074 Date: Fri, 17 Jul 2020 19:52:40 -0500 Subject: [PATCH 180/215] attempt at fixing sitting in high chairs --- src/main/java/com/eu/habbo/habbohotel/rooms/Room.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 82543235..5a9c140b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -3570,7 +3570,7 @@ public class Room implements Comparable, ISerialize, Runnable { HabboItem lowestChair = this.getLowestChair(x, y); if (lowestChair != null && lowestChair != exclude) { canStack = true; - height = lowestChair.getZ() + Item.getCurrentHeight(lowestChair); + height = lowestChair.getZ(); } } } From 06c6da49b269f41f0a7e6355c89bf69f9b3683a2 Mon Sep 17 00:00:00 2001 From: Swirny <140-Swirny@users.noreply.git.krews.org> Date: Sun, 19 Jul 2020 07:01:13 -0400 Subject: [PATCH 181/215] Ignore spamming with WIREDs --- src/main/java/com/eu/habbo/habbohotel/rooms/Room.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 82543235..fb2ae859 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -3005,7 +3005,7 @@ public class Room implements Comparable, ISerialize, Runnable { } public void talk(Habbo habbo, RoomChatMessage roomChatMessage, RoomChatType chatType) { - this.talk(habbo, roomChatMessage, chatType, false); + this.talk(habbo, roomChatMessage, chatType, true); } public void talk(final Habbo habbo, final RoomChatMessage roomChatMessage, RoomChatType chatType, boolean ignoreWired) { From 10e5935dcb45c5b905f0d25b87239278b89ebbe1 Mon Sep 17 00:00:00 2001 From: harmonic Date: Mon, 20 Jul 2020 20:55:40 +0100 Subject: [PATCH 182/215] uh --- .../eu/habbo/messages/incoming/friends/FriendRequestEvent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java b/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java index f595d730..7611603f 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java @@ -48,7 +48,7 @@ public class FriendRequestEvent extends MessageHandler { return; } - if (habbo == null) { + if(!habbo.isOnline()) { try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users_settings.block_friendrequests, users.id FROM users INNER JOIN users_settings ON users.id = users_settings.user_id WHERE username = ? LIMIT 1")) { statement.setString(1, username); try (ResultSet set = statement.executeQuery()) { From f1ada781d738a88928f9cf2308ce849f4757eeaa Mon Sep 17 00:00:00 2001 From: ArpyAge Date: Thu, 30 Jul 2020 16:42:06 +0200 Subject: [PATCH 183/215] Checks the length of name and description for guilds/groups --- .../incoming/guilds/GuildChangeNameDescEvent.java | 3 +++ .../messages/incoming/guilds/RequestGuildBuyEvent.java | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildChangeNameDescEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildChangeNameDescEvent.java index 29eac532..7942b2cd 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildChangeNameDescEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildChangeNameDescEvent.java @@ -25,6 +25,9 @@ public class GuildChangeNameDescEvent extends MessageHandler { if (guild.getName().equals(nameEvent.name) && guild.getDescription().equals(nameEvent.description)) return; + if(nameEvent.name.length() > 29 || nameEvent.description.length() > 254) + return; + guild.setName(nameEvent.name); guild.setDescription(nameEvent.description); guild.needsUpdate = true; diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildBuyEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildBuyEvent.java index ae7142bd..ee9f2eef 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildBuyEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildBuyEvent.java @@ -21,6 +21,12 @@ public class RequestGuildBuyEvent extends MessageHandler { @Override public void handle() throws Exception { + String name = this.packet.readString(); + String description = this.packet.readString(); + + if(name.length() > 29 || description.length() > 254) + return; + if (Emulator.getConfig().getBoolean("catalog.guild.hc_required", true) && this.client.getHabbo().getHabboStats().getClubExpireTimestamp() < Emulator.getIntUnixTimestamp()) { this.client.sendResponse(new GuildEditFailComposer(GuildEditFailComposer.HC_REQUIRED)); return; @@ -36,9 +42,6 @@ public class RequestGuildBuyEvent extends MessageHandler { } } - String name = this.packet.readString(); - String description = this.packet.readString(); - int roomId = this.packet.readInt(); Room r = Emulator.getGameEnvironment().getRoomManager().getRoom(roomId); From 8fb71247ab3179a72889c7fcc97b12171751a54e Mon Sep 17 00:00:00 2001 From: Harmonic Date: Fri, 31 Jul 2020 16:03:04 -0400 Subject: [PATCH 184/215] Revert "Merge branch 'wired-spam' into 'dev'" This reverts merge request !266 --- src/main/java/com/eu/habbo/habbohotel/rooms/Room.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 1799e761..5a9c140b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -3005,7 +3005,7 @@ public class Room implements Comparable, ISerialize, Runnable { } public void talk(Habbo habbo, RoomChatMessage roomChatMessage, RoomChatType chatType) { - this.talk(habbo, roomChatMessage, chatType, true); + this.talk(habbo, roomChatMessage, chatType, false); } public void talk(final Habbo habbo, final RoomChatMessage roomChatMessage, RoomChatType chatType, boolean ignoreWired) { From f24758865847ef419a4bfc2512cad80c087e5bb0 Mon Sep 17 00:00:00 2001 From: Beny Date: Sun, 16 Aug 2020 00:19:25 +0200 Subject: [PATCH 185/215] Fix items not saving when room unloaded during client disconnection --- src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java index 3d265404..cf1e289e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java @@ -386,8 +386,8 @@ public class RoomManager { if (Emulator.getPluginManager().fireEvent(new RoomUncachedEvent(room)).isCancelled()) continue; - this.activeRooms.remove(room.getId()); room.dispose(); + this.activeRooms.remove(room.getId()); } } From 68a197526f6e05277749abff671fc811c97f1a27 Mon Sep 17 00:00:00 2001 From: Beny Date: Sun, 16 Aug 2020 03:01:37 +0200 Subject: [PATCH 186/215] Performance update to Pathfinder and room loading --- .../com/eu/habbo/habbohotel/rooms/Room.java | 226 +++++++----------- 1 file changed, 80 insertions(+), 146 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 5a9c140b..2692ef24 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -426,7 +426,6 @@ public class Room implements Comparable, ISerialize, Runnable { if (this.itemCount() > Room.MAXIMUM_FURNI) { LOGGER.error("Room ID: {} has exceeded the furniture limit ({} > {}).", this.getId(), this.itemCount(), Room.MAXIMUM_FURNI); } - } private synchronized void loadWiredData(Connection connection) { @@ -542,7 +541,6 @@ public class Room implements Comparable, ISerialize, Runnable { public void updateTile(RoomTile tile) { if (tile != null) { tile.setStackHeight(this.getStackHeight(tile.x, tile.y, false)); - tile.setState(this.calculateTileState(tile)); } } @@ -566,17 +564,28 @@ public class Room implements Comparable, ISerialize, Runnable { return RoomTileState.INVALID; RoomTileState result = RoomTileState.OPEN; - HabboItem lowestItem = null; + HabboItem highestItem = null; HabboItem lowestChair = this.getLowestChair(tile); THashSet items = this.getItemsAt(tile); - if (items == null) return RoomTileState.INVALID; - if (items.stream().anyMatch(i -> i.getBaseItem().allowLay())) return RoomTileState.LAY; + if (items == null) return RoomTileState.INVALID; for (HabboItem item : items) { if (exclude != null && item == exclude) continue; - if (lowestChair != null && item.getZ() > lowestChair.getZ() + 1.5) { + if(item.getBaseItem().allowLay()) { + return RoomTileState.LAY; + } + + if (highestItem != null && highestItem.getZ() + Item.getCurrentHeight(highestItem) > item.getZ() + Item.getCurrentHeight(item)) + continue; + + highestItem = item; + if (result == RoomTileState.OPEN) { + result = this.checkStateForItem(item, tile); + } + + /*if (lowestChair != null && item.getZ() > lowestChair.getZ() + 1.5) { continue; } @@ -588,7 +597,7 @@ public class Room implements Comparable, ISerialize, Runnable { if (result == RoomTileState.OPEN) { result = this.checkStateForItem(item, tile); } - } + }*/ } if (lowestChair != null) return RoomTileState.SIT; @@ -3311,6 +3320,10 @@ public class Room implements Comparable, ISerialize, Runnable { } public THashSet getItemsAt(RoomTile tile) { + return getItemsAt(tile, false); + } + + public THashSet getItemsAt(RoomTile tile, boolean returnOnFirst) { THashSet items = new THashSet<>(0); if (tile == null) @@ -3339,19 +3352,24 @@ public class Room implements Comparable, ISerialize, Runnable { if (item.getBaseItem().getType() != FurnitureType.FLOOR) continue; - if (item.getX() == tile.x && item.getY() == tile.y) { - items.add(item); - } else { - if (item.getBaseItem().getWidth() <= 1 && item.getBaseItem().getLength() <= 1) { - continue; - } + int width, length; - THashSet tiles = this.getLayout().getTilesAt(this.layout.getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); - for (RoomTile t : tiles) { - if ((t.x == tile.x) && (t.y == tile.y) && (!items.contains(item))) { - items.add(item); - } - } + if (item.getRotation() != 2 && item.getRotation() != 6) { + width = item.getBaseItem().getWidth() > 0 ? item.getBaseItem().getWidth() : 1; + length = item.getBaseItem().getLength() > 0 ? item.getBaseItem().getLength() : 1; + } + else { + width = item.getBaseItem().getLength() > 0 ? item.getBaseItem().getLength() : 1; + length = item.getBaseItem().getWidth() > 0 ? item.getBaseItem().getWidth() : 1; + } + + if (!(tile.x >= item.getX() && tile.x <= item.getX() + width - 1 && tile.y >= item.getY() && tile.y <= item.getY() + length - 1)) + continue; + + items.add(item); + + if(returnOnFirst) { + return items; } } @@ -3369,20 +3387,7 @@ public class Room implements Comparable, ISerialize, Runnable { if (item.getZ() < minZ) continue; - if (item.getX() == x && item.getY() == y && item.getZ() >= minZ) { - items.add(item); - } else { - if (item.getBaseItem().getWidth() <= 1 && item.getBaseItem().getLength() <= 1) { - continue; - } - - THashSet tiles = this.getLayout().getTilesAt(this.layout.getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); - for (RoomTile tile : tiles) { - if ((tile.x == x) && (tile.y == y) && (!items.contains(item))) { - items.add(item); - } - } - } + items.add(item); } return items; } @@ -3390,54 +3395,22 @@ public class Room implements Comparable, ISerialize, Runnable { public THashSet getItemsAt(Class type, int x, int y) { THashSet items = new THashSet<>(); - TIntObjectIterator iterator = this.roomItems.iterator(); + for (HabboItem item : this.getItemsAt(x, y)) { + if (!item.getClass().equals(type)) + continue; - for (int i = this.roomItems.size(); i-- > 0; ) { - HabboItem item; - try { - iterator.advance(); - item = iterator.value(); - } catch (Exception e) { - break; - } - - if (item.getClass().equals(type)) { - if (item.getX() == x && item.getY() == y) { - items.add(item); - } else { - if (item.getBaseItem().getWidth() <= 1 && item.getBaseItem().getLength() <= 1) { - continue; - } - - THashSet tiles = this.getLayout().getTilesAt(this.layout.getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); - for (RoomTile tile : tiles) { - if ((tile.x == x) && (tile.y == y) && (!items.contains(item))) { - items.add(item); - } - } - } - } + items.add(item); } - return items; } public boolean hasItemsAt(int x, int y) { - TIntObjectIterator iterator = this.roomItems.iterator(); + RoomTile tile = this.getLayout().getTile((short) x, (short) y); - for (int i = this.roomItems.size(); i-- > 0; ) { - HabboItem habboItem; - try { - iterator.advance(); - habboItem = iterator.value(); - } catch (Exception e) { - break; - } + if(tile == null) + return false; - if (habboItem.getX() == x && habboItem.getY() == y) return true; - } - - return false; + return this.getItemsAt(tile, true).size() > 0; } public HabboItem getTopItemAt(int x, int y) { @@ -3445,55 +3418,24 @@ public class Room implements Comparable, ISerialize, Runnable { } public HabboItem getTopItemAt(int x, int y, HabboItem exclude) { - HabboItem item = null; + RoomTile tile = this.getLayout().getTile((short) x, (short) y); - TIntObjectIterator iterator = this.roomItems.iterator(); + if(tile == null) + return null; - for (int i = this.roomItems.size(); i-- > 0; ) { - HabboItem habboItem; - try { - iterator.advance(); - habboItem = iterator.value(); - } catch (Exception e) { - break; - } + HabboItem highestItem = null; - if (habboItem.getBaseItem().getType() != FurnitureType.FLOOR) + for (HabboItem item : this.getItemsAt(x, y)) { + if(exclude != null && exclude == item) continue; - if (exclude != null) { - if (exclude == habboItem) - continue; - } + if (highestItem != null && highestItem.getZ() + Item.getCurrentHeight(highestItem) > item.getZ() + Item.getCurrentHeight(item)) + continue; - if (habboItem.getX() == x && habboItem.getY() == y) { - if (item == null || (habboItem.getZ() + Item.getCurrentHeight(habboItem)) > (item.getZ() + Item.getCurrentHeight(item))) { - item = habboItem; - } - } else { - if (habboItem.getBaseItem().getWidth() <= 1 && habboItem.getBaseItem().getLength() <= 1) { - continue; - } - - if (this.layout == null) continue; - - THashSet tiles = this.layout.getTilesAt( - this.layout.getTile(habboItem.getX(), habboItem.getY()), - habboItem.getBaseItem().getWidth(), - habboItem.getBaseItem().getLength(), - habboItem.getRotation() - ); - - for (RoomTile tile : tiles) { - if (((tile.x == x) && (tile.y == y))) { - if (item == null || item.getZ() < habboItem.getZ()) - item = habboItem; - } - } - } + highestItem = item; } - return item; + return highestItem; } public double getTopHeightAt(int x, int y) { @@ -3524,17 +3466,14 @@ public class Room implements Comparable, ISerialize, Runnable { THashSet items = this.getItemsAt(tile); if (items != null && !items.isEmpty()) { for (HabboItem item : items) { - if (item.getBaseItem().allowSit()) { - if (lowestChair == null || item.getZ() < lowestChair.getZ()) { - lowestChair = item; - } - } - if (lowestChair != null) { - if (item.getZ() > lowestChair.getZ() && item.getZ() - lowestChair.getZ() < 1.5) { - lowestChair = null; - } - } + if(!item.getBaseItem().allowSit()) + continue; + + if(lowestChair != null && lowestChair.getZ() < item.getZ()) + continue; + + lowestChair = item; } } @@ -3542,37 +3481,32 @@ public class Room implements Comparable, ISerialize, Runnable { } public double getStackHeight(short x, short y, boolean calculateHeightmap, HabboItem exclude) { + if (x < 0 || y < 0 || this.layout == null) return calculateHeightmap ? Short.MAX_VALUE : 0.0; double height = this.layout.getHeightAtSquare(x, y); boolean canStack = true; - boolean stackHelper = false; - THashSet items = this.getItemsAt(x, y); - if (items != null) { - for (HabboItem item : items) { + + THashSet stackHelpers = this.getItemsAt(InteractionStackHelper.class, x, y); + + if(stackHelpers.size() > 0) { + for(HabboItem item : stackHelpers) { if (item == exclude) continue; - - if (item instanceof InteractionStackHelper) { - stackHelper = true; - height = item.getExtradata().isEmpty() ? Double.valueOf("0.0") : (Double.valueOf(item.getExtradata()) / 100); - canStack = true; - } + return calculateHeightmap ? item.getZ() * 256.0D : item.getZ(); } + } - if (!stackHelper) { - HabboItem item = this.getTopItemAt(x, y, exclude); - if (item != null) { - canStack = item.getBaseItem().allowStack(); - height = item.getZ() + Item.getCurrentHeight(item); - } + HabboItem item = this.getTopItemAt(x, y, exclude); + if (item != null) { + canStack = item.getBaseItem().allowStack(); + height = item.getZ() + Item.getCurrentHeight(item); + } - HabboItem lowestChair = this.getLowestChair(x, y); - if (lowestChair != null && lowestChair != exclude) { - canStack = true; - height = lowestChair.getZ(); - } - } + HabboItem lowestChair = this.getLowestChair(x, y); + if (lowestChair != null && lowestChair != exclude) { + canStack = true; + height = lowestChair.getZ(); } if (calculateHeightmap) { From 571efa203e685dd78bef0eb789bf6f53b9077b7f Mon Sep 17 00:00:00 2001 From: Beny Date: Thu, 20 Aug 2020 19:25:36 +0200 Subject: [PATCH 187/215] Fix Issue #738 - Bots ignore the height of any surface --- .../java/com/eu/habbo/habbohotel/bots/BotManager.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java index ee364c4f..1f93888c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java @@ -130,12 +130,10 @@ public class BotManager { RoomUnit roomUnit = new RoomUnit(); roomUnit.setRotation(RoomUserRotation.SOUTH); roomUnit.setLocation(location); - HabboItem topItem = room.getTopItemAt(location.x, location.y); - - double topItemHeight = 0; - if (topItem != null) topItemHeight = Item.getCurrentHeight(topItem); - roomUnit.setPreviousLocationZ(roomUnit.getCurrentLocation().getStackHeight() - topItemHeight); + double stackHeight = room.getStackHeight(location.x, location.y, false); + roomUnit.setPreviousLocationZ(stackHeight); + roomUnit.setZ(stackHeight); roomUnit.setPathFinderRoom(room); roomUnit.setRoomUnitType(RoomUnitType.BOT); @@ -150,6 +148,8 @@ public class BotManager { habbo.getClient().sendResponse(new RemoveBotComposer(bot)); bot.onPlace(habbo, room); + HabboItem topItem = room.getTopItemAt(location.x, location.y); + if (topItem != null) { try { topItem.onWalkOn(bot.getRoomUnit(), room, null); @@ -157,6 +157,7 @@ public class BotManager { LOGGER.error("Caught exception", e); } } + bot.cycle(false); } else { habbo.getClient().sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.key, FurnitureMovementError.NO_RIGHTS.errorCode)); From f2e72b715e2d240414ed07dc3d14c614de1afdbd Mon Sep 17 00:00:00 2001 From: Rodolfo-XDR Date: Fri, 21 Aug 2020 13:00:59 -0500 Subject: [PATCH 188/215] Fixed Null Exception --- .../java/com/eu/habbo/core/ConfigurationManager.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/core/ConfigurationManager.java b/src/main/java/com/eu/habbo/core/ConfigurationManager.java index 29e50f73..19b442fe 100644 --- a/src/main/java/com/eu/habbo/core/ConfigurationManager.java +++ b/src/main/java/com/eu/habbo/core/ConfigurationManager.java @@ -23,7 +23,7 @@ public class ConfigurationManager { public boolean loaded = false; public boolean isLoading = false; - public ConfigurationManager(String configurationPath) throws Exception { + public ConfigurationManager(String configurationPath) { this.properties = new Properties(); this.configurationPath = configurationPath; this.reload(); @@ -37,7 +37,12 @@ public class ConfigurationManager { String envDbHostname = System.getenv("DB_HOSTNAME"); - boolean useEnvVarsForDbConnection = envDbHostname != null && envDbHostname.length() > 1; + boolean useEnvVarsForDbConnection = false; + + if(envDbHostname != null) + { + useEnvVarsForDbConnection = envDbHostname.length() > 1; + } if (!useEnvVarsForDbConnection) { try { From 860afa0d643b439b08b8b6f8ad7c76d7f7c8674d Mon Sep 17 00:00:00 2001 From: Jose Flores Date: Fri, 21 Aug 2020 19:10:29 -0300 Subject: [PATCH 189/215] move only one user per time on roller --- src/main/java/com/eu/habbo/habbohotel/rooms/Room.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 2692ef24..223d5a2a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -1469,6 +1469,7 @@ public class Room implements Comparable, ISerialize, Runnable { if (unit.hasStatus(RoomUnitStatus.SIT)) { unit.sitUpdate = true; } + break; } } From ce11bf8849049fd462074e68fdbaac958e58baf8 Mon Sep 17 00:00:00 2001 From: Jose Flores Date: Wed, 26 Aug 2020 11:24:18 -0300 Subject: [PATCH 190/215] Fix teleport invisible bug --- src/main/java/com/eu/habbo/habbohotel/rooms/Room.java | 2 +- .../com/eu/habbo/habbohotel/rooms/RoomManager.java | 10 +++++----- .../runnables/teleport/TeleportActionThree.java | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 223d5a2a..d87e5ebd 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -2611,7 +2611,7 @@ public class Room implements Comparable, ISerialize, Runnable { habbo.getRoomUnit().getCurrentLocation().removeUnit(habbo.getRoomUnit()); } - if (sendRemovePacket && habbo.getRoomUnit() != null) { + if (sendRemovePacket && habbo.getRoomUnit() != null && !habbo.getRoomUnit().isTeleporting) { this.sendComposer(new RoomUserRemoveComposer(habbo.getRoomUnit()).compose()); } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java index cf1e289e..250dee09 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java @@ -586,11 +586,11 @@ public class RoomManager { habbo.getClient().sendResponse(new HideDoorbellComposer("")); if (habbo.getRoomUnit() != null) { - Room existingRoom = habbo.getRoomUnit().getRoom(); - if (existingRoom != null) { - if (habbo.getRoomUnit().getCurrentLocation() != null) - habbo.getRoomUnit().getCurrentLocation().removeUnit(habbo.getRoomUnit()); - habbo.getRoomUnit().getRoom().sendComposer(new RoomUserRemoveComposer(habbo.getRoomUnit()).compose()); + RoomUnit existingRoom = habbo.getRoomUnit(); + if (existingRoom.getRoom() != null) { + if (existingRoom.getCurrentLocation() != null) + existingRoom.getCurrentLocation().removeUnit(existingRoom); + existingRoom.getRoom().sendComposer(new RoomUserRemoveComposer(existingRoom).compose()); } habbo.getRoomUnit().setRoom(null); } diff --git a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionThree.java b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionThree.java index 8289a1b6..2a54060a 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionThree.java +++ b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionThree.java @@ -59,7 +59,7 @@ class TeleportActionThree implements Runnable { this.client.getHabbo().getRoomUnit().setRotation(RoomUserRotation.values()[targetTeleport.getRotation() % 8]); if (targetRoom != this.room) { - this.room.removeHabbo(this.client.getHabbo(), true); + this.room.removeHabbo(this.client.getHabbo(), false); Emulator.getGameEnvironment().getRoomManager().enterRoom(this.client.getHabbo(), targetRoom.getId(), "", Emulator.getConfig().getBoolean("hotel.teleport.locked.allowed"), teleportLocation); } From 47865f0ec5a18328948e2b9eff3db56f0f1c088a Mon Sep 17 00:00:00 2001 From: ArpyAge Date: Tue, 1 Sep 2020 00:22:21 +0200 Subject: [PATCH 191/215] Plugin events to make everything stackable if needed (in case of :buildheight) --- .../com/eu/habbo/habbohotel/rooms/Room.java | 28 ++++++++++++++----- .../events/furniture/FurnitureMovedEvent.java | 12 ++++++-- .../furniture/FurniturePlacedEvent.java | 11 +++++++- .../furniture/FurnitureStackHeightEvent.java | 27 ++++++++++++++++++ 4 files changed, 68 insertions(+), 10 deletions(-) create mode 100644 src/main/java/com/eu/habbo/plugin/events/furniture/FurnitureStackHeightEvent.java diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 82543235..8ccbcc72 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -3560,7 +3560,13 @@ public class Room implements Comparable, ISerialize, Runnable { } } - if (!stackHelper) { + boolean pluginHelper = false; + if (Emulator.getPluginManager().isRegistered(FurnitureStackHeightEvent.class, true)) { + FurnitureStackHeightEvent event = Emulator.getPluginManager().fireEvent(new FurnitureStackHeightEvent(x, y, this)); + stackHelper = event.hasPluginHelper(); + } + + if (!stackHelper && !pluginHelper) { HabboItem item = this.getTopItemAt(x, y, exclude); if (item != null) { canStack = item.getBaseItem().allowStack(); @@ -4443,19 +4449,22 @@ public class Room implements Comparable, ISerialize, Runnable { } public FurnitureMovementError placeFloorFurniAt(HabboItem item, RoomTile tile, int rotation, Habbo owner) throws Exception { + boolean pluginHelper = false; if (Emulator.getPluginManager().isRegistered(FurniturePlacedEvent.class, true)) { - Event furniturePlacedEvent = new FurniturePlacedEvent(item, owner, tile); - Emulator.getPluginManager().fireEvent(furniturePlacedEvent); + FurniturePlacedEvent event = Emulator.getPluginManager().fireEvent(new FurniturePlacedEvent(item, owner, tile)); - if (furniturePlacedEvent.isCancelled()) + if (event.isCancelled()) { return FurnitureMovementError.CANCEL_PLUGIN_PLACE; + } + + pluginHelper = event.hasPluginHelper(); } THashSet occupiedTiles = this.layout.getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation); FurnitureMovementError fits = furnitureFitsAt(tile, item, rotation); - if (!fits.equals(FurnitureMovementError.NONE)) { + if (!fits.equals(FurnitureMovementError.NONE) && !pluginHelper) { return fits; } @@ -4520,9 +4529,14 @@ public class Room implements Comparable, ISerialize, Runnable { public FurnitureMovementError moveFurniTo(HabboItem item, RoomTile tile, int rotation, Habbo actor) { RoomTile oldLocation = this.layout.getTile(item.getX(), item.getY()); + + boolean pluginHelper = false; if (Emulator.getPluginManager().isRegistered(FurnitureMovedEvent.class, true)) { - if (Emulator.getPluginManager().fireEvent(new FurnitureMovedEvent(item, actor, oldLocation, tile)).isCancelled()) + FurnitureMovedEvent event = Emulator.getPluginManager().fireEvent(new FurnitureMovedEvent(item, actor, oldLocation, tile)); + if(event.isCancelled()) { return FurnitureMovementError.CANCEL_PLUGIN_MOVE; + } + pluginHelper = event.hasPluginHelper(); } HabboItem topItem = this.getTopItemAt(tile.x, tile.y); @@ -4534,7 +4548,7 @@ public class Room implements Comparable, ISerialize, Runnable { //Check if can be placed at new position THashSet occupiedTiles = this.layout.getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation); - if (!stackHelper.isPresent()) { + if (!stackHelper.isPresent() && !pluginHelper) { if (topItem != item) { for (RoomTile t : occupiedTiles) { HabboItem tileTopItem = this.getTopItemAt(t.x, t.y); diff --git a/src/main/java/com/eu/habbo/plugin/events/furniture/FurnitureMovedEvent.java b/src/main/java/com/eu/habbo/plugin/events/furniture/FurnitureMovedEvent.java index 13ce67e0..cbf4e1e5 100644 --- a/src/main/java/com/eu/habbo/plugin/events/furniture/FurnitureMovedEvent.java +++ b/src/main/java/com/eu/habbo/plugin/events/furniture/FurnitureMovedEvent.java @@ -7,9 +7,8 @@ import com.eu.habbo.habbohotel.users.HabboItem; public class FurnitureMovedEvent extends FurnitureUserEvent { public final RoomTile oldPosition; - - public final RoomTile newPosition; + private boolean pluginHelper; public FurnitureMovedEvent(HabboItem furniture, Habbo habbo, RoomTile oldPosition, RoomTile newPosition) { @@ -17,5 +16,14 @@ public class FurnitureMovedEvent extends FurnitureUserEvent { this.oldPosition = oldPosition; this.newPosition = newPosition; + this.pluginHelper = false; + } + + public void setPluginHelper(boolean helper) { + this.pluginHelper = helper; + } + + public boolean hasPluginHelper() { + return this.pluginHelper; } } diff --git a/src/main/java/com/eu/habbo/plugin/events/furniture/FurniturePlacedEvent.java b/src/main/java/com/eu/habbo/plugin/events/furniture/FurniturePlacedEvent.java index 10308ebb..6af5747e 100644 --- a/src/main/java/com/eu/habbo/plugin/events/furniture/FurniturePlacedEvent.java +++ b/src/main/java/com/eu/habbo/plugin/events/furniture/FurniturePlacedEvent.java @@ -7,11 +7,20 @@ import com.eu.habbo.habbohotel.users.HabboItem; public class FurniturePlacedEvent extends FurnitureUserEvent { public final RoomTile location; - + private boolean pluginHelper; public FurniturePlacedEvent(HabboItem furniture, Habbo habbo, RoomTile location) { super(furniture, habbo); this.location = location; + this.pluginHelper = false; + } + + public void setPluginHelper(boolean helper) { + this.pluginHelper = helper; + } + + public boolean hasPluginHelper() { + return this.pluginHelper; } } diff --git a/src/main/java/com/eu/habbo/plugin/events/furniture/FurnitureStackHeightEvent.java b/src/main/java/com/eu/habbo/plugin/events/furniture/FurnitureStackHeightEvent.java new file mode 100644 index 00000000..f6359407 --- /dev/null +++ b/src/main/java/com/eu/habbo/plugin/events/furniture/FurnitureStackHeightEvent.java @@ -0,0 +1,27 @@ +package com.eu.habbo.plugin.events.furniture; + +import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.plugin.Event; + +public class FurnitureStackHeightEvent extends Event { + + public final short x; + public final short y; + public final Room room; + private boolean pluginHelper; + + public FurnitureStackHeightEvent(short x, short y, Room room) { + this.x = x; + this.y = y; + this.room = room; + this.pluginHelper = false; + } + + public void setPluginHelper(boolean helper) { + this.pluginHelper = helper; + } + + public boolean hasPluginHelper() { + return this.pluginHelper; + } +} From f6f1897ab88e388838eb5fec78d001bdfa39e9fd Mon Sep 17 00:00:00 2001 From: Beny Date: Tue, 1 Sep 2020 20:47:49 +0200 Subject: [PATCH 192/215] Config value added for amount of users to roll - hotel.room.rollers.roll_avatars.max --- src/main/java/com/eu/habbo/habbohotel/rooms/Room.java | 7 ++++++- src/main/java/com/eu/habbo/plugin/PluginManager.java | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index d87e5ebd..9a0803fb 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -114,6 +114,7 @@ public class Room implements Comparable, ISerialize, Runnable { public static int IDLE_CYCLES = 240; public static int IDLE_CYCLES_KICK = 480; public static String PREFIX_FORMAT = "[%prefix%] "; + public static int ROLLERS_MAXIMUM_ROLL_AVATARS = 1; static { for (int i = 1; i <= 3; i++) { @@ -1409,9 +1410,13 @@ public class Room implements Comparable, ISerialize, Runnable { HabboItem nextTileChair = this.getLowestChair(tileInFront); + THashSet usersRolledThisTile = new THashSet<>(); + for (RoomUnit unit : unitsOnTile) { if (rolledUnitIds.contains(unit.getId())) continue; + if(usersRolledThisTile.size() >= Room.ROLLERS_MAXIMUM_ROLL_AVATARS) break; + if (stackContainsRoller && !allowFurniture && !(topItem != null && topItem.isWalkable())) continue; @@ -1446,6 +1451,7 @@ public class Room implements Comparable, ISerialize, Runnable { } } + usersRolledThisTile.add(unit.getId()); rolledUnitIds.add(unit.getId()); updatedUnit.remove(unit); messages.add(new RoomUnitOnRollerComposer(unit, roller, unit.getCurrentLocation(), unit.getZ() + (isRiding ? 1 : 0), tile, tile.getStackHeight() + (isRiding ? 1 : 0) + (nextTileChair != null ? -1 : 0), room)); @@ -1469,7 +1475,6 @@ public class Room implements Comparable, ISerialize, Runnable { if (unit.hasStatus(RoomUnitStatus.SIT)) { unit.sitUpdate = true; } - break; } } diff --git a/src/main/java/com/eu/habbo/plugin/PluginManager.java b/src/main/java/com/eu/habbo/plugin/PluginManager.java index 0355c04d..52df1e66 100644 --- a/src/main/java/com/eu/habbo/plugin/PluginManager.java +++ b/src/main/java/com/eu/habbo/plugin/PluginManager.java @@ -106,6 +106,7 @@ public class PluginManager { Room.HAND_ITEM_TIME = Emulator.getConfig().getInt("hotel.rooms.handitem.time"); Room.IDLE_CYCLES = Emulator.getConfig().getInt("hotel.roomuser.idle.cycles", 240); Room.IDLE_CYCLES_KICK = Emulator.getConfig().getInt("hotel.roomuser.idle.cycles.kick", 480); + Room.ROLLERS_MAXIMUM_ROLL_AVATARS = Emulator.getConfig().getInt("hotel.room.rollers.roll_avatars.max", 1); RoomManager.MAXIMUM_ROOMS_VIP = Emulator.getConfig().getInt("hotel.max.rooms.vip"); RoomManager.MAXIMUM_ROOMS_USER = Emulator.getConfig().getInt("hotel.max.rooms.user"); RoomManager.HOME_ROOM_ID = Emulator.getConfig().getInt("hotel.home.room"); From 2c7b58c2a1d8fc7f0a2604e49109b7dae3f7cb13 Mon Sep 17 00:00:00 2001 From: Beny Date: Thu, 3 Sep 2020 02:04:41 +0200 Subject: [PATCH 193/215] Vending machines fixed --- .../InteractionEffectVendingMachine.java | 4 +- .../InteractionNoSidesVendingMachine.java | 16 +- .../InteractionVendingMachine.java | 211 +++++++++--------- 3 files changed, 124 insertions(+), 107 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachine.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachine.java index eccba568..c0d42279 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachine.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachine.java @@ -29,7 +29,7 @@ public class InteractionEffectVendingMachine extends InteractionVendingMachine { } @Override - public void giveVendingMachineItem(Habbo habbo, Room room) { - room.giveEffect(habbo.getRoomUnit(), this.getBaseItem().getRandomVendingItem(), 30); + public void giveVendingMachineItem(Room room, RoomUnit unit) { + room.giveEffect(unit, this.getBaseItem().getRandomVendingItem(), 30); } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionNoSidesVendingMachine.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionNoSidesVendingMachine.java index 367d500e..f2463700 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionNoSidesVendingMachine.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionNoSidesVendingMachine.java @@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.users.Habbo; +import gnu.trove.set.hash.THashSet; import java.sql.ResultSet; import java.sql.SQLException; @@ -18,7 +19,18 @@ public class InteractionNoSidesVendingMachine extends InteractionVendingMachine } @Override - public RoomTile getRequiredTile(Habbo habbo, Room room) { - return habbo.getRoomUnit().getClosestAdjacentTile(this.getX(), this.getY(), true); + public THashSet getActivatorTiles(Room room) { + + THashSet tiles = new THashSet(); + for(int x = -1; x <= 1; x++) { + for(int y = -1; y <= 1; y++) { + RoomTile tile = room.getLayout().getTile((short)(this.getX() + x), (short)(this.getY() + y)); + if(tile != null) { + tiles.add(tile); + } + } + } + + return tiles; } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java index 04511206..be0f5cba 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java @@ -6,18 +6,23 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.*; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboGender; +import com.eu.habbo.habbohotel.users.HabboItem; +import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.rooms.items.FloorItemUpdateComposer; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer; import com.eu.habbo.threading.runnables.RoomUnitGiveHanditem; import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation; import com.eu.habbo.util.pathfinding.Rotation; +import gnu.trove.set.hash.THashSet; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.ScheduledFuture; -public class InteractionVendingMachine extends InteractionDefault { +public class InteractionVendingMachine extends HabboItem { public InteractionVendingMachine(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); this.setExtradata("0"); @@ -27,6 +32,65 @@ public class InteractionVendingMachine extends InteractionDefault { super(id, userId, item, extradata, limitedStack, limitedSells); this.setExtradata("0"); } + + public THashSet getActivatorTiles(Room room) { + THashSet tiles = new THashSet(); + tiles.add(getSquareInFront(room.getLayout(), this)); + tiles.add(room.getLayout().getTile(this.getX(), this.getY())); + return tiles; + } + + @Override + public void serializeExtradata(ServerMessage serverMessage) { + serverMessage.appendInt((this.isLimited() ? 256 : 0)); + serverMessage.appendString(this.getExtradata()); + + super.serializeExtradata(serverMessage); + } + + private void tryInteract(GameClient client, Room room, RoomUnit unit) { + THashSet activatorTiles = getActivatorTiles(room); + + if(activatorTiles.size() == 0) + return; + + boolean inActivatorSpace = false; + + for(RoomTile tile : activatorTiles) { + if(unit.getCurrentLocation().is(unit.getX(), unit.getY())) { + inActivatorSpace = true; + } + } + + if(inActivatorSpace) { + useVendingMachine(client, room, unit); + } + } + + private void useVendingMachine(GameClient client, Room room, RoomUnit unit) { + this.setExtradata("1"); + room.updateItem(this); + + if(!unit.isWalking()) { + this.rotateToMachine(room, unit); + } + + Emulator.getThreading().run(() -> { + + giveVendingMachineItem(room, unit); + + if (this.getBaseItem().getEffectM() > 0 && client.getHabbo().getHabboInfo().getGender() == HabboGender.M) + room.giveEffect(client.getHabbo(), this.getBaseItem().getEffectM(), -1); + if (this.getBaseItem().getEffectF() > 0 && client.getHabbo().getHabboInfo().getGender() == HabboGender.F) + room.giveEffect(client.getHabbo(), this.getBaseItem().getEffectF(), -1); + + Emulator.getThreading().run(this, 500); + }, 1500); + } + + public void giveVendingMachineItem(Room room, RoomUnit unit) { + Emulator.getThreading().run(new RoomUnitGiveHanditem(unit, room, this.getBaseItem().getRandomVendingItem())); + } @Override public void onClick(GameClient client, Room room, Object[] objects) throws Exception { @@ -36,81 +100,49 @@ public class InteractionVendingMachine extends InteractionDefault { return; } - RoomTile tile = this.getRequiredTile(client.getHabbo(), room); + RoomUnit unit = client.getHabbo().getRoomUnit(); - if (tile != null && - tile.equals(client.getHabbo().getRoomUnit().getCurrentLocation())) { - if (!this.getExtradata().equals("0") || this.getExtradata().length() != 0) { - return; - } - - if (!client.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.SIT) && (!client.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.MOVE) || tile.equals(client.getHabbo().getRoomUnit().getGoal()))) { - room.updateHabbo(client.getHabbo()); - this.rotateToMachine(client.getHabbo().getRoomUnit()); - client.getHabbo().getRoomUnit().removeStatus(RoomUnitStatus.MOVE); - room.scheduledComposers.add(new RoomUserStatusComposer(client.getHabbo().getRoomUnit()).compose()); - } + THashSet activatorTiles = getActivatorTiles(room); - super.onClick(client, room, new Object[]{"TOGGLE_OVERRIDE"}); + if(activatorTiles.size() == 0) + return; - this.setExtradata("1"); - room.scheduledComposers.add(new FloorItemUpdateComposer(this).compose()); + boolean inActivatorSpace = false; - this.runGiveItemThread(client, room); - } else { - if (!tile.isWalkable() && tile.state != RoomTileState.SIT && tile.state != RoomTileState.LAY) { - for (RoomTile t : room.getLayout().getTilesAround(room.getLayout().getTile(this.getX(), this.getY()))) { - if (t != null && t.isWalkable()) { - tile = t; - break; - } + for(RoomTile tile : activatorTiles) { + if(unit.getCurrentLocation().is(tile.x, tile.y)) { + inActivatorSpace = true; + } + } + + if(!inActivatorSpace) { + RoomTile tileToWalkTo = null; + for(RoomTile tile : activatorTiles) { + if(room.getLayout().tileWalkable(tile.x, tile.y) && (tileToWalkTo == null || tileToWalkTo.distance(unit.getCurrentLocation()) > tile.distance(unit.getCurrentLocation()))) { + tileToWalkTo = tile; } } - RoomTile finalTile = tile; - client.getHabbo().getRoomUnit().setGoalLocation(tile); + if(tileToWalkTo != null) { + List onSuccess = new ArrayList(); + List onFail = new ArrayList(); - Emulator.getThreading().run(new RoomUnitWalkToLocation(client.getHabbo().getRoomUnit(), tile, room, () -> { - this.setExtradata("1"); - room.scheduledComposers.add(new FloorItemUpdateComposer(this).compose()); + onSuccess.add(() -> { + tryInteract(client, room, unit); + }); - try { - super.onClick(client, room, new Object[]{"TOGGLE_OVERRIDE"}); - } catch (Exception e) { - e.printStackTrace(); - } - - Emulator.getThreading().run(() -> client.getHabbo().getRoomUnit().setMoveBlockingTask(Emulator.getThreading().run(() -> { - if (client.getHabbo().getRoomUnit().getCurrentLocation().equals(finalTile)) { - this.rotateToMachine(client.getHabbo().getRoomUnit()); - room.sendComposer(new RoomUserStatusComposer(client.getHabbo().getRoomUnit()).compose()); - } - - this.runGiveItemThread(client, room); - }, 300)), 250); - }, null)); + unit.setGoalLocation(tileToWalkTo); + Emulator.getThreading().run(new RoomUnitWalkToLocation(unit, tileToWalkTo, room, onSuccess, onFail)); + } + } + else { + useVendingMachine(client, room, unit); } } - private void runGiveItemThread(GameClient client, Room room) { - try { - ScheduledFuture thread = Emulator.getThreading().run(() -> { - Emulator.getThreading().run(this, 1000); - this.giveVendingMachineItem(client.getHabbo(), room); + @Override + public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { - if (this.getBaseItem().getEffectM() > 0 && client.getHabbo().getHabboInfo().getGender() == HabboGender.M) - room.giveEffect(client.getHabbo(), this.getBaseItem().getEffectM(), -1); - if (this.getBaseItem().getEffectF() > 0 && client.getHabbo().getHabboInfo().getGender() == HabboGender.F) - room.giveEffect(client.getHabbo(), this.getBaseItem().getEffectF(), -1); - }, 500); - - if (thread.isDone()) { - thread.get(); - } - - } catch (InterruptedException | ExecutionException e) { - e.printStackTrace(); - } } @Override @@ -125,54 +157,27 @@ public class InteractionVendingMachine extends InteractionDefault { } } + @Override + public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects) { + return true; + } + + @Override + public boolean isWalkable() { + return this.getBaseItem().allowWalk(); + } + @Override public boolean isUsable() { return true; } - private void rotateToMachine(RoomUnit unit) { - if (unit.getCurrentLocation().getState() != RoomTileState.OPEN) { - // if sitting on a chair or laying on a bed, skip rotating altogether - return; - } - + private void rotateToMachine(Room room, RoomUnit unit) { RoomUserRotation rotation = RoomUserRotation.values()[Rotation.Calculate(unit.getX(), unit.getY(), this.getX(), this.getY())]; - boolean onlyHead = false; - switch (unit.getBodyRotation()) { - case NORTH_EAST: - if (rotation.equals(RoomUserRotation.NORTH) || rotation.equals(RoomUserRotation.EAST)) - onlyHead = true; - break; - - case NORTH_WEST: - if (rotation.equals(RoomUserRotation.NORTH) || rotation.equals(RoomUserRotation.WEST)) - onlyHead = true; - break; - - case SOUTH_EAST: - if (rotation.equals(RoomUserRotation.SOUTH) || rotation.equals(RoomUserRotation.EAST)) - onlyHead = true; - break; - - case SOUTH_WEST: - if (rotation.equals(RoomUserRotation.SOUTH) || rotation.equals(RoomUserRotation.WEST)) - onlyHead = true; - break; - } - - if (onlyHead) { - unit.setHeadRotation(rotation); - } else { + if(Math.abs(unit.getBodyRotation().getValue() - rotation.getValue()) > 1) { unit.setRotation(rotation); + unit.statusUpdate(true); } } - - public void giveVendingMachineItem(Habbo habbo, Room room) { - Emulator.getThreading().run(new RoomUnitGiveHanditem(habbo.getRoomUnit(), room, this.getBaseItem().getRandomVendingItem())); - } - - public RoomTile getRequiredTile(Habbo habbo, Room room) { - return getSquareInFront(room.getLayout(), this); - } } From 3600a8f53ce92200910a0bf15df0407f961f2674 Mon Sep 17 00:00:00 2001 From: ArpyAge Date: Thu, 3 Sep 2020 22:07:45 +0200 Subject: [PATCH 194/215] updated getStackHeight so it's the same as the devbuild --- .../com/eu/habbo/habbohotel/rooms/Room.java | 53 +++++++++---------- .../furniture/FurnitureStackHeightEvent.java | 10 ++++ 2 files changed, 35 insertions(+), 28 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 8ccbcc72..9625ce26 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -3542,43 +3542,40 @@ public class Room implements Comparable, ISerialize, Runnable { } public double getStackHeight(short x, short y, boolean calculateHeightmap, HabboItem exclude) { + if (x < 0 || y < 0 || this.layout == null) return calculateHeightmap ? Short.MAX_VALUE : 0.0; + boolean pluginHelper = false; + if (Emulator.getPluginManager().isRegistered(FurnitureStackHeightEvent.class, true)) { + FurnitureStackHeightEvent event = Emulator.getPluginManager().fireEvent(new FurnitureStackHeightEvent(x, y, this)); + if(event.hasPluginHelper()) { + return calculateHeightmap ? event.getHeight() * 256.0D : event.getHeight(); + } + } + double height = this.layout.getHeightAtSquare(x, y); boolean canStack = true; - boolean stackHelper = false; - THashSet items = this.getItemsAt(x, y); - if (items != null) { - for (HabboItem item : items) { + + THashSet stackHelpers = this.getItemsAt(InteractionStackHelper.class, x, y); + + if(stackHelpers.size() > 0) { + for(HabboItem item : stackHelpers) { if (item == exclude) continue; - - if (item instanceof InteractionStackHelper) { - stackHelper = true; - height = item.getExtradata().isEmpty() ? Double.valueOf("0.0") : (Double.valueOf(item.getExtradata()) / 100); - canStack = true; - } + return calculateHeightmap ? item.getZ() * 256.0D : item.getZ(); } + } - boolean pluginHelper = false; - if (Emulator.getPluginManager().isRegistered(FurnitureStackHeightEvent.class, true)) { - FurnitureStackHeightEvent event = Emulator.getPluginManager().fireEvent(new FurnitureStackHeightEvent(x, y, this)); - stackHelper = event.hasPluginHelper(); - } + HabboItem item = this.getTopItemAt(x, y, exclude); + if (item != null) { + canStack = item.getBaseItem().allowStack(); + height = item.getZ() + Item.getCurrentHeight(item); + } - if (!stackHelper && !pluginHelper) { - HabboItem item = this.getTopItemAt(x, y, exclude); - if (item != null) { - canStack = item.getBaseItem().allowStack(); - height = item.getZ() + Item.getCurrentHeight(item); - } - - HabboItem lowestChair = this.getLowestChair(x, y); - if (lowestChair != null && lowestChair != exclude) { - canStack = true; - height = lowestChair.getZ() + Item.getCurrentHeight(lowestChair); - } - } + HabboItem lowestChair = this.getLowestChair(x, y); + if (lowestChair != null && lowestChair != exclude) { + canStack = true; + height = lowestChair.getZ(); } if (calculateHeightmap) { diff --git a/src/main/java/com/eu/habbo/plugin/events/furniture/FurnitureStackHeightEvent.java b/src/main/java/com/eu/habbo/plugin/events/furniture/FurnitureStackHeightEvent.java index f6359407..80bb8e82 100644 --- a/src/main/java/com/eu/habbo/plugin/events/furniture/FurnitureStackHeightEvent.java +++ b/src/main/java/com/eu/habbo/plugin/events/furniture/FurnitureStackHeightEvent.java @@ -9,12 +9,14 @@ public class FurnitureStackHeightEvent extends Event { public final short y; public final Room room; private boolean pluginHelper; + private Double height; public FurnitureStackHeightEvent(short x, short y, Room room) { this.x = x; this.y = y; this.room = room; this.pluginHelper = false; + this.height = 0.0D; } public void setPluginHelper(boolean helper) { @@ -24,4 +26,12 @@ public class FurnitureStackHeightEvent extends Event { public boolean hasPluginHelper() { return this.pluginHelper; } + + public void setHeight(Double height) { + this.height = height; + } + + public Double getHeight() { + return this.height; + } } From 86ae72c02d5e73b20ad25430023ec40724bb31b2 Mon Sep 17 00:00:00 2001 From: ArpyAge Date: Thu, 3 Sep 2020 22:08:24 +0200 Subject: [PATCH 195/215] Removed unused code --- src/main/java/com/eu/habbo/habbohotel/rooms/Room.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 9625ce26..3ca76525 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -3545,8 +3545,7 @@ public class Room implements Comparable, ISerialize, Runnable { if (x < 0 || y < 0 || this.layout == null) return calculateHeightmap ? Short.MAX_VALUE : 0.0; - - boolean pluginHelper = false; + if (Emulator.getPluginManager().isRegistered(FurnitureStackHeightEvent.class, true)) { FurnitureStackHeightEvent event = Emulator.getPluginManager().fireEvent(new FurnitureStackHeightEvent(x, y, this)); if(event.hasPluginHelper()) { From 1298f48e53b445ecc091d06cbe64782221600971 Mon Sep 17 00:00:00 2001 From: harmonic Date: Sun, 6 Sep 2020 13:21:06 +0100 Subject: [PATCH 196/215] Added Thankyou Console Command. Added missing SQL File. 2.4.0 Stable. --- sqlupdates/2_4_0-RC-2 to 2_4_0.sql | 3 ++ .../core/consolecommands/ConsoleCommand.java | 1 + .../ThankyouArcturusCommand.java | 43 +++++++++++++++++++ .../incoming/users/PickNewUserGiftEvent.java | 2 +- 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 sqlupdates/2_4_0-RC-2 to 2_4_0.sql create mode 100644 src/main/java/com/eu/habbo/core/consolecommands/ThankyouArcturusCommand.java diff --git a/sqlupdates/2_4_0-RC-2 to 2_4_0.sql b/sqlupdates/2_4_0-RC-2 to 2_4_0.sql new file mode 100644 index 00000000..ea380bc0 --- /dev/null +++ b/sqlupdates/2_4_0-RC-2 to 2_4_0.sql @@ -0,0 +1,3 @@ +-- Adds config value for max amount of people to move per roller. Default is like habbo. +INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.room.rollers.roll_avatars.max', '1'); +INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.nux.gifts.enabled', '0'); diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java index 23604f3e..ea103623 100644 --- a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java +++ b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java @@ -23,6 +23,7 @@ public abstract class ConsoleCommand { addCommand(new ConsoleReconnectCameraCommand()); addCommand(new ShowInteractionsCommand()); addCommand(new ShowRCONCommands()); + addCommand(new ThankyouArcturusCommand()); } public static void addCommand(ConsoleCommand command) { diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ThankyouArcturusCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ThankyouArcturusCommand.java new file mode 100644 index 00000000..64378af5 --- /dev/null +++ b/src/main/java/com/eu/habbo/core/consolecommands/ThankyouArcturusCommand.java @@ -0,0 +1,43 @@ +package com.eu.habbo.core.consolecommands; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ThankyouArcturusCommand extends ConsoleCommand { + private static final Logger LOGGER = LoggerFactory.getLogger(ThankyouArcturusCommand.class); + + public ThankyouArcturusCommand() { + super("thankyou", "A thankyou message."); + } + + @Override + public void handle(String[] args) throws Exception { + LOGGER.info("Arcturus Morningstar is an opensource community fork of Arcturus Emulator by TheGeneral"); + LOGGER.info("Thankyou to the following people who have helped with it's development:"); + LOGGER.info("TheGeneral - For Creating Arcturus."); + LOGGER.info("Capheus - Decompilation"); + LOGGER.info("Beny - Lead Developer"); + LOGGER.info("Alejandro - Lead Developer"); + LOGGER.info("Harmonic - Developer"); + LOGGER.info("ArpyAge - Developer"); + LOGGER.info("Mike - Developer"); + LOGGER.info("Skeletor - Developer"); + LOGGER.info("zGrav - Developer"); + LOGGER.info("Swirny - Developer"); + LOGGER.info("Quadral - Developer"); + LOGGER.info("Dome - Developer"); + LOGGER.info("Necmi - Developer"); + LOGGER.info("Oliver - Support"); + LOGGER.info("Rasmus - Support"); + LOGGER.info("Layne - Support"); + LOGGER.info("Bill - Support"); + LOGGER.info("Harmony - Support"); + LOGGER.info("Ridge - Catalogue"); + LOGGER.info("Tenshie - Catalogue"); + LOGGER.info("Wulles - Catalogue"); + LOGGER.info("Gizmo - Catalogue"); + LOGGER.info("TheJava - Motivation"); + LOGGER.info("The Entire Krews.org Community."); + } + } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/incoming/users/PickNewUserGiftEvent.java b/src/main/java/com/eu/habbo/messages/incoming/users/PickNewUserGiftEvent.java index 24530532..979e6ac8 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/users/PickNewUserGiftEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/users/PickNewUserGiftEvent.java @@ -14,7 +14,7 @@ public class PickNewUserGiftEvent extends MessageHandler { int index = this.packet.readInt(); if (!Emulator.getPluginManager().fireEvent(new UserPickGiftEvent(this.client.getHabbo(), keyA, keyB, index)).isCancelled()) { - if (!this.client.getHabbo().getHabboStats().nuxReward) { + if (!this.client.getHabbo().getHabboStats().nuxReward && Emulator.getConfig().getBoolean("hotel.nux.gifts.enabled")){ this.client.getHabbo().getHabboStats().nuxReward = true; NewUserGift gift = Emulator.getGameEnvironment().getItemManager().getNewUserGift(index + 1); From 270d07f2c3c7a14d431e4fe405ce7ba94b14d1e0 Mon Sep 17 00:00:00 2001 From: harmonic Date: Sun, 6 Sep 2020 13:23:08 +0100 Subject: [PATCH 197/215] Revert Changes to FriendRequestEvent --- .../habbo/messages/incoming/friends/FriendRequestEvent.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java b/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java index 3c0b760b..f595d730 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/friends/FriendRequestEvent.java @@ -25,6 +25,10 @@ public class FriendRequestEvent extends MessageHandler { String username = this.packet.readString(); Habbo habbo = Emulator.getGameServer().getGameClientManager().getHabbo(username); + if (habbo.getHabboInfo().getId() == this.client.getHabbo().getHabboInfo().getId()) { + return; + } + if (Emulator.getPluginManager().fireEvent(new UserRequestFriendshipEvent(this.client.getHabbo(), username, habbo)).isCancelled()) { this.client.sendResponse(new FriendRequestErrorComposer(2)); return; @@ -44,7 +48,7 @@ public class FriendRequestEvent extends MessageHandler { return; } - if(!habbo.isOnline()) { + if (habbo == null) { try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users_settings.block_friendrequests, users.id FROM users INNER JOIN users_settings ON users.id = users_settings.user_id WHERE username = ? LIMIT 1")) { statement.setString(1, username); try (ResultSet set = statement.executeQuery()) { From 9dd93e5c4e7c7089aefea0b1ccb376eb046614fe Mon Sep 17 00:00:00 2001 From: harmonic Date: Sun, 6 Sep 2020 13:25:46 +0100 Subject: [PATCH 198/215] 2.4.0 Stable. Changed Version String. --- src/main/java/com/eu/habbo/Emulator.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/eu/habbo/Emulator.java b/src/main/java/com/eu/habbo/Emulator.java index 540c70c7..9954c318 100644 --- a/src/main/java/com/eu/habbo/Emulator.java +++ b/src/main/java/com/eu/habbo/Emulator.java @@ -38,11 +38,10 @@ public final class Emulator { public final static int MAJOR = 2; public final static int MINOR = 4; public final static int BUILD = 0; + + public final static String PREVIEW = ""; - // Rick and Morty Edition - public final static String PREVIEW = "RC-2"; - - public static final String version = "Arcturus Morningstar" + " " + MAJOR + "." + MINOR + "." + BUILD + "-" + PREVIEW; + public static final String version = "Arcturus Morningstar" + " " + MAJOR + "." + MINOR + "." + BUILD; private static final String logo = "\n" + "███╗ ███╗ ██████╗ ██████╗ ███╗ ██╗██╗███╗ ██╗ ██████╗ ███████╗████████╗ █████╗ ██████╗ \n" + From 01b23cdc7eec370f09d1c719b4437baa1d8572ed Mon Sep 17 00:00:00 2001 From: Beny Date: Sun, 13 Sep 2020 07:14:59 +0200 Subject: [PATCH 199/215] Fixed sitting rotate bug vending machines --- .../items/interactions/InteractionVendingMachine.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java index be0f5cba..4fdd0eb1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java @@ -71,7 +71,7 @@ public class InteractionVendingMachine extends HabboItem { this.setExtradata("1"); room.updateItem(this); - if(!unit.isWalking()) { + if(!unit.isWalking() && !unit.hasStatus(RoomUnitStatus.SIT) && !unit.hasStatus(RoomUnitStatus.LAY)) { this.rotateToMachine(room, unit); } From 1b779b772ebb42a5744833473aa5553387e52762 Mon Sep 17 00:00:00 2001 From: Beny Date: Sun, 13 Sep 2020 07:25:05 +0200 Subject: [PATCH 200/215] Football fixes --- .../interactions/InteractionPushable.java | 8 +++-- .../games/football/InteractionFootball.java | 31 +++++++++++++++---- .../threading/runnables/KickBallAction.java | 9 ++++-- 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPushable.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPushable.java index 3cd88425..a8d0db0e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPushable.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPushable.java @@ -50,7 +50,7 @@ public abstract class InteractionPushable extends InteractionDefault { if (this.currentThread != null) this.currentThread.dead = true; - this.currentThread = new KickBallAction(this, room, roomUnit, direction, velocity); + this.currentThread = new KickBallAction(this, room, roomUnit, direction, velocity, false); Emulator.getThreading().run(this.currentThread, 0); } } @@ -69,7 +69,7 @@ public abstract class InteractionPushable extends InteractionDefault { if (this.currentThread != null) this.currentThread.dead = true; - this.currentThread = new KickBallAction(this, room, client.getHabbo().getRoomUnit(), direction, velocity); + this.currentThread = new KickBallAction(this, room, client.getHabbo().getRoomUnit(), direction, velocity, false); Emulator.getThreading().run(this.currentThread, 0); } } @@ -80,6 +80,7 @@ public abstract class InteractionPushable extends InteractionDefault { super.onWalkOn(roomUnit, room, objects); int velocity; + boolean isDrag = false; RoomUserRotation direction; if (this.getX() == roomUnit.getGoal().x && this.getY() == roomUnit.getGoal().y) //User clicked on the tile the ball is on, they want to kick it @@ -92,13 +93,14 @@ public abstract class InteractionPushable extends InteractionDefault { velocity = this.getDragVelocity(roomUnit, room); direction = this.getDragDirection(roomUnit, room); this.onDrag(room, roomUnit, velocity, direction); + isDrag = true; } if (velocity > 0) { if (this.currentThread != null) this.currentThread.dead = true; - this.currentThread = new KickBallAction(this, room, roomUnit, direction, velocity); + this.currentThread = new KickBallAction(this, room, roomUnit, direction, velocity, isDrag); Emulator.getThreading().run(this.currentThread, 0); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootball.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootball.java index 482a3d96..9c81282d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootball.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootball.java @@ -1,5 +1,6 @@ package com.eu.habbo.habbohotel.items.interactions.games.football; +import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.games.football.FootballGame; import com.eu.habbo.habbohotel.items.Item; @@ -34,12 +35,18 @@ public class InteractionFootball extends InteractionPushable { if (roomUnit.getPath().isEmpty() && roomUnit.tilesWalked() == 2) return 0; - return 6; + if (roomUnit.getPath().size() == 0 && roomUnit.tilesWalked() == 1) + return 6; + + return 1; } @Override public int getWalkOffVelocity(RoomUnit roomUnit, Room room) { - return 6; + if (roomUnit.getPath().size() == 0) + return 6; + + return 1; } @Override @@ -79,8 +86,17 @@ public class InteractionFootball extends InteractionPushable { @Override public int getNextRollDelay(int currentStep, int totalSteps) { - int t = 2500; - return (totalSteps == 1) ? 500 : 100 * ((t = t / t - 1) * t * t * t * t + 1) + (currentStep * 100); + + if(totalSteps > 4) { + if(currentStep <= 4) { + return 125; + } + } + + return 500; + + /*int t = 2500; + return (totalSteps == 1) ? 500 : 100 * ((t = t / t - 1) * t * t * t * t + 1) + (currentStep * 100);*/ } @Override @@ -176,8 +192,11 @@ public class InteractionFootball extends InteractionPushable { game.onScore(kicker, color); } - this.setExtradata(nextRoll <= 200 ? "8" : (nextRoll <= 250 ? "7" : (nextRoll <= 300 ? "6" : (nextRoll <= 350 ? "5" : (nextRoll <= 400 ? "4" : (nextRoll <= 450 ? "3" : (nextRoll <= 500 ? "2" : "1"))))))); + this.setExtradata(Math.abs(currentStep - (totalSteps + 1)) + ""); room.sendComposer(new ItemStateComposer(this).compose()); + + /*this.setExtradata(nextRoll <= 200 ? "8" : (nextRoll <= 250 ? "7" : (nextRoll <= 300 ? "6" : (nextRoll <= 350 ? "5" : (nextRoll <= 400 ? "4" : (nextRoll <= 450 ? "3" : (nextRoll <= 500 ? "2" : "1"))))))); + room.sendComposer(new ItemStateComposer(this).compose());*/ } @Override @@ -194,7 +213,7 @@ public class InteractionFootball extends InteractionPushable { @Override public boolean canStillMove(Room room, RoomTile from, RoomTile to, RoomUserRotation direction, RoomUnit kicker, int nextRoll, int currentStep, int totalSteps) { HabboItem topItem = room.getTopItemAt(from.x, from.y, this); - return !(room.hasHabbosAt(to.x, to.y) || (topItem != null && topItem.getBaseItem().getName().startsWith("fball_goal_") && currentStep != 1)); + return !((Emulator.getRandom().nextInt(10) >= 3 && room.hasHabbosAt(to.x, to.y)) || (topItem != null && topItem.getBaseItem().getName().startsWith("fball_goal_") && currentStep != 1)); } @Override diff --git a/src/main/java/com/eu/habbo/threading/runnables/KickBallAction.java b/src/main/java/com/eu/habbo/threading/runnables/KickBallAction.java index d4f5b1bf..0bc85056 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/KickBallAction.java +++ b/src/main/java/com/eu/habbo/threading/runnables/KickBallAction.java @@ -18,14 +18,16 @@ public class KickBallAction implements Runnable { public boolean dead = false; //When true the run() function will not execute. Used when another user kicks the ball whilst it is arleady moving. private RoomUserRotation currentDirection; //The current direction the item is moving in private int currentStep; //The current step of the move sequence + public final boolean isDrag; - public KickBallAction(InteractionPushable ball, Room room, RoomUnit kicker, RoomUserRotation direction, int steps) { + public KickBallAction(InteractionPushable ball, Room room, RoomUnit kicker, RoomUserRotation direction, int steps, boolean isDrag) { this.ball = ball; this.room = room; this.kicker = kicker; this.currentDirection = direction; this.totalSteps = steps; this.currentStep = 0; + this.isDrag = isDrag; } @Override @@ -39,7 +41,10 @@ public class KickBallAction implements Runnable { if (next == null || !this.ball.validMove(this.room, this.room.getLayout().getTile(this.ball.getX(), this.ball.getY()), next)) { RoomUserRotation oldDirection = this.currentDirection; - this.currentDirection = this.ball.getBounceDirection(this.room, this.currentDirection); + + if(!this.isDrag) { + this.currentDirection = this.ball.getBounceDirection(this.room, this.currentDirection); + } if (this.currentDirection != oldDirection) { this.ball.onBounce(this.room, oldDirection, this.currentDirection, this.kicker); From cdbae76e84cafe879037b45fd6ff54a4b321c694 Mon Sep 17 00:00:00 2001 From: Mikkel Friis Date: Tue, 15 Sep 2020 17:22:35 +0200 Subject: [PATCH 201/215] Recycler value fix (critical) --- sqlupdates/2_4_0-RC-2 to 2_4_0-RC-3.sql | 2 ++ .../habbo/messages/incoming/catalog/recycler/RecycleEvent.java | 1 + 2 files changed, 3 insertions(+) create mode 100644 sqlupdates/2_4_0-RC-2 to 2_4_0-RC-3.sql diff --git a/sqlupdates/2_4_0-RC-2 to 2_4_0-RC-3.sql b/sqlupdates/2_4_0-RC-2 to 2_4_0-RC-3.sql new file mode 100644 index 00000000..78ce8842 --- /dev/null +++ b/sqlupdates/2_4_0-RC-2 to 2_4_0-RC-3.sql @@ -0,0 +1,2 @@ +-- Recycler value fix +INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('recycler.value', '8'); \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/recycler/RecycleEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/recycler/RecycleEvent.java index a3c69775..05b6fc32 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/recycler/RecycleEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/recycler/RecycleEvent.java @@ -27,6 +27,7 @@ public class RecycleEvent extends MessageHandler { THashSet items = new THashSet<>(); int count = this.packet.readInt(); + if (count < Emulator.getConfig().getInt("recycler.value", 8)) return; for (int i = 0; i < count; i++) { HabboItem item = this.client.getHabbo().getInventory().getItemsComponent().getHabboItem(this.packet.readInt()); From 774cf85926fc37bc50948d1076e3ff9459a08b85 Mon Sep 17 00:00:00 2001 From: Mikkel Friis Date: Tue, 15 Sep 2020 19:38:31 +0200 Subject: [PATCH 202/215] wired furni selection count fix --- .../WiredConditionFurniHaveFurni.java | 5 +++-- .../WiredConditionFurniHaveHabbo.java | 5 +++-- .../WiredConditionFurniTypeMatch.java | 5 +++-- .../WiredConditionMatchStatePosition.java | 5 +++-- .../WiredConditionNotFurniHaveFurni.java | 8 +++---- .../WiredConditionNotFurniHaveHabbo.java | 8 +++---- .../WiredConditionNotFurniTypeMatch.java | 5 +++-- .../WiredConditionNotMatchStatePosition.java | 8 +++---- .../WiredConditionNotTriggerOnFurni.java | 3 ++- .../WiredConditionTriggerOnFurni.java | 5 +++-- .../wired/effects/WiredEffectBotTeleport.java | 5 +++-- .../effects/WiredEffectBotWalkToFurni.java | 5 +++-- .../WiredEffectChangeFurniDirection.java | 9 +++++--- .../wired/effects/WiredEffectMatchFurni.java | 10 ++++----- .../effects/WiredEffectMoveFurniAway.java | 5 +++-- .../effects/WiredEffectMoveFurniTowards.java | 5 +++-- .../effects/WiredEffectMoveRotateFurni.java | 21 ++++++++++++------- .../wired/effects/WiredEffectTeleport.java | 5 +++-- .../wired/effects/WiredEffectToggleFurni.java | 5 +++-- .../effects/WiredEffectTriggerStacks.java | 5 +++-- 20 files changed, 77 insertions(+), 55 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java index ba2b2bf7..4aa50beb 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java @@ -137,8 +137,6 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition { @Override public boolean saveData(ClientMessage packet) { - this.items.clear(); - int count; packet.readInt(); @@ -147,6 +145,9 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition { packet.readString(); count = packet.readInt(); + if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; + + this.items.clear(); Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java index 304eded6..4895462e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java @@ -154,14 +154,15 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition { @Override public boolean saveData(ClientMessage packet) { - this.items.clear(); - int count; packet.readInt(); packet.readString(); count = packet.readInt(); + if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; + + this.items.clear(); Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java index 06e3cbaa..d2a2f573 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java @@ -104,12 +104,13 @@ public class WiredConditionFurniTypeMatch extends InteractionWiredCondition { @Override public boolean saveData(ClientMessage packet) { - this.items.clear(); - packet.readInt(); packet.readString(); int count = packet.readInt(); + if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; + + this.items.clear(); Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java index 73371bab..27f1ed0e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java @@ -67,8 +67,6 @@ public class WiredConditionMatchStatePosition extends InteractionWiredCondition @Override public boolean saveData(ClientMessage packet) { - this.settings.clear(); - int count; packet.readInt(); @@ -84,6 +82,9 @@ public class WiredConditionMatchStatePosition extends InteractionWiredCondition return true; count = packet.readInt(); + if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; + + this.settings.clear(); for (int i = 0; i < count; i++) { int itemId = packet.readInt(); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java index c64fb8b5..7e666b33 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java @@ -123,16 +123,16 @@ public class WiredConditionNotFurniHaveFurni extends InteractionWiredCondition { @Override public boolean saveData(ClientMessage packet) { - this.items.clear(); - - int count; packet.readInt(); this.all = packet.readInt() == 1; packet.readString(); - count = packet.readInt(); + int count = packet.readInt(); + if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; + + this.items.clear(); Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java index ef61c69c..abc5c559 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java @@ -154,14 +154,14 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition { @Override public boolean saveData(ClientMessage packet) { - this.items.clear(); - - int count; packet.readInt(); packet.readString(); - count = packet.readInt(); + int count = packet.readInt(); + if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; + + this.items.clear(); Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java index 95b5d8e3..754aed77 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java @@ -103,12 +103,13 @@ public class WiredConditionNotFurniTypeMatch extends InteractionWiredCondition { @Override public boolean saveData(ClientMessage packet) { - this.items.clear(); - packet.readInt(); packet.readString(); int count = packet.readInt(); + if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; + + this.items.clear(); Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotMatchStatePosition.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotMatchStatePosition.java index 2f0dc9d4..698cd2c3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotMatchStatePosition.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotMatchStatePosition.java @@ -142,9 +142,6 @@ public class WiredConditionNotMatchStatePosition extends InteractionWiredConditi @Override public boolean saveData(ClientMessage packet) { - this.settings.clear(); - - int count; packet.readInt(); this.state = packet.readInt() == 1; @@ -158,7 +155,10 @@ public class WiredConditionNotMatchStatePosition extends InteractionWiredConditi if (room == null) return true; - count = packet.readInt(); + int count = packet.readInt(); + if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; + + this.settings.clear(); for (int i = 0; i < count; i++) { int itemId = packet.readInt(); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotTriggerOnFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotTriggerOnFurni.java index eb853f9c..65dc97f1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotTriggerOnFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotTriggerOnFurni.java @@ -105,12 +105,13 @@ public class WiredConditionNotTriggerOnFurni extends InteractionWiredCondition { @Override public boolean saveData(ClientMessage packet) { - this.items.clear(); packet.readInt(); packet.readString(); int count = packet.readInt(); + if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; + this.items.clear(); Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java index 5cb27d1c..9d373e56 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java @@ -108,12 +108,13 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition { @Override public boolean saveData(ClientMessage packet) { - this.items.clear(); - packet.readInt(); packet.readString(); int count = packet.readInt(); + if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; + + this.items.clear(); Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java index b88e7877..9fe3e8ef 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java @@ -114,9 +114,10 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect { packet.readInt(); this.botName = packet.readString(); - this.items.clear(); - int count = packet.readInt(); + if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; + + this.items.clear(); for (int i = 0; i < count; i++) { this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt())); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java index 1b0efe08..3b5543b7 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java @@ -68,9 +68,10 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect { packet.readInt(); this.botName = packet.readString(); - this.items.clear(); - int count = packet.readInt(); + if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; + + this.items.clear(); for (int i = 0; i < count; i++) { this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt())); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java index bbb44819..7ac99dae 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java @@ -162,14 +162,17 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect { @Override public boolean saveData(ClientMessage packet, GameClient gameClient) { - this.items.clear(); packet.readInt(); this.startRotation = RoomUserRotation.fromValue(packet.readInt()); this.rotateAction = packet.readInt(); packet.readString(); - int furniCount = packet.readInt(); - for (int i = 0; i < furniCount; i++) { + int count = packet.readInt(); + if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; + + this.items.clear(); + + for (int i = 0; i < count; i++) { HabboItem item = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabboItem(packet.readInt()); if (item != null) { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java index 6b337571..251bc2a5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java @@ -244,11 +244,6 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect { @Override public boolean saveData(ClientMessage packet, GameClient gameClient) { - this.settings.clear(); - - //packet.readInt(); - - int count; packet.readInt(); this.state = packet.readInt() == 1; @@ -262,7 +257,10 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect { if (room == null) return true; - count = packet.readInt(); + int count = packet.readInt(); + if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; + + this.settings.clear(); for (int i = 0; i < count; i++) { int itemId = packet.readInt(); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java index 556e56c3..23414d94 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java @@ -186,9 +186,10 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect { packet.readInt(); packet.readString(); - this.items.clear(); - int count = packet.readInt(); + if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; + + this.items.clear(); for (int i = 0; i < count; i++) { this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt())); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java index 849a59b2..95125c68 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java @@ -304,9 +304,10 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect { packet.readInt(); packet.readString(); - this.items.clear(); - int count = packet.readInt(); + if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; + + this.items.clear(); for (int i = 0; i < count; i++) { this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt())); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java index ae37a0f3..06192a4e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java @@ -17,6 +17,8 @@ import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer; import com.eu.habbo.messages.outgoing.rooms.items.FloorItemUpdateComposer; import gnu.trove.set.hash.THashSet; import org.apache.commons.math3.util.Pair; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.awt.*; import java.sql.ResultSet; @@ -24,6 +26,10 @@ import java.sql.SQLException; import java.util.ArrayList; public class WiredEffectMoveRotateFurni extends InteractionWiredEffect { + + + private static final Logger LOGGER = LoggerFactory.getLogger(WiredEffectMoveRotateFurni.class); + public static final WiredEffectType type = WiredEffectType.MOVE_ROTATE; private final THashSet items = new THashSet<>(WiredHandler.MAXIMUM_FURNI_SELECTION / 2); private int direction; @@ -40,7 +46,7 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect { @Override public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { // remove items that are no longer in the room - this.items.removeIf( item -> Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null); + this.items.removeIf(item -> Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null); THashSet tilesToUpdate = new THashSet<>(Math.min(this.items.size(), 10)); @@ -53,10 +59,9 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect { //Verify if rotation result in a valid position FurnitureMovementError rotateError = room.furnitureFitsAt(room.getLayout().getTile(item.getX(), item.getY()), item, newRotation); if (item.getRotation() != newRotation && (rotateError.equals(FurnitureMovementError.TILE_HAS_HABBOS) || rotateError.equals(FurnitureMovementError.TILE_HAS_PETS) || - rotateError.equals(FurnitureMovementError.TILE_HAS_BOTS) || rotateError.equals(FurnitureMovementError.NONE))) - { + rotateError.equals(FurnitureMovementError.TILE_HAS_BOTS) || rotateError.equals(FurnitureMovementError.NONE))) { item.setRotation(newRotation); - if(this.direction == 0) { + if (this.direction == 0) { tilesToUpdate.addAll(room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation())); room.sendComposer(new FloorItemUpdateComposer(item).compose()); for (RoomTile t : tilesToUpdate) { @@ -135,7 +140,7 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect { } if (validMove) { - if(this.rotation > 0) { + if (this.rotation > 0) { item.setX(newTile.x); item.setY(newTile.y); item.setZ(item.getZ() + offset); @@ -144,8 +149,7 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect { room.updateHabbosAt(t.x, t.y); room.updateBotsAt(t.x, t.y); } - } - else { + } else { room.sendComposer(new FloorItemOnRollerComposer(item, null, newTile, offset, room).compose()); } } @@ -268,6 +272,7 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect { packet.readString(); int count = packet.readInt(); + if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count", 5)) return false; this.items.clear(); for (int i = 0; i < count; i++) { @@ -282,6 +287,7 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect { /** * Returns a new rotation for an item based on the wired options + * * @param item * @return new rotation */ @@ -306,6 +312,7 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect { /** * Returns the direction of movement based on the wired settings + * * @return direction */ private RoomUserRotation getMovementDirection() { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java index ebd7254a..652f3780 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java @@ -131,9 +131,10 @@ public class WiredEffectTeleport extends InteractionWiredEffect { packet.readInt(); packet.readString(); - this.items.clear(); - int count = packet.readInt(); + if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; + + this.items.clear(); for (int i = 0; i < count; i++) { this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt())); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java index e602c042..d3025363 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java @@ -96,9 +96,10 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect { packet.readInt(); packet.readString(); - this.items.clear(); - int count = packet.readInt(); + if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; + + this.items.clear(); for (int i = 0; i < count; i++) { HabboItem item = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java index 41a38dd8..d58b6a84 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java @@ -87,9 +87,10 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect { packet.readInt(); packet.readString(); - this.items.clear(); - int count = packet.readInt(); + if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; + + this.items.clear(); for (int i = 0; i < count; i++) { this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt())); From 407bdb44405348c442318d03d4d23024c48d8e78 Mon Sep 17 00:00:00 2001 From: Mikkel Friis Date: Thu, 17 Sep 2020 07:35:00 +0200 Subject: [PATCH 203/215] Talking furni fix #779 This fixes issue #779 --- src/main/java/com/eu/habbo/habbohotel/rooms/Room.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 9a0803fb..6509ae33 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -3244,10 +3244,18 @@ public class Room implements Comparable, ISerialize, Runnable { RoomChatMessage itemMessage = new RoomChatMessage(Emulator.getTexts().getValue(item.getBaseItem().getName() + ".message." + randomValue, item.getBaseItem().getName() + ".message." + randomValue + " not found!"), habbo, RoomChatMessageBubbles.getBubble(Emulator.getConfig().getInt(item.getBaseItem().getName() + ".message.bubble", RoomChatMessageBubbles.PARROT.getType()))); - this.sendComposer(new RoomUserShoutComposer(itemMessage).compose()); + this.sendComposer(new RoomUserTalkComposer(itemMessage).compose()); try { item.onClick(habbo.getClient(), this, new Object[0]); + item.setExtradata("1"); + updateItemState(item); + + Emulator.getThreading().run(() -> { + item.setExtradata("0"); + updateItemState(item); + }, 2000); + break; } catch (Exception e) { LOGGER.error("Caught exception", e); From 0d8819399458758d3c71596eae5d592bf8b2a042 Mon Sep 17 00:00:00 2001 From: Mikkel Friis Date: Thu, 17 Sep 2020 08:11:06 +0200 Subject: [PATCH 204/215] message overflow fix #741 this fixes #741 --- .../items/interactions/wired/effects/WiredEffectBotTalk.java | 2 ++ .../interactions/wired/effects/WiredEffectBotTalkToHabbo.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java index e73978a0..8297cde1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java @@ -57,6 +57,8 @@ public class WiredEffectBotTalk extends InteractionWiredEffect { if (data.length == 2) { this.botName = data[0]; + + if (data[1].length() > 64) return false; this.message = data[1]; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java index aec24c88..97badb10 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java @@ -77,6 +77,8 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect { if (data.length == 2) { this.botName = data[0]; + + if (data[1].length() > 64) return false; this.message = data[1]; } From 7cba83e60a00b8653d8c7c62c8f542b74f88d56c Mon Sep 17 00:00:00 2001 From: Mikkel Friis Date: Thu, 17 Sep 2020 08:24:58 +0200 Subject: [PATCH 205/215] force walks on furni on one way gate #784 this fixes #784 --- .../items/interactions/InteractionOneWayGate.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionOneWayGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionOneWayGate.java index 844b042e..01257bea 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionOneWayGate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionOneWayGate.java @@ -7,9 +7,14 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.users.HabboItem; +import com.eu.habbo.habbohotel.wired.WiredHandler; +import com.eu.habbo.habbohotel.wired.WiredTriggerType; import com.eu.habbo.messages.ServerMessage; +import com.eu.habbo.messages.incoming.rooms.users.RoomUserWalkEvent; import com.eu.habbo.messages.outgoing.rooms.items.ItemIntStateComposer; import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.ResultSet; import java.sql.SQLException; @@ -17,6 +22,8 @@ import java.util.ArrayList; import java.util.List; public class InteractionOneWayGate extends HabboItem { + private static final Logger LOGGER = LoggerFactory.getLogger(InteractionOneWayGate.class); + private boolean walkable = false; public InteractionOneWayGate(ResultSet set, Item baseItem) throws SQLException { @@ -86,6 +93,8 @@ public class InteractionOneWayGate extends HabboItem { RoomTile tile = room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), this.getRotation() + 4); unit.setGoalLocation(tile); Emulator.getThreading().run(new RoomUnitWalkToLocation(unit, tile, room, onFail, onFail)); + + Emulator.getThreading().run(() -> WiredHandler.handle(WiredTriggerType.WALKS_ON_FURNI, unit, room, new Object[]{this}), 500); }); onFail.add(() -> { From c2dabbd0edbe938b853afcf8eb624f629ca70f1b Mon Sep 17 00:00:00 2001 From: Mikkel Friis Date: Thu, 17 Sep 2020 08:33:19 +0200 Subject: [PATCH 206/215] "Follow" does not disappear #780 this fixes #780 --- src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java index 250dee09..d5f7b6fa 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java @@ -938,6 +938,8 @@ public class RoomManager { if (room.getOwnerId() != habbo.getHabboInfo().getId()) { AchievementManager.progressAchievement(room.getOwnerId(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoHosting"), (int) Math.floor((Emulator.getIntUnixTimestamp() - habbo.getHabboStats().roomEnterTimestamp) / 60000)); } + + habbo.getMessenger().connectionChanged(habbo, habbo.isOnline(), false); } } From 8cbe5129acf3b38bb1f650046c497922ef9f86db Mon Sep 17 00:00:00 2001 From: Ilany Date: Fri, 18 Sep 2020 13:35:25 +0200 Subject: [PATCH 207/215] Fixed gate bug --- .../habbohotel/items/interactions/InteractionGate.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java index 5c0b3422..a6452849 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.wired.WiredEffectType; @@ -42,8 +43,12 @@ public class InteractionGate extends HabboItem { if (client != null && !room.hasRights(client.getHabbo()) && !isWired) return; - if (!isWired && !room.getHabbosAt(this.getX(), this.getY()).isEmpty()) - return; + // If a Habbo is standing on a tile occupied by the gate, the gate shouldn't be triggered + if (!isWired) { + for (RoomTile tile : room.getLayout().getTilesAt(room.getLayout().getTile(this.getX(), this.getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation())) + if (room.hasHabbosAt(tile.x, tile.y)) + return; + } if (this.getExtradata().length() == 0) this.setExtradata("0"); From 0a09ff1f41a6685d6a2b602067cd78399e7220ef Mon Sep 17 00:00:00 2001 From: Ilany Date: Fri, 18 Sep 2020 14:24:42 +0200 Subject: [PATCH 208/215] Added comments --- .../habbo/habbohotel/items/interactions/InteractionGate.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java index a6452849..5202f041 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java @@ -43,17 +43,18 @@ public class InteractionGate extends HabboItem { if (client != null && !room.hasRights(client.getHabbo()) && !isWired) return; - // If a Habbo is standing on a tile occupied by the gate, the gate shouldn't be triggered + // If a Habbo is standing on a tile occupied by the gate, the gate shouldn't open/close if (!isWired) { for (RoomTile tile : room.getLayout().getTilesAt(room.getLayout().getTile(this.getX(), this.getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation())) if (room.hasHabbosAt(tile.x, tile.y)) return; } + // Gate closed = 0, open = 1 if (this.getExtradata().length() == 0) this.setExtradata("0"); - this.setExtradata((Integer.valueOf(this.getExtradata()) + 1) % 2 + ""); + this.setExtradata((Integer.parseInt(this.getExtradata()) + 1) % 2 + ""); room.updateTile(room.getLayout().getTile(this.getX(), this.getY())); this.needsUpdate(true); room.updateItemState(this); From 986a3b323c042e95d1e126e132aeff0dd00e895d Mon Sep 17 00:00:00 2001 From: Ilany Date: Fri, 18 Sep 2020 15:04:57 +0200 Subject: [PATCH 209/215] Wired cannot trigger door when a Habbo is on it --- .../items/interactions/InteractionGate.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java index 5202f041..f7ceb0e3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java @@ -39,16 +39,15 @@ public class InteractionGate extends HabboItem { @Override public void onClick(GameClient client, Room room, Object[] objects) throws Exception { - boolean isWired = (objects.length >= 2 && objects[1] instanceof WiredEffectType && objects[1] == WiredEffectType.TOGGLE_STATE); - if (client != null && !room.hasRights(client.getHabbo()) && !isWired) + boolean executedByWired = (objects.length >= 2 && objects[1] instanceof WiredEffectType && objects[1] == WiredEffectType.TOGGLE_STATE); + + if (client != null && !room.hasRights(client.getHabbo()) && !executedByWired) return; // If a Habbo is standing on a tile occupied by the gate, the gate shouldn't open/close - if (!isWired) { - for (RoomTile tile : room.getLayout().getTilesAt(room.getLayout().getTile(this.getX(), this.getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation())) - if (room.hasHabbosAt(tile.x, tile.y)) - return; - } + for (RoomTile tile : room.getLayout().getTilesAt(room.getLayout().getTile(this.getX(), this.getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation())) + if (room.hasHabbosAt(tile.x, tile.y)) + return; // Gate closed = 0, open = 1 if (this.getExtradata().length() == 0) From 1bd21c490f14efe36bf48171ac27794d65d794c7 Mon Sep 17 00:00:00 2001 From: Mikkel Friis Date: Sat, 19 Sep 2020 01:44:45 +0200 Subject: [PATCH 210/215] stop dancing if respecting this fixes #787 --- src/main/java/com/eu/habbo/habbohotel/users/Habbo.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java b/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java index af87ae9d..923aeebe 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java @@ -240,7 +240,8 @@ public class Habbo implements Runnable { return; this.getHabboInfo().addCurrencyAmount(event.type, event.points); - if (this.client != null) this.client.sendResponse(new UserPointsComposer(this.client.getHabbo().getHabboInfo().getCurrencyAmount(type), event.points, event.type)); + if (this.client != null) + this.client.sendResponse(new UserPointsComposer(this.client.getHabbo().getHabboInfo().getCurrencyAmount(type), event.points, event.type)); } @@ -436,9 +437,7 @@ public class Habbo implements Runnable { public void respect(Habbo target) { - if (target != null && target != this.client.getHabbo()) - - { + if (target != null && target != this.client.getHabbo()) { target.getHabboStats().respectPointsReceived++; this.client.getHabbo().getHabboStats().respectPointsGiven++; this.client.getHabbo().getHabboStats().respectPointsToGive--; @@ -449,6 +448,7 @@ public class Habbo implements Runnable { AchievementManager.progressAchievement(target, Emulator.getGameEnvironment().getAchievementManager().getAchievement("RespectEarned")); this.client.getHabbo().getHabboInfo().getCurrentRoom().unIdle(this.client.getHabbo()); + this.client.getHabbo().getHabboInfo().getCurrentRoom().dance(this.client.getHabbo().getRoomUnit(), DanceType.NONE); } } From a0072a407f00a4c75cb59b8872c65f007d875f87 Mon Sep 17 00:00:00 2001 From: Mikkel Friis Date: Sat, 19 Sep 2020 01:56:00 +0200 Subject: [PATCH 211/215] check rights if room is invisible this fixes #788 --- src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java index d5f7b6fa..d530de77 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java @@ -527,10 +527,10 @@ public class RoomManager { if (overrideChecks || room.isOwner(habbo) || room.getState() == RoomState.OPEN || - room.getState() == RoomState.INVISIBLE || habbo.hasPermission(Permission.ACC_ANYROOMOWNER) || habbo.hasPermission(Permission.ACC_ENTERANYROOM) || room.hasRights(habbo) || + (room.getState().equals(RoomState.INVISIBLE) && room.hasRights(habbo)) || (room.hasGuild() && room.guildRightLevel(habbo) > 2)) { this.openRoom(habbo, room, doorLocation); } else if (room.getState() == RoomState.LOCKED) { @@ -563,6 +563,9 @@ public class RoomManager { habbo.getClient().sendResponse(new HotelViewComposer()); habbo.getHabboInfo().setLoadingRoom(0); } + } else { + habbo.getClient().sendResponse(new HotelViewComposer()); + habbo.getHabboInfo().setLoadingRoom(0); } } From 4a334fb563693594317bd38b276e682918a135e7 Mon Sep 17 00:00:00 2001 From: Ilany Date: Mon, 21 Sep 2020 15:41:51 +0200 Subject: [PATCH 212/215] Fixed vendingmachines NPE --- .../items/interactions/InteractionVendingMachine.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java index 4fdd0eb1..ca0175a2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java @@ -34,8 +34,12 @@ public class InteractionVendingMachine extends HabboItem { } public THashSet getActivatorTiles(Room room) { - THashSet tiles = new THashSet(); - tiles.add(getSquareInFront(room.getLayout(), this)); + THashSet tiles = new THashSet<>(); + RoomTile tileInFront = getSquareInFront(room.getLayout(), this); + + if (tileInFront != null) + tiles.add(tileInFront); + tiles.add(room.getLayout().getTile(this.getX(), this.getY())); return tiles; } From 947d7a4ce7775e2c7f2b35a1bad417ededfa90bb Mon Sep 17 00:00:00 2001 From: Mikkel Friis Date: Tue, 22 Sep 2020 04:31:38 +0200 Subject: [PATCH 213/215] cleaned up wordfilter --- .../habbo/habbohotel/modtool/WordFilter.java | 27 +++++-------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java b/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java index 791d12d5..07cbadab 100644 --- a/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java +++ b/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java @@ -138,29 +138,14 @@ public class WordFilter { filteredMessage = this.normalise(filteredMessage); } - TObjectHashIterator iterator = this.words.iterator(); - - boolean foundShit = false; - - while (iterator.hasNext()) { - WordFilterWord word = (WordFilterWord) iterator.next(); - - if (StringUtils.containsIgnoreCase(filteredMessage, word.key)) { - if (habbo != null) { - if (Emulator.getPluginManager().fireEvent(new UserTriggerWordFilterEvent(habbo, word)).isCancelled()) - continue; - } - filteredMessage = filteredMessage.replace("(?i)" + word.key, word.replacement); - foundShit = true; - - if (habbo != null && word.muteTime > 0) { - habbo.mute(word.muteTime, false); - } + for (WordFilterWord word : this.words) { + if (!StringUtils.containsIgnoreCase(filteredMessage, word.key)) continue; + if (habbo != null) { + if (Emulator.getPluginManager().fireEvent(new UserTriggerWordFilterEvent(habbo, word)).isCancelled()) + continue; } - } - if (!foundShit) { - return message; + filteredMessage = filteredMessage.replaceAll("(?i)" + Pattern.quote(word.key), word.replacement); } return filteredMessage; From b64e837535fb3e86a190a23c48f7479b860b805c Mon Sep 17 00:00:00 2001 From: Kitt Mustang Date: Wed, 23 Sep 2020 08:52:51 -0400 Subject: [PATCH 214/215] The sphere now flashes blue when the timer starts --- .../games/battlebanzai/BattleBanzaiGame.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java b/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java index 31a561b5..07b83048 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java @@ -44,6 +44,7 @@ public class BattleBanzaiGame extends Game { private final THashMap gameTiles; private int tileCount; private int countDown; + private int countDown2; public BattleBanzaiGame(Room room) { super(BattleBanzaiGameTeam.class, BattleBanzaiGamePlayer.class, room, true); @@ -58,8 +59,12 @@ public class BattleBanzaiGame extends Game { public void initialise() { if (!this.state.equals(GameState.IDLE)) return; - + + /* The first countdown is activated for the first two seconds emitting only the blue light (second interaction), + the second, after another two seconds, completely activates the sphere (third interaction). + */ this.countDown = 3; + this.countDown2 = 2; this.resetMap(); @@ -105,8 +110,15 @@ public class BattleBanzaiGame extends Game { if (this.countDown == 0) { for (HabboItem item : this.room.getRoomSpecialTypes().getItemsOfType(InteractionBattleBanzaiSphere.class)) { - item.setExtradata("2"); + item.setExtradata("1"); this.room.updateItemState(item); + if(this.countDown2 > 0) { + this.countDown2--; + if(this.countDown2 == 0) { + item.setExtradata("2"); + this.room.updateItemState(item); + } + } } } From c6ea16fe7db3d843a555d4440e1a8450daff43f9 Mon Sep 17 00:00:00 2001 From: Mikkel Friis Date: Fri, 25 Sep 2020 04:41:16 +0200 Subject: [PATCH 215/215] mannequin fix for jackets --- .../interactions/InteractionMannequin.java | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMannequin.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMannequin.java index 2901a7b9..cc291a67 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMannequin.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMannequin.java @@ -60,26 +60,30 @@ public class InteractionMannequin extends HabboItem { @Override public void onClick(GameClient client, Room room, Object[] objects) throws Exception { - String[] lookCode = this.getExtradata().split(":")[1].split("\\."); + String lookCode = this.getExtradata().split(":")[1]; + String newFigure = ""; - StringBuilder look = new StringBuilder(); - for (String part : client.getHabbo().getHabboInfo().getLook().split("\\.")) { - String type = part.split("-")[0]; - - boolean found = false; - for (String s : lookCode) { - if (s.contains(type)) { - found = true; - look.append(s).append("."); - } - } - - if (!found) { - look.append(part).append("."); - } + for (String playerFigurePart : client.getHabbo().getHabboInfo().getLook().split("\\.")) { + if (!playerFigurePart.startsWith("ch") && !playerFigurePart.startsWith("lg")) + newFigure += playerFigurePart + "."; } - client.getHabbo().getHabboInfo().setLook(look.substring(0, look.length() - 1)); + if (lookCode.isEmpty()) return; + String newFigureParts = lookCode; + + for (String newFigurePart : newFigureParts.split("\\.")) { + if (newFigurePart.startsWith("hd")) + newFigureParts = newFigureParts.replace(newFigurePart, ""); + } + + if (newFigureParts.equals("")) return; + + final String figure = newFigure + newFigureParts; + + if (figure.length() > 512) + return; + + client.getHabbo().getHabboInfo().setLook(figure); room.sendComposer(new RoomUserDataComposer(client.getHabbo()).compose()); client.sendResponse(new UserDataComposer(client.getHabbo())); }