spigot/CraftBukkit-Patches/0074-Make-moved-too-quickly-limit-configurable.patch
2021-06-15 18:31:13 +10:00

46 lines
3 KiB
Diff

From 92ac4df7b7dbe911627c23dc2970a72c82e81763 Mon Sep 17 00:00:00 2001
From: Jonas Konrad <me@yawk.at>
Date: Tue, 22 Jul 2014 15:59:01 +0200
Subject: [PATCH] Make "moved too quickly" limit configurable
diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java
index de588a6fa..590da3da0 100644
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
@@ -521,7 +521,7 @@ public class PlayerConnection implements ServerPlayerConnection, PacketListenerP
}
speed *= 2f; // TODO: Get the speed of the vehicle instead of the player
- if (d10 - d9 > Math.max(100.0D, Math.pow((double) (10.0F * (float) i * speed), 2)) && !this.isExemptPlayer()) {
+ if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isExemptPlayer()) {
// CraftBukkit end
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getDisplayName().getString(), this.player.getDisplayName().getString(), d6, d7, d8);
this.connection.sendPacket(new PacketPlayOutVehicleMove(entity));
@@ -1171,7 +1171,7 @@ public class PlayerConnection implements ServerPlayerConnection, PacketListenerP
if (!this.player.H() && (!this.player.getWorldServer().getGameRules().getBoolean(GameRules.RULE_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) (10.0F * (float) i * speed), 2)) && !this.isExemptPlayer()) {
+ if (d11 - d10 > Math.max(f2, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isExemptPlayer()) {
// CraftBukkit end
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getDisplayName().getString(), d7, d8, d9);
this.b(this.player.locX(), this.player.locY(), this.player.locZ(), this.player.getYRot(), this.player.getXRot());
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index e2a95702a..1c156ab24 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -332,4 +332,10 @@ public class SpigotConfig
{
movedWronglyThreshold = getDouble( "settings.moved-wrongly-threshold", 0.0625D );
}
+
+ public static double movedTooQuicklyMultiplier;
+ private static void movedTooQuicklyMultiplier()
+ {
+ movedTooQuicklyMultiplier = getDouble( "settings.moved-too-quickly-multiplier", 10.0D );
+ }
}
--
2.25.1