Paper/Spigot-Server-Patches/0307-Configurable-connection-throttle-kick-message.patch

39 lines
2.3 KiB
Diff
Raw Normal View History

2019-12-13 21:41:01 +01:00
From c49c8a13f7456b3b157160c4b8efbfe141c11fc0 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Tue, 2 Oct 2018 09:57:50 +0100
Subject: [PATCH] Configurable connection throttle kick message
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 559e6b42b..092bff78a 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -274,6 +274,11 @@ public class PaperConfig {
authenticationServersDownKickMessage = Strings.emptyToNull(getString("messages.kick.authentication-servers-down", authenticationServersDownKickMessage));
}
+ public static String connectionThrottleKickMessage = "Connection throttled! Please wait before reconnecting.";
+ private static void connectionThrottleKickMessage() {
+ connectionThrottleKickMessage = getString("messages.kick.connection-throttle", connectionThrottleKickMessage);
+ }
+
public static boolean savePlayerData = true;
private static void savePlayerData() {
savePlayerData = getBoolean("settings.save-player-data", savePlayerData);
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
index 8928d93e4..0532f975b 100644
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
2019-05-05 10:33:44 +02:00
@@ -38,7 +38,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
2019-05-28 01:01:45 +02:00
synchronized (throttleTracker) {
if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) {
throttleTracker.put(address, currentTime);
- chatmessage = new ChatMessage("Connection throttled! Please wait before reconnecting.");
+ chatmessage = new ChatMessage(com.destroystokyo.paper.PaperConfig.connectionThrottleKickMessage); // Paper - Configurable connection throttle kick message
2019-05-28 01:01:45 +02:00
this.b.sendPacket(new PacketLoginOutDisconnect(chatmessage));
this.b.close(chatmessage);
return;
--
2019-12-13 21:41:01 +01:00
2.24.1