Yatopia/patches/server/0060-Configurable-movement-checks.patch
Ivan Pekov adb131f051
Updated Upstream and Sidestream(s) (Tuinity/EMC/Purpur/AirplaneLite)
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.

Tuinity Changes:
2325c36 Updated Upstream (Paper)

EMC Changes:
a841b5a5 Fix more lore/item name issues (fixes witch gem issue)
1abb3fae Ensure server conversions on ExactChoice ingredients
f2f9d2b0 Forgot to commit paper ref
388620d5 Updated Paper
7a0ae67b Add a null check for UUID to prevent npe later
9de409e0 Updated Paper
0d09eb9a Add new Empire Server API for managing fake players for the tablist

Purpur Changes:
da95725 Updated Upstream (Tuinity)
7194a16 Updated Upstream (Paper)
77373ea Updated Upstream (Tuinity)
0bae78d Drop async advancements patch for now

AirplaneLite Changes:
7b4acbe h != k
a07e80c Whoops, missed paperclip change
845c191 Add license to patch files
fa671b7 Allow gradle wrapper in gitignore
04fc820 Rework strip raytracing patch
f48f6b2 Updated Upstream (Tuinity)
ec7c6df Fix encoding
9326301 Update upstream, fix utf8
20b8c79 Allow gradle wrapper in gitignore
6cd80e9 Updated Upstream (Tuinity)
2021-01-03 13:41:36 +02:00

67 lines
5.6 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/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 687ebda8f3993de460ad3100a0aa7fe648b2582c..74ddd98008490ed10952fe3847e83e51aa464132 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -443,7 +443,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));
@@ -468,7 +468,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;
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved wrongly! {}", entity.getDisplayName().getString(), this.player.getDisplayName().getString(), Math.sqrt(d10));
}
@@ -1165,7 +1165,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);
@@ -1231,7 +1231,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;
PlayerConnection.LOGGER.warn("{} moved wrongly!", this.player.getDisplayName().getString());
}
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
@@ -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);
+ }
}