Commits

md_5 authored f6feaaae5b0
SPIGOT-2090: Change how move wrongly threshold is applied
No tags

CraftBukkit-Patches/0122-Make-moved-wrongly-limit-configurable.patch

Modified
1 -From e514ce79248348349836a7c4a6e4f7cc97d9ac28 Mon Sep 17 00:00:00 2001
1 +From 0c844271f72f32c031984aad7af9712130fe313e Mon Sep 17 00:00:00 2001
2 2 From: Jonas Konrad <me@yawk.at>
3 3 Date: Fri, 4 Jul 2014 23:03:13 +0200
4 4 Subject: [PATCH] Make "moved wrongly" limit configurable
5 5
6 6
7 7 diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
8 -index f354985..f2963ca 100644
8 +index fcff4ac..2f5c1a9 100644
9 9 --- a/src/main/java/net/minecraft/server/PlayerConnection.java
10 10 +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
11 -@@ -338,13 +338,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
11 +@@ -338,7 +338,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
12 12 d10 = d6 * d6 + d7 * d7 + d8 * d8;
13 13 boolean flag1 = false;
14 14
15 15 - if (d10 > 0.0625D) {
16 16 + if (d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot
17 17 flag1 = true;
18 18 PlayerConnection.LOGGER.warn(entity.getName() + " moved wrongly!");
19 19 }
20 -
21 - entity.setLocation(d3, d4, d5, f, f1);
22 -- boolean flag2 = worldserver.getCubes(entity, entity.getBoundingBox().shrink(0.0625D)).isEmpty();
23 -+ boolean flag2 = worldserver.getCubes(entity, entity.getBoundingBox().shrink(org.spigotmc.SpigotConfig.movedWronglyThreshold)).isEmpty(); // Spigot
24 -
25 - if (flag && (flag1 || !flag2)) {
26 - entity.setLocation(d0, d1, d2, f, f1);
27 20 @@ -553,7 +553,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
28 21 d11 = d7 * d7 + d8 * d8 + d9 * d9;
29 22 boolean flag1 = false;
30 23
31 24 - if (!this.player.K() && d11 > 0.0625D && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative() && this.player.playerInteractManager.getGameMode() != WorldSettings.EnumGamemode.SPECTATOR) {
32 25 + if (!this.player.K() && d11 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative() && this.player.playerInteractManager.getGameMode() != WorldSettings.EnumGamemode.SPECTATOR) { // Spigot
33 26 flag1 = true;
34 27 PlayerConnection.LOGGER.warn(this.player.getName() + " moved wrongly!");
35 28 }
36 -@@ -561,7 +561,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
37 - this.player.setLocation(d4, d5, d6, f, f1);
38 - this.player.checkMovement(this.player.locX - d0, this.player.locY - d1, this.player.locZ - d2);
39 - if (!this.player.noclip && !this.player.isSleeping()) {
40 -- boolean flag2 = worldserver.getCubes(this.player, this.player.getBoundingBox().shrink(0.0625D)).isEmpty();
41 -+ boolean flag2 = worldserver.getCubes(this.player, this.player.getBoundingBox().shrink(org.spigotmc.SpigotConfig.movedWronglyThreshold)).isEmpty(); // Spigot
42 -
43 - if (flag && (flag1 || !flag2)) {
44 - this.a(d0, d1, d2, f, f1);
45 29 diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
46 30 index 921d7d5..7e774f2 100644
47 31 --- a/src/main/java/org/spigotmc/SpigotConfig.java
48 32 +++ b/src/main/java/org/spigotmc/SpigotConfig.java
49 33 @@ -334,4 +334,10 @@ public class SpigotConfig
50 34 {
51 35 intCacheLimit = getInt( "settings.int-cache-limit", 1024 );
52 36 }
53 37 +
54 38 + public static double movedWronglyThreshold;

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut