testserver/patches/server/0105-Configurable-flying-ki...

45 lines
2.9 KiB
Diff
Raw Normal View History

2021-06-11 12:02:28 +00:00
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
2022-06-03 04:26:56 +00:00
index 77e1a4b9b0734734bbcf03b6adc1cf0552063d1f..2440e81ef23c3b8c91ca5bdf13347f13cb66f549 100644
2021-06-11 12:02:28 +00:00
--- 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 {
2021-06-11 12:02:28 +00:00
}
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
2022-06-07 19:55:39 +00:00
index f3146f65f8e3ac465763093e7f5b53274d4d3356..71b595a293e0add1ad9f7e5c3a2694a8a16771aa 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
2022-06-07 19:55:39 +00:00
@@ -326,7 +326,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
2022-03-01 05:43:03 +00:00
if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger()) {
2021-06-11 12:02:28 +00:00
if (++this.aboveGroundTickCount > 80) {
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString());
2022-06-07 19:55:39 +00:00
- this.disconnect(Component.translatable("multiplayer.disconnect.flying"));
2021-06-11 12:02:28 +00:00
+ this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickPlayerMessage); // Paper - use configurable kick message
return;
}
} else {
2022-06-07 19:55:39 +00:00
@@ -345,7 +345,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
2021-06-11 12:02:28 +00:00
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());
2022-06-07 19:55:39 +00:00
- this.disconnect(Component.translatable("multiplayer.disconnect.flying"));
2021-06-11 12:02:28 +00:00
+ this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickVehicleMessage); // Paper - use configurable kick message
return;
}
} else {