Fixes #610 - negative flood time

This commit is contained in:
Mike 2020-06-03 02:30:32 +02:00
parent c0249a39ff
commit 34e7239ac4
2 changed files with 11 additions and 1 deletions

View File

@ -216,7 +216,12 @@ public class RoomChatMessage implements Runnable, ISerialize, DatabaseLoggable {
return; return;
} }
} else { } 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 = ""; this.message = "";

View File

@ -384,6 +384,11 @@ public class Habbo implements Runnable {
} }
public void mute(int seconds, boolean isFlood) { 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")) { 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));