2020-11-08 18:11:25 +01:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: l_MrBoom_l <admin@epserv.ru>
Date: Sun, 8 Nov 2020 19:07:14 +0200
Subject: [PATCH] Configurable movement checks
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
2021-01-04 09:38:27 +01:00
index 4e343bf4865655020994c40a1c7101afb994a659..bd356f8334936c1c7c1a2961eee9c0cb4d7f77ba 100644
2020-11-08 18:11:25 +01:00
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
2020-12-17 08:48:17 +01:00
@@ -443,7 +443,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
2020-11-08 18:11:25 +01:00
}
// Paper end
- if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isExemptPlayer()) {
2020-12-02 07:35:11 +01:00
+ if (org.yatopiamc.yatopia.server.YatopiaConfig.checkVehicleMovedQuickly && d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isExemptPlayer()) { // Yatopia - Configurable movement checks
2020-11-08 18:11:25 +01:00
// CraftBukkit end
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getDisplayName().getString(), this.player.getDisplayName().getString(), d6, d7, d8);
this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity));
2020-12-17 08:48:17 +01:00
@@ -468,7 +468,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
2020-11-08 18:11:25 +01:00
d10 = d6 * d6 + d7 * d7 + d8 * d8;
boolean flag1 = false;
- if (d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot
2020-12-02 07:35:11 +01:00
+ if (org.yatopiamc.yatopia.server.YatopiaConfig.checkVehicleMovedWrongly && d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot // Yatopia - Configurable movement checks
2020-11-08 18:11:25 +01:00
flag1 = true;
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved wrongly! {}", entity.getDisplayName().getString(), this.player.getDisplayName().getString(), Math.sqrt(d10));
}
2020-12-24 08:14:21 +01:00
@@ -1165,7 +1165,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
2020-11-08 18:11:25 +01:00
if (!this.player.H() && (!this.player.getWorldServer().getGameRules().getBoolean(GameRules.DISABLE_ELYTRA_MOVEMENT_CHECK) || !this.player.isGliding())) {
float f2 = this.player.isGliding() ? 300.0F : 100.0F;
- if (d11 - d10 > Math.max(f2, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isExemptPlayer()) {
2020-12-02 07:35:11 +01:00
+ if (org.yatopiamc.yatopia.server.YatopiaConfig.checkMovedQuickly && d11 - d10 > Math.max(f2, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isExemptPlayer()) { // Yatopia - Configurable movement checks
2020-11-08 18:11:25 +01:00
// CraftBukkit end
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getDisplayName().getString(), d7, d8, d9);
this.a(this.player.locX(), this.player.locY(), this.player.locZ(), this.player.yaw, this.player.pitch);
2020-12-24 08:14:21 +01:00
@@ -1231,7 +1231,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
2020-11-08 18:11:25 +01:00
d11 = d7 * d7 + d8 * d8 + d9 * d9;
boolean flag1 = false;
- if (!this.player.H() && d11 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative() && this.player.playerInteractManager.getGameMode() != EnumGamemode.SPECTATOR) { // Spigot
2020-12-02 07:35:11 +01:00
+ if (org.yatopiamc.yatopia.server.YatopiaConfig.checkMovedWrongly && !this.player.H() && d11 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative() && this.player.playerInteractManager.getGameMode() != EnumGamemode.SPECTATOR) { // Spigot // Yatopia - Configurable movement checks
2020-11-08 18:11:25 +01:00
flag1 = true;
PlayerConnection.LOGGER.warn("{} moved wrongly!", this.player.getDisplayName().getString());
}
2020-12-02 07:35:11 +01:00
diff --git a/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java b/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
index 4f99aa4b578333795296da2424f38aae65a808a3..34b5a087d1d5d84b193adbd756add060a2d49354 100644
--- a/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
+++ b/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
2020-11-08 18:11:25 +01:00
@@ -272,4 +272,15 @@ public class YatopiaConfig {
private static void fireBlockPhysicsEvent() {
fireBlockPhysicsEvent = getBoolean("settings.fire-block-physics-event", true);
}
+
+ public static boolean checkMovedQuickly = true;
+ public static boolean checkMovedWrongly = true;
+ public static boolean checkVehicleMovedQuickly = true;
+ public static boolean checkVehicleMovedWrongly = true;
+ private static void movementChecks() {
+ checkMovedQuickly = getBoolean("settings.checks.moved-quickly", checkMovedQuickly);
+ checkMovedWrongly = getBoolean("settings.checks.moved-wrongly", checkMovedWrongly);
+ checkVehicleMovedQuickly = getBoolean("settings.checks.vehicle-moved-quickly", checkVehicleMovedQuickly);
+ checkVehicleMovedWrongly = getBoolean("settings.checks.vehicle-moved-wrongly", checkVehicleMovedWrongly);
+ }
}