From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Shane Freeder 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 12fb251dc96bf179e393046ecc256ea80fdd79de..1672c48c106d95e588b251727cbdb1f6002dc62a 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;