Yatopia/patches/server/0051-Configurable-movement-checks.patch
Simon Gardling 76a75f866b
upstream (#455)
* Updated Upstream and Sidestream(s) (Paper)

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:
d15161114 [Auto] Updated Upstream (Spigot)
e8889e96a [Auto] Updated Upstream (CraftBukkit)
3bc888ba6 [Auto] Updated Upstream (CraftBukkit)

* Updated Upstream and Sidestream(s) (Paper)

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:
3fea87edb [Auto] Updated Upstream (CraftBukkit)
a111b1365 Send post ChatEvent messages as MessageType.CHAT

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

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:
3db3aaf39 [Auto] Updated Upstream (CraftBukkit)
c953e51dd [Auto] Updated Upstream (CraftBukkit/Spigot)
dc529c7a9 Fix PlayerEditBookEvent (#5463)

Tuinity Changes:
a0aa5ab Do not load 1 radius neighbours for lighting
5ccfa52 Fix terrible patch times
af53d70 Stop large move vectors in player packet handling from killing the server
6e56ee7 Fix OBFHELPER for flushHeader in RegionFile
995d05c Do not update TE's in generating chunks

Purpur Changes:
2e66f83 [ci-skip] Fix typo
6cbe4fc Change Logo Tuinity to Purpur
5e89d23 Updated Upstream (Paper & Airplane)

* Updated Upstream and Sidestream(s) (Paper)

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:
304a216ba [CI-SKIP] Ignore gitignore when adding files in automation
d8e384a16 [CI-SKIP] Drop `Allow PlayerEditBookEvent to fire for off hand` (#5471)

* fix kotlin-stdlib dependency

* update dependencies

* how did that happen...

* Updated Upstream and Sidestream(s) (Paper)

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:
de138fac4 [Auto] Updated Upstream (Bukkit)

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

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:
4492bc4cc remove l4j class no longer in existence from preload list
be1370517 Updated Upstream (CraftBukkit) (#5484)
d560151ec Bump mysql-connector-java to 8.0.23 (Fixes #5473) (#5474)
61f400f11 Update log4j to 2.11.2 for JDK 9+ compat (#5400)
a98196585 Updated Upstream (Bukkit/CraftBukkit)

Tuinity Changes:
d5261ad Do not load chunks for getCubes by default
da9cf98 Don't read neighbour chunk data off disk when converting chunks

Airplane Changes:
8de8e82 Updated Upstream (Tuinity)
2021-04-12 13:27:14 -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 b3bb63559add154888b5e19f2304b5e4a8a9eacc..b7624400644ae25b9316c2f1f7bcf0e436fbb3cb 100644
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
@@ -604,7 +604,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));
@@ -631,7 +631,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));
}
@@ -1385,7 +1385,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);
@@ -1451,7 +1451,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);
+ }
}