Yatopia/patches/server/0051-Configurable-movement-checks.patch
Simon Gardling c1a03b89af
Upstream (#469)
* Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Empirecraft)

Upstream/An Sidestream has released updates that appears to apply and compile correctly
This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing.

Paper Changes:
fbae9dbe0 [Auto] Updated Upstream (Bukkit/CraftBukkit)
ac4a33aab [Auto] Updated Upstream (Bukkit)
c1e07158b [Auto] Updated Upstream (Bukkit/CraftBukkit)
5e4b88e95 Fix dangling sout
23afda179 basic hostname validation
0fb8bdf0e Updated Upstream (Bukkit/CraftBukkit) (#5508)
88ab784da [Auto] Updated Upstream (CraftBukkit)
ca7111d5f Fix PlayerItemConsumeEvent cancelling (fixes #4682) (#5383)
06fb560dc Add support for tab completing and highlighting console input from the Brigadier command tree (#5437)
0a9b89c7a Fix occasional light gen issues for neighbor blocks (#5500)
a08be1ec7 [Auto] Updated Upstream (CraftBukkit)

Tuinity Changes:
7d36676 Fix light source locking
f1ec0c2 Add concurrency check to ProtoChunk light sources
159d146 Improvements to chunk loader system

Airplane Changes:
3b3cde7 Correctly use DEAR values, fix config reloading
dd60919 Updated Upstream (Tuinity)

Purpur Changes:
5674cdc Updated Upstream (Paper)

Empirecraft Changes:
efda8c5b Updated Paper

* Updated Upstream and Sidestream(s) (Paper/Tuinity)

Upstream/An Sidestream has released updates that appears to apply and compile correctly
This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing.

Paper Changes:
39bf5b525 Update teams known as code owners

Tuinity Changes:
b12d0cc Replace ticket level propagator
42df8e1 Correctly handle recursion for chunkholder updates
73eb2a8 Do not copy visible chunks
8a4f3be Do not schedule poi task for each block write on chunk gen

* Multithreaded Entity Tracker fixup
2021-04-21 17:26:49 -04:00

67 lines
5.7 KiB
Diff

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/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java
index 8bdea98d5519938d5da30cd603e6f6d828bed52c..85723157af127a334cb7a65effd2becc42f7d370 100644
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
@@ -606,7 +606,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
}
// Paper end
- if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isExemptPlayer()) {
+ 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
// 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));
@@ -633,7 +633,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
d10 = d6 * d6 + d7 * d7 + d8 * d8;
boolean flag1 = false;
- if (d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot
+ if (org.yatopiamc.yatopia.server.YatopiaConfig.checkVehicleMovedWrongly && d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot // Yatopia - Configurable movement checks
flag1 = true; // Tuinity - diff on change, this should be moved wrongly
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved wrongly! {}", entity.getDisplayName().getString(), this.player.getDisplayName().getString(), Math.sqrt(d10));
}
@@ -1387,7 +1387,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
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()) {
+ 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
// 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);
@@ -1453,7 +1453,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
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
+ 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
flag1 = true; // Tuinity - diff on change, this should be moved wrongly
PlayerConnection.LOGGER.warn("{} moved wrongly! ({})", this.player.getDisplayName().getString(), d11); // Purpur
}
diff --git a/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java b/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
index 4d6410401457afe91457ae72df14bf687e9c62fd..78decc9c7483f42acb65f342f12fc1d644440822 100644
--- a/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
+++ b/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
@@ -249,4 +249,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);
+ }
}