Paper/Spigot-Server-Patches/0292-Configurable-connection-throttle-kick-message.patch
Mariell Hoversholm 654b792caf Updated Upstream (CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
a339310c #755: Fix NPE when calling getInventory() for virtual EnderChests
2577f9bf Increase outdated build delay
1dabfdc8 #754: Fix pre-1.16 serialized SkullMeta being broken on 1.16+, losing textures
2020-09-27 11:04:51 -04:00

36 lines
2.4 KiB
Diff

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 1b21911c3e4fd1d4a3305176bb8477c370256906..d5c97bb6503c9bfafd819dd62397b9decd515df5 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -273,6 +273,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 07d5036ce3b04c78f332deed65b9177b70b4361a..ad9324a6052d9fedd40fb8b0899c6ded6e60b315 100644
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
@@ -37,7 +37,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
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
this.c.sendPacket(new PacketLoginOutDisconnect(chatmessage));
this.c.close(chatmessage);
return;