2020-04-12 02:39:21 +02:00
|
|
|
From baa13d99b6486a715485bc884a8fbb46fb8b4b72 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
|
2020-04-02 23:07:06 +02:00
|
|
|
index 559e6b42ba..092bff78ab 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-12-12 17:20:43 +01:00
|
|
|
@@ -274,6 +274,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
|
2020-04-02 23:07:06 +02:00
|
|
|
index 8928d93e49..0532f975b7 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
|
|
|
--
|
2020-03-15 21:03:36 +01:00
|
|
|
2.25.1
|
2018-10-02 11:00:16 +02:00
|
|
|
|