mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-21 15:59:28 +00:00
58 lines
2.9 KiB
Diff
58 lines
2.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
|
Date: Sat, 24 Dec 2022 22:50:13 +0100
|
|
Subject: [PATCH] Make slow login timeout configurable
|
|
|
|
License: AGPL-3.0 (https://www.gnu.org/licenses/agpl-3.0.html)
|
|
Gale - https://galemc.org
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
index be73149535c5fd8914db99bb835f4cbb731b63be..9b924f0793d8231244c160a5bc7ac8e1a35bad34 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
@@ -37,6 +37,7 @@ import net.minecraft.util.Crypt;
|
|
import net.minecraft.util.CryptException;
|
|
import net.minecraft.util.RandomSource;
|
|
import org.apache.commons.lang3.Validate;
|
|
+import org.galemc.gale.configuration.GaleGlobalConfiguration;
|
|
import org.slf4j.Logger;
|
|
|
|
// CraftBukkit start
|
|
@@ -96,7 +97,10 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
|
}
|
|
}
|
|
|
|
- if (this.tick++ == 600) {
|
|
+ // Gale start - make slow login timeout configurable
|
|
+ int slowLoginTimeout = GaleGlobalConfiguration.get().misc.premiumAccountSlowLoginTimeout;
|
|
+ if (this.tick++ >= (slowLoginTimeout < 1 ? MAX_TICKS_BEFORE_LOGIN : slowLoginTimeout)) {
|
|
+ // Gale end - make slow login timeout configurable
|
|
this.disconnect(Component.translatable("multiplayer.disconnect.slow_login"));
|
|
}
|
|
|
|
diff --git a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
|
|
index ef95ee4238c6da237e939c06c63cd8666a863ac5..7dcb82b0784816a84557a3842fe6f5f13ec3d5ff 100644
|
|
--- a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
|
|
+++ b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
|
|
@@ -74,6 +74,20 @@ public class GaleGlobalConfiguration extends ConfigurationPart {
|
|
public boolean verifyChatOrder = true;
|
|
// Gale end - Pufferfish - make chat order verification configurable
|
|
|
|
+ // Gale start - make slow login timeout configurable
|
|
+ /**
|
|
+ * The maximum time that a premium account login can take.
|
|
+ * If this time is exceeded, the connection is closed.
|
|
+ * Given in ticks.
|
|
+ * Any value < 1 uses the default timeout, which is currently 600 ticks (30 seconds).
|
|
+ * <ul>
|
|
+ * <li><i>Default</i>: -1</li>
|
|
+ * <li><i>Vanilla</i>: -1</li>
|
|
+ * </ul>
|
|
+ */
|
|
+ public int premiumAccountSlowLoginTimeout = -1;
|
|
+ // Gale end - make slow login timeout configurable
|
|
+
|
|
public IncludeInTimingsReport includeInTimingsReport;
|
|
|
|
public class IncludeInTimingsReport extends ConfigurationPart {
|