Merge pull request #103 from HakanGulgen/master

More features for custom motd.
This commit is contained in:
Juan Cruz Linsalata 2022-04-22 19:12:59 -03:00 committed by GitHub
commit 7ea14506a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 209 additions and 86 deletions

View File

@ -1,14 +1,33 @@
From 608e7343216c313476d8c0d09a8b94c9f85a8519 Mon Sep 17 00:00:00 2001
From e4f068cdf525de91cca34a4cc493303acbe1dec4 Mon Sep 17 00:00:00 2001
From: LinsaFTW <25271111+linsaftw@users.noreply.github.com>
Date: Thu, 7 Oct 2021 21:37:24 -0300
Subject: [PATCH] Custom motd system
diff --git a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameConfig.java b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameConfig.java
index cfbd55c3..360305b9 100644
--- a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameConfig.java
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameConfig.java
@@ -11,6 +11,10 @@ public class FlameConfig {
return (int) setIfUnexistant(arg1, (Object) arg2, configuration);
}
+ String setIfUnexistant(final String arg1, final String arg2, final Configuration configuration) {
+ return (String) setIfUnexistant(arg1, (Object) arg2, configuration);
+ }
+
boolean setIfUnexistant(final String arg1, final boolean arg2, final Configuration configuration) {
return (boolean) setIfUnexistant(arg1, (Object) arg2, configuration);
}
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 701db67c..48deace6 100644
index 701db67c..25716fa7 100644
--- a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
@@ -6,12 +6,33 @@ import java.util.ArrayList;
@@ -3,15 +3,80 @@ package dev._2lstudios.flamecord.configuration;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
@ -29,44 +48,157 @@ index 701db67c..48deace6 100644
+ return strings;
+ }
+
+ @Getter
+ private boolean customMotdEnabled = false;
+ private List<String> customMotdMotds = Arrays.asList(new String[] { "&eDefault &cFlameCord&e custom motd!\n&eChange me in &cflamecord.yml&e file!" });
+ public String getMOTD(final int maxPlayers, final int onlinePlayers) {
+ final String motd = motds.get(new Random().nextInt(motds.size()));
+
+ public String getRandomMotd() {
+ final Random random = new Random();
+
+ return customMotdMotds.get(random.nextInt(customMotdMotds.size()));
+ return motd.replace("%maxplayers%", String.valueOf(maxPlayers)).replace("%onlineplayers%", String.valueOf(onlinePlayers));
+ }
+
+ public String[] getSample(final int maxPlayers, final int onlinePlayers) {
+ final String sample = samples.get(new Random().nextInt(samples.size()));
+
+ return sample.replace("%maxplayers%", String.valueOf(maxPlayers)).replace("%onlineplayers%", String.valueOf(onlinePlayers)).split("\n");
+ }
+
+ public int getFakePlayersAmount(final int players) {
+ switch (fakePlayersMode) {
+ case "STATIC":
+ return fakePlayersAmount;
+ case "RANDOM":
+ return (int) (Math.floor(Math.random() * fakePlayersAmount) + 1);
+ case "DIVISION":
+ return players / fakePlayersAmount;
+ default:
+ return 0;
+ }
+ }
+
+ @Getter
+ private boolean motdEnabled = false;
+ @Getter
+ private List<String> motds = Collections.singletonList("&eDefault &cFlameCord&e custom motd!\n&eChange me in &cflamecord.yml&e file!");
+
+ @Getter
+ private boolean sampleEnabled = false;
+ @Getter
+ private List<String> samples = Collections.singletonList("&eDefault &cFlameCord&e sample!\n&eChange me in &cflamecord.yml&e file!");
+
+ @Getter
+ private boolean protocolEnabled = false;
+ @Getter
+ private String protocolName = "FlameCord 1.7-1.18";
+
+ @Getter
+ private boolean maxPlayersEnabled = false;
+ @Getter
+ private int maxPlayersAmount = 1000;
+ @Getter
+ private boolean maxPlayersOneMore = false;
+
+ @Getter
+ private boolean fakePlayersEnabled = false;
+ @Getter
+ private int fakePlayersAmount = 3;
+ private String fakePlayersMode = "DIVISION";
+
@Getter
private boolean loggerInitialhandler = false;
@Getter
@@ -34,6 +55,9 @@ public class FlameCordConfiguration extends FlameConfig {
@@ -34,6 +99,19 @@ public class FlameCordConfiguration extends FlameConfig {
configuration = configurationProvider.load(configurationFile);
}
+ this.customMotdEnabled = setIfUnexistant("custom-motd.enabled", this.customMotdEnabled, configuration);
+ this.customMotdMotds = colors(new ArrayList<>(setIfUnexistant("custom-motd.motds", this.customMotdMotds, configuration)));
+ this.motdEnabled = setIfUnexistant("custom-motd.motd.enabled", this.motdEnabled, configuration);
+ this.motds = colors(new ArrayList<>(setIfUnexistant("custom-motd.motd.motds", this.motds, configuration)));
+ this.sampleEnabled = setIfUnexistant("custom-motd.sample.enabled", this.sampleEnabled, configuration);
+ this.samples = colors(new ArrayList<>(setIfUnexistant("custom-motd.sample.samples", this.samples, configuration)));
+ this.protocolEnabled = setIfUnexistant("custom-motd.protocol.enabled", this.protocolEnabled, configuration);
+ this.protocolName = setIfUnexistant("custom-motd.protocol.name", this.protocolName, configuration);
+ this.maxPlayersEnabled = setIfUnexistant("custom-motd.maxplayers.enabled", this.maxPlayersEnabled, configuration);
+ this.maxPlayersAmount = setIfUnexistant("custom-motd.maxplayers.amount", this.maxPlayersAmount, configuration);
+ this.maxPlayersOneMore = setIfUnexistant("custom-motd.maxplayers.justonemore", this.maxPlayersOneMore, configuration);
+ 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);
+
this.loggerInitialhandler = setIfUnexistant("logger.initialhandler", this.loggerInitialhandler, configuration);
this.loggerExceptions = setIfUnexistant("logger.exceptions", this.loggerExceptions, configuration);
this.loggerDump = setIfUnexistant("logger.dump", this.loggerDump, 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 cfd6249e..0c608e0f 100644
index cfd6249e..d1a06397 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
@@ -250,7 +250,9 @@ public class InitialHandler extends PacketHandler implements PendingConnection
@@ -21,6 +21,8 @@ import javax.crypto.spec.SecretKeySpec;
import dev._2lstudios.flamecord.FlameCord;
+import dev._2lstudios.flamecord.configuration.FlameConfig;
+import dev._2lstudios.flamecord.configuration.FlameCordConfiguration;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import net.md_5.bungee.BungeeCord;
@@ -250,7 +252,6 @@ public class InitialHandler extends PacketHandler implements PendingConnection
Preconditions.checkState( thisState == State.STATUS, "Not expecting STATUS" );
ServerInfo forced = AbstractReconnectHandler.getForcedHost( this );
- final String motd = ( forced != null ) ? forced.getMotd() : listener.getMotd();
+ // FlameCord - Custom motd
+ final String listenerMotd = FlameCord.getInstance().getFlameCordConfiguration().isCustomMotdEnabled() ? FlameCord.getInstance().getFlameCordConfiguration().getRandomMotd() : listener.getMotd();
+ final String motd = ( forced != null ) ? forced.getMotd() : listenerMotd;
final int protocol = ( ProtocolConstants.SUPPORTED_VERSION_IDS.contains( handshake.getProtocolVersion() ) ) ? handshake.getProtocolVersion() : bungee.getProtocolVersion();
Callback<ServerPing> pingBack = new Callback<ServerPing>()
@@ -313,7 +314,52 @@ public class InitialHandler extends PacketHandler implements PendingConnection
( (BungeeServerInfo) forced ).ping( pingBack, handshake.getProtocolVersion() );
} else
{
- pingBack.done( getPingInfo( motd, protocol ), null );
+ // FlameCord - Custom MOTD
+ final FlameCordConfiguration config = FlameCord.getInstance().getFlameCordConfiguration();
+
+ String motd;
+ String protocolName;
+
+ ServerPing.PlayerInfo[] sample = null;
+
+ int maxPlayers = listener.getMaxPlayers();
+ int onlinePlayers = bungee.getOnlineCount();
+
+ if (config.isFakePlayersEnabled()) {
+ onlinePlayers += config.getFakePlayersAmount(onlinePlayers);
+ }
+
+ if (config.isMaxPlayersEnabled()) {
+ maxPlayers = config.isMaxPlayersOneMore() ? onlinePlayers + 1 : config.getMaxPlayersAmount();
+ }
+
+ if (config.isMotdEnabled()) {
+ motd = config.getMOTD(maxPlayers, onlinePlayers);
+ } else {
+ motd = ( forced != null ) ? forced.getMotd() : listener.getMotd();
+ }
+
+ if (config.isProtocolEnabled()) {
+ protocolName = config.getProtocolName();
+ } else {
+ protocolName = bungee.getName() + " " + bungee.getGameVersion();
+ }
+
+ if (config.isSampleEnabled()) {
+ final UUID fakeUuid = new UUID(0, 0);
+ final String[] sampleString = config.getSample(maxPlayers, onlinePlayers);
+
+ sample = new ServerPing.PlayerInfo[sampleString.length];
+
+ for (int i = 0; i < sampleString.length; i++) {
+ sample[i] = new ServerPing.PlayerInfo(sampleString[i], fakeUuid);
+ }
+ }
+
+ pingBack.done( new ServerPing(
+ new ServerPing.Protocol( protocolName, protocol ),
+ new ServerPing.Players( maxPlayers, onlinePlayers, sample ),
+ motd, BungeeCord.getInstance().config.getFaviconObject() ), null );
}
thisState = State.PING;
--
2.32.0

View File

@ -1,14 +1,14 @@
From 216628c6de6f3697ed82a84be11d73301705e170 Mon Sep 17 00:00:00 2001
From d520f9c83d7a5a455fd08bfa57f598140f512024 Mon Sep 17 00:00:00 2001
From: LinsaFTW <25271111+linsaftw@users.noreply.github.com>
Date: Thu, 24 Feb 2022 23:41:57 -0300
Subject: [PATCH] TCP Fast Open
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 48deace6..d972fcea 100644
index 25716fa7..a77cecf0 100644
--- a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
@@ -15,6 +15,10 @@ import net.md_5.bungee.config.Configuration;
@@ -16,6 +16,10 @@ import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider;
public class FlameCordConfiguration extends FlameConfig {
@ -19,15 +19,14 @@ index 48deace6..d972fcea 100644
private List<String> colors(final List<String> strings) {
for (int i = 0; i < strings.size(); i++) {
strings.set(i, ChatColor.translateAlternateColorCodes('&', strings.get(i)));
@@ -55,6 +59,8 @@ public class FlameCordConfiguration extends FlameConfig {
configuration = configurationProvider.load(configurationFile);
}
@@ -111,6 +115,7 @@ 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);
+ this.tcpFastOpen = setIfUnexistant("tcp-fast-open", this.tcpFastOpen, configuration);
+
this.customMotdEnabled = setIfUnexistant("custom-motd.enabled", this.customMotdEnabled, configuration);
this.customMotdMotds = colors(new ArrayList<>(setIfUnexistant("custom-motd.motds", this.customMotdMotds, configuration)));
this.loggerInitialhandler = setIfUnexistant("logger.initialhandler", this.loggerInitialhandler, configuration);
this.loggerExceptions = setIfUnexistant("logger.exceptions", this.loggerExceptions, configuration);
diff --git a/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java b/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java
index a840bc70..f4bf745c 100644
--- a/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java

View File

@ -1,14 +1,14 @@
From cdf449f0be0a29592f76f2b53afc2da0949d58f1 Mon Sep 17 00:00:00 2001
From 2955e7fb79cc4a078a7290263cf86e2da94381f8 Mon Sep 17 00:00:00 2001
From: LinsaFTW <25271111+linsaftw@users.noreply.github.com>
Date: Fri, 25 Feb 2022 12:28:31 -0300
Subject: [PATCH] InitialHandler Processing State
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 0c608e0f..4d9e9b89 100644
index d1a06397..0a09f92c 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
@@ -128,12 +128,12 @@ public class InitialHandler extends PacketHandler implements PendingConnection
@@ -130,12 +130,12 @@ public class InitialHandler extends PacketHandler implements PendingConnection
private enum State
{
@ -23,15 +23,15 @@ index 0c608e0f..4d9e9b89 100644
}
@Override
@@ -248,6 +248,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
@@ -250,6 +250,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
public void handle(StatusRequest statusRequest) throws Exception
{
Preconditions.checkState( thisState == State.STATUS, "Not expecting STATUS" );
+ thisState = State.PROCESSING;
ServerInfo forced = AbstractReconnectHandler.getForcedHost( this );
// FlameCord - Custom motd
@@ -328,6 +329,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
final int protocol = ( ProtocolConstants.SUPPORTED_VERSION_IDS.contains( handshake.getProtocolVersion() ) ) ? handshake.getProtocolVersion() : bungee.getProtocolVersion();
@@ -372,6 +373,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
{
// FlameCord - Never accept invalid packets
Preconditions.checkState( thisState == State.PING, "Not expecting PING" );
@ -39,7 +39,7 @@ index 0c608e0f..4d9e9b89 100644
unsafe.sendPacket( ping );
@@ -339,6 +341,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
@@ -383,6 +385,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
public void handle(Handshake handshake) throws Exception
{
Preconditions.checkState( thisState == State.HANDSHAKE, "Not expecting HANDSHAKE" );
@ -47,7 +47,7 @@ index 0c608e0f..4d9e9b89 100644
this.handshake = handshake;
ch.setVersion( handshake.getProtocolVersion() );
@@ -411,6 +414,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
@@ -455,6 +458,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
public void handle(LoginRequest loginRequest) throws Exception
{
Preconditions.checkState( thisState == State.USERNAME, "Not expecting USERNAME" );
@ -55,7 +55,7 @@ index 0c608e0f..4d9e9b89 100644
if ( !AllowedCharacters.isValidName( loginRequest.getData(), onlineMode ) )
{
@@ -469,6 +473,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
@@ -513,6 +517,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
public void handle(final EncryptionResponse encryptResponse) throws Exception
{
Preconditions.checkState( thisState == State.ENCRYPT, "Not expecting ENCRYPT" );
@ -63,7 +63,7 @@ index 0c608e0f..4d9e9b89 100644
SecretKey sharedKey = EncryptionUtil.getSecret( encryptResponse, request );
// Waterfall start
@@ -696,14 +701,14 @@ public class InitialHandler extends PacketHandler implements PendingConnection
@@ -740,14 +745,14 @@ public class InitialHandler extends PacketHandler implements PendingConnection
@Override
public void setOnlineMode(boolean onlineMode)
{

View File

@ -1,11 +1,11 @@
From 42bcedf00c5abd628c032f20e43970ff8ff13f71 Mon Sep 17 00:00:00 2001
From f46da0d9a58d8a72acf3e144b6e59d96ca0c3aca 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
diff --git a/flamecord/pom.xml b/flamecord/pom.xml
index f4bf5ec6e..4a0d8e5da 100644
index f4bf5ec6..4a0d8e5d 100644
--- a/flamecord/pom.xml
+++ b/flamecord/pom.xml
@@ -30,6 +30,11 @@
@ -22,7 +22,7 @@ index f4bf5ec6e..4a0d8e5da 100644
<build>
diff --git a/flamecord/src/main/java/dev/_2lstudios/antibot/AccountsCheck.java b/flamecord/src/main/java/dev/_2lstudios/antibot/AccountsCheck.java
new file mode 100644
index 000000000..dfee9bf83
index 00000000..dfee9bf8
--- /dev/null
+++ b/flamecord/src/main/java/dev/_2lstudios/antibot/AccountsCheck.java
@@ -0,0 +1,36 @@
@ -64,7 +64,7 @@ index 000000000..dfee9bf83
+}
diff --git a/flamecord/src/main/java/dev/_2lstudios/antibot/AddressData.java b/flamecord/src/main/java/dev/_2lstudios/antibot/AddressData.java
new file mode 100644
index 000000000..cd8220d18
index 00000000..cd8220d1
--- /dev/null
+++ b/flamecord/src/main/java/dev/_2lstudios/antibot/AddressData.java
@@ -0,0 +1,149 @@
@ -219,7 +219,7 @@ index 000000000..cd8220d18
+}
diff --git a/flamecord/src/main/java/dev/_2lstudios/antibot/AddressDataManager.java b/flamecord/src/main/java/dev/_2lstudios/antibot/AddressDataManager.java
new file mode 100644
index 000000000..3f6e4186b
index 00000000..3f6e4186
--- /dev/null
+++ b/flamecord/src/main/java/dev/_2lstudios/antibot/AddressDataManager.java
@@ -0,0 +1,25 @@
@ -250,7 +250,7 @@ index 000000000..3f6e4186b
+}
diff --git a/flamecord/src/main/java/dev/_2lstudios/antibot/CheckManager.java b/flamecord/src/main/java/dev/_2lstudios/antibot/CheckManager.java
new file mode 100644
index 000000000..137ed9808
index 00000000..137ed980
--- /dev/null
+++ b/flamecord/src/main/java/dev/_2lstudios/antibot/CheckManager.java
@@ -0,0 +1,41 @@
@ -297,7 +297,7 @@ index 000000000..137ed9808
+}
diff --git a/flamecord/src/main/java/dev/_2lstudios/antibot/CountryCheck.java b/flamecord/src/main/java/dev/_2lstudios/antibot/CountryCheck.java
new file mode 100644
index 000000000..5cb5021ab
index 00000000..5cb5021a
--- /dev/null
+++ b/flamecord/src/main/java/dev/_2lstudios/antibot/CountryCheck.java
@@ -0,0 +1,140 @@
@ -443,7 +443,7 @@ index 000000000..5cb5021ab
+}
diff --git a/flamecord/src/main/java/dev/_2lstudios/antibot/FastChatCheck.java b/flamecord/src/main/java/dev/_2lstudios/antibot/FastChatCheck.java
new file mode 100644
index 000000000..76902c279
index 00000000..76902c27
--- /dev/null
+++ b/flamecord/src/main/java/dev/_2lstudios/antibot/FastChatCheck.java
@@ -0,0 +1,32 @@
@ -481,7 +481,7 @@ index 000000000..76902c279
+}
diff --git a/flamecord/src/main/java/dev/_2lstudios/antibot/FirewallCheck.java b/flamecord/src/main/java/dev/_2lstudios/antibot/FirewallCheck.java
new file mode 100644
index 000000000..d3b77f03f
index 00000000..d3b77f03
--- /dev/null
+++ b/flamecord/src/main/java/dev/_2lstudios/antibot/FirewallCheck.java
@@ -0,0 +1,42 @@
@ -529,7 +529,7 @@ index 000000000..d3b77f03f
+}
diff --git a/flamecord/src/main/java/dev/_2lstudios/antibot/NicknameCheck.java b/flamecord/src/main/java/dev/_2lstudios/antibot/NicknameCheck.java
new file mode 100644
index 000000000..f9b1ad70b
index 00000000..f9b1ad70
--- /dev/null
+++ b/flamecord/src/main/java/dev/_2lstudios/antibot/NicknameCheck.java
@@ -0,0 +1,43 @@
@ -578,7 +578,7 @@ index 000000000..f9b1ad70b
+}
diff --git a/flamecord/src/main/java/dev/_2lstudios/antibot/PasswordCheck.java b/flamecord/src/main/java/dev/_2lstudios/antibot/PasswordCheck.java
new file mode 100644
index 000000000..8ffe1e216
index 00000000..8ffe1e21
--- /dev/null
+++ b/flamecord/src/main/java/dev/_2lstudios/antibot/PasswordCheck.java
@@ -0,0 +1,62 @@
@ -646,7 +646,7 @@ index 000000000..8ffe1e216
+}
diff --git a/flamecord/src/main/java/dev/_2lstudios/antibot/RatelimitCheck.java b/flamecord/src/main/java/dev/_2lstudios/antibot/RatelimitCheck.java
new file mode 100644
index 000000000..f9ab936b1
index 00000000..f9ab936b
--- /dev/null
+++ b/flamecord/src/main/java/dev/_2lstudios/antibot/RatelimitCheck.java
@@ -0,0 +1,33 @@
@ -685,7 +685,7 @@ index 000000000..f9ab936b1
+}
diff --git a/flamecord/src/main/java/dev/_2lstudios/antibot/ReconnectCheck.java b/flamecord/src/main/java/dev/_2lstudios/antibot/ReconnectCheck.java
new file mode 100644
index 000000000..f958a6f23
index 00000000..f958a6f2
--- /dev/null
+++ b/flamecord/src/main/java/dev/_2lstudios/antibot/ReconnectCheck.java
@@ -0,0 +1,33 @@
@ -723,7 +723,7 @@ index 000000000..f958a6f23
+ }
+}
diff --git a/flamecord/src/main/java/dev/_2lstudios/flamecord/FlameCord.java b/flamecord/src/main/java/dev/_2lstudios/flamecord/FlameCord.java
index c78ab3a7c..4079caa5d 100644
index c78ab3a7..4079caa5 100644
--- a/flamecord/src/main/java/dev/_2lstudios/flamecord/FlameCord.java
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/FlameCord.java
@@ -3,6 +3,8 @@ package dev._2lstudios.flamecord;
@ -761,18 +761,10 @@ index c78ab3a7c..4079caa5d 100644
private FlameCord(final Logger logger, final Collection<String> whitelistedAddresses) {
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 d972fcea2..4a145a110 100644
index a77cecf0..9ace4ff5 100644
--- a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
@@ -5,7 +5,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
-import java.util.HashSet;
import java.util.List;
import java.util.Random;
@@ -15,6 +14,114 @@ import net.md_5.bungee.config.Configuration;
@@ -16,6 +16,114 @@ import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider;
public class FlameCordConfiguration extends FlameConfig {
@ -887,17 +879,17 @@ index d972fcea2..4a145a110 100644
// FlameCord - TCP Fast Open
@Getter
private int tcpFastOpen = 3;
@@ -59,6 +166,8 @@ public class FlameCordConfiguration extends FlameConfig {
configuration = configurationProvider.load(configurationFile);
}
@@ -115,6 +223,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);
+ loadAntibot(configuration);
+
this.tcpFastOpen = setIfUnexistant("tcp-fast-open", this.tcpFastOpen, configuration);
this.customMotdEnabled = setIfUnexistant("custom-motd.enabled", this.customMotdEnabled, configuration);
this.loggerInitialhandler = setIfUnexistant("logger.initialhandler", this.loggerInitialhandler, configuration);
diff --git a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/MessagesConfiguration.java b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/MessagesConfiguration.java
index 574629920..ee0295c73 100644
index 57462992..ee0295c7 100644
--- a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/MessagesConfiguration.java
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/MessagesConfiguration.java
@@ -81,6 +81,17 @@ public class MessagesConfiguration extends FlameConfig {
@ -919,7 +911,7 @@ index 574629920..ee0295c73 100644
setIfUnexistant("flamecord_reload", "&aAll files had been successfully reloaded!", configuration);
setIfUnexistant("flamecord_help",
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 4ced9bd6a..55b424d2c 100644
index 0a09f92c..813f0e9b 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
@@ -19,6 +19,8 @@ import java.util.logging.Level;
@ -930,8 +922,8 @@ index 4ced9bd6a..55b424d2c 100644
+import dev._2lstudios.antibot.CheckManager;
import dev._2lstudios.flamecord.FlameCord;
import lombok.Getter;
@@ -371,6 +373,11 @@ public class InitialHandler extends PacketHandler implements PendingConnection
import dev._2lstudios.flamecord.configuration.FlameConfig;
@@ -415,6 +417,11 @@ public class InitialHandler extends PacketHandler implements PendingConnection
return;
}
@ -943,7 +935,7 @@ index 4ced9bd6a..55b424d2c 100644
switch ( handshake.getRequestedProtocol() )
{
case 1:
@@ -382,6 +389,22 @@ public class InitialHandler extends PacketHandler implements PendingConnection
@@ -426,6 +433,22 @@ public class InitialHandler extends PacketHandler implements PendingConnection
}
thisState = State.STATUS;
ch.setProtocol( Protocol.STATUS );
@ -966,7 +958,7 @@ index 4ced9bd6a..55b424d2c 100644
break;
case 2:
// Login
@@ -393,6 +416,21 @@ public class InitialHandler extends PacketHandler implements PendingConnection
@@ -437,6 +460,21 @@ public class InitialHandler extends PacketHandler implements PendingConnection
thisState = State.USERNAME;
ch.setProtocol( Protocol.LOGIN );
@ -988,7 +980,7 @@ index 4ced9bd6a..55b424d2c 100644
if ( !ProtocolConstants.SUPPORTED_VERSION_IDS.contains( handshake.getProtocolVersion() ) )
{
if ( handshake.getProtocolVersion() > bungee.getProtocolVersion() )
@@ -430,6 +468,58 @@ public class InitialHandler extends PacketHandler implements PendingConnection
@@ -474,6 +512,58 @@ public class InitialHandler extends PacketHandler implements PendingConnection
return;
}
@ -1048,7 +1040,7 @@ index 4ced9bd6a..55b424d2c 100644
// We can just check by UUID here as names are based on UUID
if ( !isOnlineMode() && bungee.getPlayer( getUniqueId() ) != null )
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java
index e354032aa..976c37e10 100644
index e354032a..976c37e1 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java
@@ -4,10 +4,15 @@ import com.google.common.base.Preconditions;
@ -1101,7 +1093,7 @@ index e354032aa..976c37e10 100644
if ( !bungee.getPluginManager().callEvent( chatEvent ).isCancelled() )
{
diff --git a/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java b/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java
index cef44d8a6..8fe2b37f6 100644
index cef44d8a..8fe2b37f 100644
--- a/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java
+++ b/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java
@@ -152,6 +152,13 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
@ -1119,7 +1111,7 @@ index cef44d8a6..8fe2b37f6 100644
logExceptions = FlameCord.getInstance().getFlameCordConfiguration().isLoggerExceptions() ? logExceptions : false;
diff --git a/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java b/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java
index f4bf745c8..eaedb4593 100644
index f4bf745c..eaedb459 100644
--- a/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java
+++ b/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java
@@ -63,6 +63,14 @@ public class PipelineUtils

View File

@ -1,14 +1,14 @@
From 59bd5c9b337f2f398cd092ded01185743aab1e2f Mon Sep 17 00:00:00 2001
From 979e4625e5efa8e34d885f6e7ce02dae8d008161 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 dc9ba8f0..aa1c8266 100644
index 9ace4ff5..d2fa6216 100644
--- a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
@@ -14,6 +14,10 @@ import net.md_5.bungee.config.Configuration;
@@ -16,6 +16,10 @@ import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider;
public class FlameCordConfiguration extends FlameConfig {
@ -19,20 +19,20 @@ index dc9ba8f0..aa1c8266 100644
// FlameCord start - Antibot System
@Getter
private boolean antibotAccountsEnabled = true;
@@ -166,6 +170,8 @@ public class FlameCordConfiguration extends FlameConfig {
configuration = configurationProvider.load(configurationFile);
}
@@ -223,6 +227,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);
+ this.allowInvalidNames = setIfUnexistant("allow-invalid-names", this.allowInvalidNames, configuration);
+
loadAntibot(configuration);
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 a9a17154..0c5fd21e 100644
index 813f0e9b..7fa3217e 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
@@ -454,7 +454,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
@@ -498,7 +498,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
Preconditions.checkState( thisState == State.USERNAME, "Not expecting USERNAME" );
thisState = State.PROCESSING_USERNAME;