2021-06-11 12:02:28 +00:00
|
|
|
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
|
2022-01-01 03:05:42 +00:00
|
|
|
index 7cec7a377d64dd00ea6fb8f82af489d4bf3bf572..9aa28bb2968522ef1b9375bcc872e6d8dfb01764 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
2021-11-09 07:59:15 +00:00
|
|
|
@@ -294,6 +294,11 @@ public class PaperConfig {
|
2021-06-11 12:02:28 +00:00
|
|
|
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
|
2022-01-01 03:05:42 +00:00
|
|
|
index 85fea9b0bf84a8b40098f35eac503070914c98d8..687308a414095f95b567a2993b679d8b62856578 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- 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
|
2021-06-13 06:48:25 +00:00
|
|
|
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);
|
2021-06-11 12:02:28 +00:00
|
|
|
- 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;
|