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 a436ef49325c9cae1008d5763373cce8c6680e5f..5b7c12db86be64433c65e31e3ecc0b444b0ddf48 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 ead1ae2db1c2ad118a50ab3a2c1216bd3bb5eae8..1b7ff78c12bc9eb04bc0f74b21ccdbbec6dc54c4 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 {
|