Paper/Spigot-Server-Patches/0291-Configurable-connection-throttle-kick-message.patch
Gabscap 7ae47d4eb3
[CI-SKIP] Remove Waving banner fix (#4786)
Mojang fixed it in MC-63720
2020-11-19 10:15:16 -05: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 d162a5f1c5bcd394897ab1bd1ac6d31454bc94b7..74a4593853707f5dccba597fa903e5f1194cd5c5 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);
+ }
+
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/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
index abace78271eedd453df692f4e24dacef474d215e..5e1747dc176ef855829a38605ec85c8494fb0d21 100644
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
@@ -35,7 +35,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 chatmessage = new ChatMessage("Connection throttled! Please wait before reconnecting.");
+ ChatMessage 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;