PaperMC/patches/server/0105-Configurable-flying-kick-messages.patch
2021-11-30 19:26:33 +01:00

44 lines
2.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Tue, 20 Sep 2016 00:58:01 +0000
Subject: [PATCH] Configurable flying kick messages
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 6c13fe725ca2b2a6f0f375b80f6c2cb643b9913d..5e23ff0c5e44427a996281ae42fc12c28649e158 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -273,4 +273,11 @@ public class PaperConfig {
}
packetInSpamThreshold = getInt("settings.incoming-packet-spam-threshold", 300);
}
+
+ public static String flyingKickPlayerMessage = "Flying is not enabled on this server";
+ public static String flyingKickVehicleMessage = "Flying is not enabled on this server";
+ private static void flyingKickMessages() {
+ flyingKickPlayerMessage = getString("messages.kick.flying-player", flyingKickPlayerMessage);
+ flyingKickVehicleMessage = getString("messages.kick.flying-vehicle", flyingKickVehicleMessage);
+ }
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 9b24ddf170e00e60391a240686e6767e19b04fd3..73293dff5dac52c0737bbda65caea3a1e0cc4acd 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -300,7 +300,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (this.clientIsFloating && !this.player.isSleeping()) {
if (++this.aboveGroundTickCount > 80) {
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString());
- this.disconnect(new TranslatableComponent("multiplayer.disconnect.flying"));
+ this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickPlayerMessage); // Paper - use configurable kick message
return;
}
} else {
@@ -319,7 +319,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (this.clientVehicleIsFloating && this.player.getRootVehicle().getControllingPassenger() == this.player) {
if (++this.aboveGroundVehicleTickCount > 80) {
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString());
- this.disconnect(new TranslatableComponent("multiplayer.disconnect.flying"));
+ this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickVehicleMessage); // Paper - use configurable kick message
return;
}
} else {