Put configuration values into extra lines to highlight the environment

They are not configuration options

Related #488
This commit is contained in:
games647
2021-03-10 16:50:16 +01:00
parent d9f254fbff
commit 337e01e537
4 changed files with 17 additions and 19 deletions

View File

@ -56,7 +56,6 @@
</build> </build>
<repositories> <repositories>
<repository> <repository>
<id>codemc-repo</id> <id>codemc-repo</id>
<url>https://repo.codemc.io/repository/maven-public/</url> <url>https://repo.codemc.io/repository/maven-public/</url>
@ -71,7 +70,6 @@
<id>spigotplugins-repo</id> <id>spigotplugins-repo</id>
<url>https://maven.gamestrike.de/mvn/</url> <url>https://maven.gamestrike.de/mvn/</url>
</repository> </repository>
</repositories> </repositories>
<dependencies> <dependencies>

View File

@ -71,22 +71,21 @@ public class ConnectListener implements Listener {
@EventHandler @EventHandler
public void onPreLogin(PreLoginEvent preLoginEvent) { public void onPreLogin(PreLoginEvent preLoginEvent) {
if (preLoginEvent.isCancelled() || isBedrockPlayer(preLoginEvent.getConnection().getUniqueId())) { PendingConnection connection = preLoginEvent.getConnection();
if (preLoginEvent.isCancelled() || isBedrockPlayer(connection.getUniqueId())) {
return; return;
} }
PendingConnection connection = preLoginEvent.getConnection();
if (!rateLimiter.tryAcquire()) { if (!rateLimiter.tryAcquire()) {
plugin.getLog().warn("Join limit hit - Ignoring player {}", connection); plugin.getLog().warn("Join limit hit - Ignoring player {}", connection);
return; return;
} }
InitialHandler initialHandler = (InitialHandler) connection; String username = connection.getName();
String username = initialHandler.getLoginRequest().getData(); plugin.getLog().info("Incoming login request for {} from {}", username, connection.getSocketAddress());
plugin.getLog().info("Incoming login request for {} from {}", username, initialHandler.getAddress());
preLoginEvent.registerIntent(plugin); preLoginEvent.registerIntent(plugin);
Runnable asyncPremiumCheck = new AsyncPremiumCheck(plugin, preLoginEvent, connection); Runnable asyncPremiumCheck = new AsyncPremiumCheck(plugin, preLoginEvent, connection, username);
plugin.getScheduler().runAsync(asyncPremiumCheck); plugin.getScheduler().runAsync(asyncPremiumCheck);
} }

View File

@ -12,7 +12,6 @@ import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.connection.PendingConnection; import net.md_5.bungee.api.connection.PendingConnection;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.PreLoginEvent; import net.md_5.bungee.api.event.PreLoginEvent;
import net.md_5.bungee.connection.InitialHandler;
public class AsyncPremiumCheck extends JoinManagement<ProxiedPlayer, CommandSender, BungeeLoginSource> public class AsyncPremiumCheck extends JoinManagement<ProxiedPlayer, CommandSender, BungeeLoginSource>
implements Runnable { implements Runnable {
@ -20,22 +19,23 @@ public class AsyncPremiumCheck extends JoinManagement<ProxiedPlayer, CommandSend
private final FastLoginBungee plugin; private final FastLoginBungee plugin;
private final PreLoginEvent preLoginEvent; private final PreLoginEvent preLoginEvent;
private final String username;
private final PendingConnection connection; private final PendingConnection connection;
public AsyncPremiumCheck(FastLoginBungee plugin, PreLoginEvent preLoginEvent, PendingConnection connection) { public AsyncPremiumCheck(FastLoginBungee plugin, PreLoginEvent preLoginEvent, PendingConnection connection,
String username) {
super(plugin.getCore(), plugin.getCore().getAuthPluginHook()); super(plugin.getCore(), plugin.getCore().getAuthPluginHook());
this.plugin = plugin; this.plugin = plugin;
this.preLoginEvent = preLoginEvent; this.preLoginEvent = preLoginEvent;
this.connection = connection; this.connection = connection;
this.username = username;
} }
@Override @Override
public void run() { public void run() {
plugin.getSession().remove(connection); plugin.getSession().remove(connection);
InitialHandler initialHandler = (InitialHandler) connection;
String username = initialHandler.getLoginRequest().getData();
try { try {
super.onLogin(username, new BungeeLoginSource(connection, preLoginEvent)); super.onLogin(username, new BungeeLoginSource(connection, preLoginEvent));
} finally { } finally {

View File

@ -85,14 +85,15 @@ premiumUuid: false
# player changed it's username and we just update the name in the database. # player changed it's username and we just update the name in the database.
# Examples: # Examples:
# #### Case 1 # #### Case 1
# nameChangeCheck = false ----- autoRegister = false # autoRegister = false
# nameChangeCheck = false
# #
# GameProfile logins as cracked until the player invoked the command /premium. Then we could override the existing # GameProfile logins as cracked until the player invoked the command /premium. Then we could override the existing
# database record. # database record.
# #
# #### Case 2 # #### Case 2
# # autoRegister = false
# nameChangeCheck = true ----- autoRegister = false # nameChangeCheck = true
# #
# Connect the Mojang API and check what UUID the player has (UUID exists => Paid Minecraft account). If that UUID is in # Connect the Mojang API and check what UUID the player has (UUID exists => Paid Minecraft account). If that UUID is in
# the database it's an **existing player** and FastLogin can **assume** the player is premium and changed the username. # the database it's an **existing player** and FastLogin can **assume** the player is premium and changed the username.
@ -104,8 +105,8 @@ premiumUuid: false
# in the meanwhile). # in the meanwhile).
# #
# #### Case 3 # #### Case 3
# # autoRegister = true
# nameChangeCheck = false ----- autoRegister = true # nameChangeCheck = false
# #
# We will always request a premium authentication if the username is unknown to us, but is in use by a paid Minecraft # We will always request a premium authentication if the username is unknown to us, but is in use by a paid Minecraft
# account. This means it's kind of a more aggressive check like nameChangeCheck = true and autoRegister = false, because # account. This means it's kind of a more aggressive check like nameChangeCheck = true and autoRegister = false, because
@ -114,8 +115,8 @@ premiumUuid: false
# **Limitation**: see below # **Limitation**: see below
# #
# #### Case 4 # #### Case 4
# # autoRegister = true
# nameChangeCheck = true ----- autoRegister = true # nameChangeCheck = true
# #
# Based on autoRegister it checks if the player name is premium and login using a premium authentication. After that # Based on autoRegister it checks if the player name is premium and login using a premium authentication. After that
# fastlogin receives the premium UUID and can update the database record. # fastlogin receives the premium UUID and can update the database record.