Placeholders for Protocol Name feature Custom Motd

This commit is contained in:
LinsaFTW 2023-01-25 13:51:20 -03:00
parent 59a31e05e2
commit 8e47ac2731
4 changed files with 23 additions and 19 deletions

View File

@ -1,4 +1,4 @@
From 44e41f7854f933e40371fc85cefdf2991e2fb255 Mon Sep 17 00:00:00 2001
From 6b240a4dfee02eb3762994affbce94c84c829a8f 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
@ -20,10 +20,10 @@ index 5589ce1b..1e928197 100644
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 edecc1e5..b148a717 100644
index edecc1e5..b920cf63 100644
--- a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
@@ -3,15 +3,88 @@ package dev._2lstudios.flamecord.configuration;
@@ -3,15 +3,92 @@ package dev._2lstudios.flamecord.configuration;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@ -68,6 +68,10 @@ index edecc1e5..b148a717 100644
+ return sample.split("\n");
+ }
+
+ public String getProtocolName(int maxPlayers, int onlinePlayers) {
+ return protocolName.replace("%maxplayers%", String.valueOf(maxPlayers)).replace("%onlineplayers%", String.valueOf(onlinePlayers));
+ }
+
+ public int getFakePlayersAmount(final int players) {
+ switch (fakePlayersMode) {
+ case "STATIC":
@ -112,7 +116,7 @@ index edecc1e5..b148a717 100644
@Getter
private boolean loggerInitialhandler = false;
@Getter
@@ -36,6 +109,21 @@ public class FlameCordConfiguration extends FlameConfig {
@@ -36,6 +113,21 @@ public class FlameCordConfiguration extends FlameConfig {
configuration = configurationProvider.load(configurationFile);
}
@ -601,7 +605,7 @@ index 00000000..0b039c79
+
+}
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 abed08d4..17a6d422 100644
index 66a34754..23b488d1 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
@@ -23,6 +23,8 @@ import javax.crypto.spec.SecretKeySpec;
@ -653,7 +657,7 @@ index abed08d4..17a6d422 100644
+ }
+
+ if (config.isProtocolEnabled()) {
+ protocolName = config.getProtocolName();
+ protocolName = config.getProtocolName(maxPlayers, onlinePlayers);
+ } else {
+ protocolName = bungee.getName() + " " + bungee.getGameVersion();
+ }

View File

@ -1,11 +1,11 @@
From 7f3a1472da95624a579d8355541ff63df5dd735f Mon Sep 17 00:00:00 2001
From 35bab2c97710ecdb12d8d46b216702b833dcfb12 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 22a8ac39d..9912fc25c 100644
index b920cf63..38e40429 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 22a8ac39d..9912fc25c 100644
public String getMOTD(int maxPlayers, int onlinePlayers, int protocol) {
String motd;
@@ -123,6 +127,7 @@ public class FlameCordConfiguration extends FlameConfig {
@@ -127,6 +131,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);
@ -28,7 +28,7 @@ index 22a8ac39d..9912fc25c 100644
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 a4c3bd710..ffea15992 100644
index a4c3bd71..ffea1599 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
@@ -194,6 +194,8 @@ public class PipelineUtils

View File

@ -1,4 +1,4 @@
From a4ab09bf04f96ed3bf0d8c1aa0142a08ab20f0c9 Mon Sep 17 00:00:00 2001
From 495e5daadc5dd7bb0a10540acea0a721e233aa0d 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
@ -1267,7 +1267,7 @@ index 00000000..44d773ab
+ }
+}
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 3789d6b5..1fbcde9d 100644
index 38e40429..49f831cc 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,184 @@ import net.md_5.bungee.config.Configuration;
@ -1455,7 +1455,7 @@ index 3789d6b5..1fbcde9d 100644
// FlameCord - TCP Fast Open
@Getter
private int tcpFastOpen = 3;
@@ -127,6 +305,7 @@ public class FlameCordConfiguration extends FlameConfig {
@@ -131,6 +309,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);
@ -1463,7 +1463,7 @@ index 3789d6b5..1fbcde9d 100644
this.tcpFastOpen = setIfUnexistant("tcp-fast-open", this.tcpFastOpen, configuration);
this.loggerInitialhandler = setIfUnexistant("logger.initialhandler", this.loggerInitialhandler, configuration);
@@ -135,6 +314,9 @@ public class FlameCordConfiguration extends FlameConfig {
@@ -139,6 +318,9 @@ public class FlameCordConfiguration extends FlameConfig {
this.loggerHaProxy = setIfUnexistant("logger.haproxy", this.loggerHaProxy, configuration);
this.loggerDetailedConnection = setIfUnexistant("logger.detailed-connect-errors", this.loggerDetailedConnection, configuration);
@ -1716,7 +1716,7 @@ index 8d56997e..d892c23c 100644
// Need to close loggers after last message!
org.apache.logging.log4j.LogManager.shutdown(); // Waterfall
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 11496f05..19857535 100644
index 23b488d1..e41e94e4 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
@@ -22,8 +22,8 @@ import javax.crypto.SecretKey;

View File

@ -1,11 +1,11 @@
From a33ddde478bbde2b3a44887d67ca9a810d19f61d Mon Sep 17 00:00:00 2001
From ef413893bd49dbd42542cd7aeeaa5426d99cbf86 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 1fbcde9d..266c2ad9 100644
index 49f831cc..b76adb32 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 1fbcde9d..266c2ad9 100644
// Antibot accounts
@Getter
private boolean antibotAccountsEnabled = true;
@@ -314,6 +318,9 @@ public class FlameCordConfiguration extends FlameConfig {
@@ -318,6 +322,9 @@ public class FlameCordConfiguration extends FlameConfig {
this.loggerHaProxy = setIfUnexistant("logger.haproxy", this.loggerHaProxy, configuration);
this.loggerDetailedConnection = setIfUnexistant("logger.detailed-connect-errors", this.loggerDetailedConnection, configuration);
@ -30,7 +30,7 @@ index 1fbcde9d..266c2ad9 100644
loadAntibot(configuration, whitelistedAddresses);
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 19857535..d485dff0 100644
index e41e94e4..e478ab9e 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
@@ -525,7 +525,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection