Files
MiraiMC/patches/server/0023-Configurable-flight-checks.patch
2022-08-23 10:36:35 +02:00

50 lines
3.5 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 22c053d0c730e6d82acc556f08eedcd3c21d1877..bf51b61bfb71ff8726da2282610e4e1f8d156227 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -373,7 +373,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
++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;
@@ -392,7 +392,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
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 b2b986166367ff9bd13320329c96a8c559dd1f1a..f8b725fc9615a1540de38b425fea95f545cc4a18 100644
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
@@ -144,4 +144,13 @@ public class MiraiConfig {
"Allowing more bees in a hive can reduce the number of ticking hives.");
}
+ public static boolean checkFlying;
+ public static boolean checkVehicleFlying;
+ private static void flightChecks() {
+ checkFlying = getBoolean("checks.flight", true,
+ "Whether or not vanilla anticheat should check for players flying.");
+ checkVehicleFlying = getBoolean("checks.vehicle-flight", true,
+ "Whether or not vanilla anticheat should check for passengers flying.");
+ }
+
}
\ No newline at end of file