Config to Whitelist IPs

This commit is contained in:
LinsaFTW 2023-01-15 10:53:10 -03:00
parent e1f9da41ce
commit a62af547b8
2 changed files with 16 additions and 10 deletions

View File

@ -1,4 +1,4 @@
From c8088b0ac08cde56846bb6aa11a841c2f6c99a91 Mon Sep 17 00:00:00 2001
From 9467398af7f325e2d0188efa4981b2240c70a507 Mon Sep 17 00:00:00 2001
From: LinsaFTW <25271111+linsaftw@users.noreply.github.com>
Date: Fri, 4 Mar 2022 13:35:53 -0300
Subject: [PATCH] Antibot System
@ -129,7 +129,7 @@ index 000000000..5e7fa6bfb
+}
diff --git a/flamecord/src/main/java/dev/_2lstudios/flamecord/antibot/AddressData.java b/flamecord/src/main/java/dev/_2lstudios/flamecord/antibot/AddressData.java
new file mode 100644
index 000000000..a4e754f7e
index 000000000..e8c80ad08
--- /dev/null
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/antibot/AddressData.java
@@ -0,0 +1,162 @@
@ -260,7 +260,7 @@ index 000000000..a4e754f7e
+ }
+
+ public void firewall(String reason) {
+ if (!hostString.equals("127.0.0.1")) {
+ if (!FlameCord.getInstance().getFlameCordConfiguration().getAntibotFirewallWhitelist().contains(hostString)) {
+ this.lastFirewall = System.currentTimeMillis();
+ this.firewallReason = reason;
+ }
@ -1101,10 +1101,10 @@ index 000000000..44d773abe
+ }
+}
diff --git a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
index a1d23f74d..d42e3d75f 100644
index a1d23f74d..8b8b4915a 100644
--- a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
@@ -16,6 +16,160 @@ import net.md_5.bungee.config.Configuration;
@@ -16,6 +16,166 @@ import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider;
public class FlameCordConfiguration extends FlameConfig {
@ -1135,6 +1135,8 @@ index a1d23f74d..d42e3d75f 100644
+ private int antibotFastChatTime = 1000;
+ @Getter
+ private boolean antibotFastChatLog = true;
+
+ // Antibot firewall
+ @Getter
+ private boolean antibotFirewallEnabled = true;
+ @Getter
@ -1142,6 +1144,9 @@ index a1d23f74d..d42e3d75f 100644
+ @Getter
+ private boolean antibotFirewallLog = true;
+ @Getter
+ private Collection<String> antibotFirewallWhitelist = Arrays.asList("127.0.0.1");
+
+ @Getter
+ private boolean antibotNicknameEnabled = true;
+ @Getter
+ private boolean antibotNicknameFirewall = true;
@ -1222,6 +1227,7 @@ index a1d23f74d..d42e3d75f 100644
+ this.antibotFirewalledExceptions = setIfUnexistant("antibot.firewall.exceptions", this.antibotFirewalledExceptions, config);
+ this.antibotFirewallExpire = setIfUnexistant("antibot.firewall.time", this.antibotFirewallExpire, config);
+ this.antibotFirewallLog = setIfUnexistant("antibot.firewall.log", this.antibotFirewallLog, config);
+ this.antibotFirewallWhitelist = setIfUnexistant("antibot.firewall.whitelist", this.antibotFirewallWhitelist, config);
+
+ // Antibot nickname
+ this.antibotNicknameEnabled = setIfUnexistant("antibot.nickname.enabled", this.antibotNicknameEnabled, config);
@ -1265,7 +1271,7 @@ index a1d23f74d..d42e3d75f 100644
// FlameCord - TCP Fast Open
@Getter
private int tcpFastOpen = 3;
@@ -117,6 +271,8 @@ public class FlameCordConfiguration extends FlameConfig {
@@ -117,6 +277,8 @@ public class FlameCordConfiguration extends FlameConfig {
this.fakePlayersEnabled = setIfUnexistant("custom-motd.fakeplayers.enabled", this.fakePlayersEnabled, configuration);
this.fakePlayersAmount = setIfUnexistant("custom-motd.fakeplayers.amount", this.fakePlayersAmount, configuration);
this.fakePlayersMode = setIfUnexistant("custom-motd.fakeplayers.mode", this.fakePlayersMode, configuration);

View File

@ -1,11 +1,11 @@
From 6872a064715964bac98a97bf498b00b98244b8b8 Mon Sep 17 00:00:00 2001
From 9b2f04b355233c50456f0a9bca394ebbcd56520e Mon Sep 17 00:00:00 2001
From: LinsaFTW <25271111+linsaftw@users.noreply.github.com>
Date: Fri, 4 Mar 2022 14:09:35 -0300
Subject: [PATCH] Allow Invalid Names
diff --git a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
index 367c25d19..544ad091b 100644
index 8b8b4915a..655cf32b2 100644
--- a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
@@ -16,6 +16,10 @@ import net.md_5.bungee.config.Configuration;
@ -19,7 +19,7 @@ index 367c25d19..544ad091b 100644
// FlameCord start - Antibot System
@Getter
private boolean antibotAccountsEnabled = true;
@@ -271,6 +275,8 @@ public class FlameCordConfiguration extends FlameConfig {
@@ -277,6 +281,8 @@ public class FlameCordConfiguration extends FlameConfig {
this.fakePlayersEnabled = setIfUnexistant("custom-motd.fakeplayers.enabled", this.fakePlayersEnabled, configuration);
this.fakePlayersAmount = setIfUnexistant("custom-motd.fakeplayers.amount", this.fakePlayersAmount, configuration);
this.fakePlayersMode = setIfUnexistant("custom-motd.fakeplayers.mode", this.fakePlayersMode, configuration);
@ -29,7 +29,7 @@ index 367c25d19..544ad091b 100644
this.tcpFastOpen = setIfUnexistant("tcp-fast-open", this.tcpFastOpen, configuration);
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
index bbf9c3dba..952b2a363 100644
index 86021b71b..c2733d6e3 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
@@ -521,7 +521,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection