From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: kashike 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 06894c03b1d584c533355b3c4174b7fb05d67bc2..7612ee9bb6877dea0ff83d03f393180048ff960c 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 350a8194ef52242be6a70a16d2692e17216178fb..47d8ae1eb7edea51a81ddfaef3cd1c4b06ad12a3 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() && !this.player.isPassenger()) { 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 {