From 5e586d1093c8f7fa2e46c1b1253fe8c986a3e815 Mon Sep 17 00:00:00 2001 From: duckietm Date: Tue, 7 Apr 2026 09:20:15 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=86=99=20Fix=20in=20habbomanager?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The getCloneAccounts query had an operator-precedence bug: WHERE ip_register = ? OR ip_current = ? AND id != ? -- parsed as: WHERE ip_register = ? OR (ip_current = ? AND id != ?) So a user whose ip_register matched themselves would show up in their own clone list. Added parentheses: WHERE (ip_register = ? OR ip_current = ?) AND id != ? So please run the 006_HabboManager_fix before you run the update Emulator ! --- Database Updates/006_HabboManager_fix.sql | 35 +++++++++++++++++++ .../habbo/habbohotel/users/HabboManager.java | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 Database Updates/006_HabboManager_fix.sql diff --git a/Database Updates/006_HabboManager_fix.sql b/Database Updates/006_HabboManager_fix.sql new file mode 100644 index 00000000..d28a7b3d --- /dev/null +++ b/Database Updates/006_HabboManager_fix.sql @@ -0,0 +1,35 @@ +ALTER TABLE `users` + DROP KEY IF EXISTS `auth_ticket`, + MODIFY `auth_ticket` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + ADD KEY IF NOT EXISTS `idx_users_auth_ticket` (`auth_ticket`); + + ADD KEY IF NOT EXISTS `idx_rel_user_room` (`user_id`, `room_id`); + +ALTER TABLE `logs_hc_payday` + ADD KEY IF NOT EXISTS `idx_lhcp_user_claimed` (`user_id`, `claimed`); + +ALTER TABLE `room_votes` + DROP KEY IF EXISTS `user_id`, + ADD UNIQUE KEY IF NOT EXISTS `uniq_room_votes_user_room` (`user_id`, `room_id`); + +ALTER TABLE `room_game_scores` + ADD KEY IF NOT EXISTS `idx_rgs_room_ts` (`room_id`, `game_start_timestamp`), + ADD KEY IF NOT EXISTS `idx_rgs_user` (`user_id`); + +ALTER TABLE `calendar_rewards_claimed` + DROP KEY IF EXISTS `idx_cal_claimed_user_id`, + ADD UNIQUE KEY IF NOT EXISTS `uniq_crc_user_campaign_reward` (`user_id`, `campaign_id`, `reward_id`); + +ALTER TABLE `emulator_settings` + ENGINE = InnoDB, + CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +ALTER TABLE `gift_wrappers` ENGINE = InnoDB; +ALTER TABLE `pet_actions` ENGINE = InnoDB; +ALTER TABLE `pet_commands_data` ENGINE = InnoDB; + +ALTER TABLE `calendar_rewards` + MODIFY `product_name` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + MODIFY `custom_image` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + MODIFY `badge` VARCHAR(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + MODIFY `subscription_type` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT ''; diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java index 1ed19667..8fc6aeb6 100644 --- a/Emulator/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java +++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java @@ -198,7 +198,7 @@ public class HabboManager { public ArrayList getCloneAccounts(Habbo habbo, int limit) { ArrayList habboInfo = new ArrayList<>(); - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM users WHERE ip_register = ? OR ip_current = ? AND id != ? ORDER BY id DESC LIMIT ?")) { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM users WHERE (ip_register = ? OR ip_current = ?) AND id != ? ORDER BY id DESC LIMIT ?")) { statement.setString(1, habbo.getHabboInfo().getIpRegister()); statement.setString(2, habbo.getHabboInfo().getIpLogin()); statement.setInt(3, habbo.getHabboInfo().getId());