Made ignore staff optional, active by default

This commit is contained in:
Swirny 2020-05-25 18:49:42 +02:00 committed by Mike
parent 60a63e4832
commit b638e04737

View File

@ -605,10 +605,10 @@ public class HabboStats implements Runnable {
public void ignoreUser(GameClient gameClient, int userId) { public void ignoreUser(GameClient gameClient, int userId) {
Habbo target = Emulator.getGameEnvironment().getHabboManager().getHabbo(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()) { if (target.getHabboInfo().getRank().getId() >= gameClient.getHabbo().getHabboInfo().getRank().getId()) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("generic.error.higher_rank"), RoomChatMessageBubbles.ALERT); gameClient.getHabbo().whisper(Emulator.getTexts().getValue("generic.error.higher_rank"), RoomChatMessageBubbles.ALERT);
} } else {
else {
if (!this.userIgnored(userId)) { if (!this.userIgnored(userId)) {
this.ignoredUsers.add(userId); this.ignoredUsers.add(userId);
@ -623,6 +623,20 @@ public class HabboStats implements Runnable {
} }
} }
} }
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);
}
}
}
public void unignoreUser(int userId) { public void unignoreUser(int userId) {
if (this.userIgnored(userId)) { if (this.userIgnored(userId)) {