Merge branch '301-flood' into 'dev'

fix(flooding): do not show mute icon if mute is due to flooding

See merge request morningstar/Arcturus-Community!81
This commit is contained in:
Harmonic 2020-01-22 15:05:16 -05:00
commit d799550128
10 changed files with 11 additions and 11 deletions

View File

@ -43,7 +43,7 @@ public class MuteCommand extends Command {
} }
} }
habbo.mute(duration); habbo.mute(duration, false);
if (habbo.getHabboInfo().getCurrentRoom() != null) { if (habbo.getHabboInfo().getCurrentRoom() != null) {
habbo.getHabboInfo().getCurrentRoom().sendComposer(new RoomUserIgnoredComposer(habbo, RoomUserIgnoredComposer.MUTED).compose()); //: RoomUserIgnoredComposer.UNIGNORED habbo.getHabboInfo().getCurrentRoom().sendComposer(new RoomUserIgnoredComposer(habbo, RoomUserIgnoredComposer.MUTED).compose()); //: RoomUserIgnoredComposer.UNIGNORED

View File

@ -158,7 +158,7 @@ public class ModToolSanctions {
switch (sanctionLevelItem.sanctionType) { switch (sanctionLevelItem.sanctionType) {
case "ALERT": habbo.alert(reason); break; case "ALERT": habbo.alert(reason); break;
case "BAN": Emulator.getGameEnvironment().getModToolManager().ban(habboId, self, reason, sanctionLevelItem.sanctionHourLength, ModToolBanType.ACCOUNT, cfhTopic); break; case "BAN": Emulator.getGameEnvironment().getModToolManager().ban(habboId, self, reason, sanctionLevelItem.sanctionHourLength, ModToolBanType.ACCOUNT, cfhTopic); break;
case "MUTE": habbo.mute(muteDurationSeconds == 0 ? 3600 : muteDurationSeconds); break; case "MUTE": habbo.mute(muteDurationSeconds == 0 ? 3600 : muteDurationSeconds, false); break;
default: break; default: break;
} }
} }

View File

@ -150,7 +150,7 @@ public class WordFilter {
foundShit = true; foundShit = true;
if (habbo != null && word.muteTime > 0) { if (habbo != null && word.muteTime > 0) {
habbo.mute(word.muteTime); habbo.mute(word.muteTime, false);
} }
} }
} }

View File

@ -2971,7 +2971,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
habbo.getHabboStats().mutedCount++; habbo.getHabboStats().mutedCount++;
timeOut += (timeOut * (int) Math.ceil(Math.pow(habbo.getHabboStats().mutedCount, 2))); timeOut += (timeOut * (int) Math.ceil(Math.pow(habbo.getHabboStats().mutedCount, 2)));
habbo.getHabboStats().chatCounter = 0; habbo.getHabboStats().chatCounter = 0;
habbo.mute(timeOut); habbo.mute(timeOut, true);
} }
public void talk(Habbo habbo, RoomChatMessage roomChatMessage, RoomChatType chatType) { public void talk(Habbo habbo, RoomChatMessage roomChatMessage, RoomChatType chatType) {

View File

@ -210,7 +210,7 @@ public class RoomChatMessage implements Runnable, ISerialize, Loggable {
return; return;
} }
} else { } else {
this.habbo.mute(Emulator.getConfig().getInt("hotel.wordfilter.automute")); this.habbo.mute(Emulator.getConfig().getInt("hotel.wordfilter.automute"), false);
} }
this.message = ""; this.message = "";

View File

@ -378,14 +378,14 @@ public class Habbo implements Runnable {
} }
} }
public void mute(int seconds) { public void mute(int seconds, boolean isFlood) {
if (!this.hasPermission("acc_no_mute")) { if (!this.hasPermission("acc_no_mute")) {
int remaining = this.habboStats.addMuteTime(seconds); int remaining = this.habboStats.addMuteTime(seconds);
this.client.sendResponse(new FloodCounterComposer(remaining)); this.client.sendResponse(new FloodCounterComposer(remaining));
this.client.sendResponse(new MutedWhisperComposer(remaining)); this.client.sendResponse(new MutedWhisperComposer(remaining));
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom(); Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();
if (room != null) { if (room != null && !isFlood) {
room.sendComposer(new RoomUserIgnoredComposer(this, RoomUserIgnoredComposer.MUTED).compose()); room.sendComposer(new RoomUserIgnoredComposer(this, RoomUserIgnoredComposer.MUTED).compose());
} }
} }

View File

@ -169,7 +169,7 @@ public class SecureLoginEvent extends MessageHandler {
} else if (item.isMuted && item.muteDuration > Emulator.getIntUnixTimestamp()) { } else if (item.isMuted && item.muteDuration > Emulator.getIntUnixTimestamp()) {
Date muteDuration = new Date((long) item.muteDuration * 1000); Date muteDuration = new Date((long) item.muteDuration * 1000);
long diff = muteDuration.getTime() - Emulator.getDate().getTime(); long diff = muteDuration.getTime() - Emulator.getDate().getTime();
habbo.mute(Math.toIntExact(diff)); habbo.mute(Math.toIntExact(diff), false);
} }
} }
} }

View File

@ -30,7 +30,7 @@ public class ModToolIssueDefaultSanctionEvent extends MessageHandler {
} else if (defaultSanction.muteLength > 0) { } else if (defaultSanction.muteLength > 0) {
if (target != null) { if (target != null) {
target.mute(defaultSanction.muteLength * 86400); target.mute(defaultSanction.muteLength * 86400, false);
} }
} }
} }

View File

@ -47,7 +47,7 @@ public class ModToolSanctionMuteEvent extends MessageHandler {
modToolSanctions.run(userId, this.client.getHabbo(), 0, cfhTopic, message, 0, false, 0); modToolSanctions.run(userId, this.client.getHabbo(), 0, cfhTopic, message, 0, false, 0);
} }
} else { } else {
habbo.mute(60 * 60); habbo.mute(60 * 60, false);
habbo.alert(message); habbo.alert(message);
this.client.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_mute.muted").replace("%user%", habbo.getHabboInfo().getUsername())); this.client.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_mute.muted").replace("%user%", habbo.getHabboInfo().getUsername()));
} }

View File

@ -21,7 +21,7 @@ public class MuteUser extends RCONMessage<MuteUser.JSON> {
if (json.duration == 0) { if (json.duration == 0) {
habbo.unMute(); habbo.unMute();
} else { } else {
habbo.mute(json.duration); habbo.mute(json.duration, false);
} }
} else { } else {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET mute_end_timestamp = ? WHERE user_id = ? LIMIT 1")) { try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET mute_end_timestamp = ? WHERE user_id = ? LIMIT 1")) {