2019-07-20 06:01:24 +02:00
|
|
|
From d68529932751226e348fd0d0a70944b5d377471c Mon Sep 17 00:00:00 2001
|
2018-10-02 11:00:16 +02:00
|
|
|
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
|
2019-07-20 06:01:24 +02:00
|
|
|
index ea3695b021..d2c039ea2f 100644
|
2018-10-02 11:00:16 +02:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
2019-05-06 09:20:16 +02:00
|
|
|
@@ -275,6 +275,11 @@ public class PaperConfig {
|
2018-10-02 11:00:16 +02: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);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
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
|
2019-07-20 06:01:24 +02:00
|
|
|
index 740c8d2728..9a8e5e1213 100644
|
2018-10-02 11:00:16 +02:00
|
|
|
--- 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.");
|
2018-10-02 11:00:16 +02:00
|
|
|
+ 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;
|
2018-10-02 11:00:16 +02:00
|
|
|
--
|
2019-06-25 21:18:50 +02:00
|
|
|
2.22.0
|
2018-10-02 11:00:16 +02:00
|
|
|
|