From 34e7239ac40473d73895d634a23e2f8423c452af Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Wed, 3 Jun 2020 02:30:32 +0200 Subject: [PATCH] Fixes #610 - negative flood time --- .../com/eu/habbo/habbohotel/rooms/RoomChatMessage.java | 7 ++++++- src/main/java/com/eu/habbo/habbohotel/users/Habbo.java | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java index 0063a0d5..22a8b662 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java @@ -216,7 +216,12 @@ public class RoomChatMessage implements Runnable, ISerialize, DatabaseLoggable { return; } } 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 = ""; diff --git a/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java b/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java index 242bdd02..af87ae9d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java @@ -384,6 +384,11 @@ public class Habbo implements Runnable { } 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")) { int remaining = this.habboStats.addMuteTime(seconds); this.client.sendResponse(new FloodCounterComposer(remaining));