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); + } } } }