From 462592f2171b231c172bf00abd300499e3c67df9 Mon Sep 17 00:00:00 2001 From: Swirny <140-Swirny@users.noreply.git.krews.org> Date: Sat, 16 May 2020 05:22:22 -0400 Subject: [PATCH 1/3] Fixed flood with rights --- .../com/eu/habbo/habbohotel/rooms/Room.java | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 483744f3..dc3af8b5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -1202,15 +1202,26 @@ public class Room implements Comparable, ISerialize, Runnable { { habbo.getHabboStats().chatCounter--; - if (habbo.getHabboStats().chatCounter > 3 && !this.hasRights(habbo)) { - if (this.chatProtection == 0) { - this.floodMuteHabbo(habbo, 30); - } else if (this.chatProtection == 1 && habbo.getHabboStats().chatCounter > 4) { - this.floodMuteHabbo(habbo, 30); - } else if (this.chatProtection == 2 && habbo.getHabboStats().chatCounter > 5) { - this.floodMuteHabbo(habbo, 30); + if (Emulator.getConfig().getBoolean("flood.with.rights")) { + if (habbo.getHabboStats().chatCounter > 3 && !this.hasRights(habbo)) { + if (this.chatProtection == 0) { + this.floodMuteHabbo(habbo, 30); + } else if (this.chatProtection == 1 && habbo.getHabboStats().chatCounter > 4) { + this.floodMuteHabbo(habbo, 30); + } else if (this.chatProtection == 2 && habbo.getHabboStats().chatCounter > 5) { + this.floodMuteHabbo(habbo, 30); + } } } + else if (habbo.getHabboStats().chatCounter > 3 && this.hasRights(habbo)) { + if (this.chatProtection == 0) { + this.floodMuteHabbo(habbo, 30); + } else if (this.chatProtection == 1 && habbo.getHabboStats().chatCounter > 4) { + this.floodMuteHabbo(habbo, 30); + } else if (this.chatProtection == 2 && habbo.getHabboStats().chatCounter > 5) { + this.floodMuteHabbo(habbo, 30); + } + } } else { habbo.getHabboStats().chatCounter = 0; From caf0bcb41f5669a8f76900d0997502ad83f76a39 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Wed, 3 Jun 2020 02:53:10 +0200 Subject: [PATCH 2/3] Add SQL and fix code --- sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql | 1 - sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql | 3 +++ .../java/com/eu/habbo/habbohotel/rooms/Room.java | 15 ++++++++------- 3 files changed, 11 insertions(+), 8 deletions(-) delete mode 100644 sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql create mode 100644 sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql 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 deleted file mode 100644 index c323751f..00000000 --- a/sqlupdates/2_4_0 RC-1 to 2_4_0 RC-2.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `permissions` ADD `acc_hide_mail` ENUM('0', '1') NOT NULL DEFAULT '0' AFTER `acc_hide_ip`; \ No newline at end of file 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 new file mode 100644 index 00000000..cb3bef84 --- /dev/null +++ b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql @@ -0,0 +1,3 @@ +ALTER TABLE `permissions` ADD `acc_hide_mail` ENUM('0', '1') NOT NULL DEFAULT '0' AFTER `acc_hide_ip`; + +INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('flood.with.rights', '0'); \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index dc3af8b5..e752e85e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -1214,13 +1214,14 @@ public class Room implements Comparable, ISerialize, Runnable { } } else if (habbo.getHabboStats().chatCounter > 3 && this.hasRights(habbo)) { - if (this.chatProtection == 0) { - this.floodMuteHabbo(habbo, 30); - } else if (this.chatProtection == 1 && habbo.getHabboStats().chatCounter > 4) { - this.floodMuteHabbo(habbo, 30); - } else if (this.chatProtection == 2 && habbo.getHabboStats().chatCounter > 5) { - this.floodMuteHabbo(habbo, 30); - } + if (this.chatProtection == 0) { + this.floodMuteHabbo(habbo, 30); + } else if (this.chatProtection == 1 && habbo.getHabboStats().chatCounter > 4) { + this.floodMuteHabbo(habbo, 30); + } else if (this.chatProtection == 2 && habbo.getHabboStats().chatCounter > 5) { + this.floodMuteHabbo(habbo, 30); + } + } } } else { From dd98c3072a08704c0156c1eeacd7dcca29771380 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Wed, 3 Jun 2020 03:04:05 +0200 Subject: [PATCH 3/3] Remove duplicate code, simplify logic --- .../com/eu/habbo/habbohotel/rooms/Room.java | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index e752e85e..10484daf 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -1202,8 +1202,11 @@ public class Room implements Comparable, ISerialize, Runnable { { habbo.getHabboStats().chatCounter--; - if (Emulator.getConfig().getBoolean("flood.with.rights")) { - if (habbo.getHabboStats().chatCounter > 3 && !this.hasRights(habbo)) { + if (habbo.getHabboStats().chatCounter > 3) { + final boolean floodRights = Emulator.getConfig().getBoolean("flood.with.rights"); + final boolean hasRights = this.hasRights(habbo); + + if (floodRights || !hasRights) { if (this.chatProtection == 0) { this.floodMuteHabbo(habbo, 30); } else if (this.chatProtection == 1 && habbo.getHabboStats().chatCounter > 4) { @@ -1213,16 +1216,6 @@ public class Room implements Comparable, ISerialize, Runnable { } } } - else if (habbo.getHabboStats().chatCounter > 3 && this.hasRights(habbo)) { - if (this.chatProtection == 0) { - this.floodMuteHabbo(habbo, 30); - } else if (this.chatProtection == 1 && habbo.getHabboStats().chatCounter > 4) { - this.floodMuteHabbo(habbo, 30); - } else if (this.chatProtection == 2 && habbo.getHabboStats().chatCounter > 5) { - this.floodMuteHabbo(habbo, 30); - } - } - } } else { habbo.getHabboStats().chatCounter = 0;