aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0273-Configurable-connection-throttle-kick-message.patch
blob: 73bbdac9baec51ac1afb0f2bbd8d19e74d6b6b6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From 0000000000000000000000000000000000000000 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 a89ccdf2ea517d2ec38c9433bdc26802884ed988..da21f1623a90ade429723d4eb12d646aaf28071e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -294,6 +294,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);
+    }
+
     private static void savePlayerData() {
         Object val = config.get("settings.save-player-data");
         if (val instanceof Boolean) {
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index 484221e5a9c246aa91e0eacef3911b0e9ecff401..c09d3cdb3acb04b6a833c30a619ff2af5e8b6b18 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -50,7 +50,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
                     synchronized (ServerHandshakePacketListenerImpl.throttleTracker) {
                         if (ServerHandshakePacketListenerImpl.throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ServerHandshakePacketListenerImpl.throttleTracker.get(address) < connectionThrottle) {
                             ServerHandshakePacketListenerImpl.throttleTracker.put(address, currentTime);
-                            TranslatableComponent chatmessage = new TranslatableComponent("Connection throttled! Please wait before reconnecting.");
+                            TranslatableComponent chatmessage = new TranslatableComponent(com.destroystokyo.paper.PaperConfig.connectionThrottleKickMessage); // Paper - Configurable connection throttle kick message
                             this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage));
                             this.connection.disconnect(chatmessage);
                             return;