48 lines
3.3 KiB
Diff
48 lines
3.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: l_MrBoom_l <admin@epserv.ru>
|
|
Date: Wed, 30 Sep 2020 18:20:12 +0300
|
|
Subject: [PATCH] Configurable flight checks
|
|
|
|
Original code by YatopiaMC, licensed under MIT
|
|
You can find the original code on https://github.com/YatopiaMC/Yatopia
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index ab084c7590ff777889dccbbb821bb099cdd7e215..1329314774a15be493703dac0031e8849865295f 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -342,7 +342,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
|
++this.tickCount;
|
|
this.knownMovePacketCount = this.receivedMovePacketCount;
|
|
if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger()) {
|
|
- if (++this.aboveGroundTickCount > 80) {
|
|
+ if (wtf.etil.mirai.MiraiConfig.checkFlying && ++this.aboveGroundTickCount > 80) { // Yatopia - Configurable flight checks
|
|
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString());
|
|
this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingPlayer, org.bukkit.event.player.PlayerKickEvent.Cause.FLYING_PLAYER); // Paper - use configurable kick message & kick event cause
|
|
return;
|
|
@@ -361,7 +361,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
|
this.vehicleLastGoodY = this.lastVehicle.getY();
|
|
this.vehicleLastGoodZ = this.lastVehicle.getZ();
|
|
if (this.clientVehicleIsFloating && this.player.getRootVehicle().getControllingPassenger() == this.player) {
|
|
- if (++this.aboveGroundVehicleTickCount > 80) {
|
|
+ if (wtf.etil.mirai.MiraiConfig.checkVehicleFlying && ++this.aboveGroundVehicleTickCount > 80) { // Yatopia - Configurable flight checks
|
|
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString());
|
|
this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingVehicle, org.bukkit.event.player.PlayerKickEvent.Cause.FLYING_VEHICLE); // Paper - use configurable kick message & kick event cause
|
|
return;
|
|
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
|
index 667eaabe95e9b44cad64dd5aba5ac693f4d726ed..8740dbbc4068ad329eb53ee13683a77903fe6d02 100644
|
|
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
|
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
|
@@ -194,4 +194,11 @@ public class MiraiConfig {
|
|
maxBees = getInt("max-bees-in-hive", maxBees);
|
|
}
|
|
|
|
+ public static boolean checkFlying = true;
|
|
+ public static boolean checkVehicleFlying = true;
|
|
+ private static void flightChecks() {
|
|
+ checkFlying = getBoolean("checks.flight", checkFlying);
|
|
+ checkVehicleFlying = getBoolean("checks.vehicle-flight", checkVehicleFlying);
|
|
+ }
|
|
+
|
|
}
|
|
\ No newline at end of file
|