Make "moved too quickly" limit configurable

By: Jonas Konrad <me@yawk.at>
This commit is contained in:
CraftBukkit/Spigot 2014-07-22 15:59:01 +02:00
parent 7b951a7ec6
commit f972379105
2 changed files with 8 additions and 2 deletions

View file

@ -217,7 +217,7 @@
+ }
+ 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.isSingleplayerOwner()) {
+ if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
+ // CraftBukkit end
ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8});
this.send(ClientboundMoveVehiclePacket.fromEntity(entity));
@ -452,7 +452,7 @@
float f2 = flag ? 300.0F : 100.0F;
- if (d10 - d9 > (double) (f2 * (float) i)) {
+ if (d10 - d9 > Math.max(f2, Math.pow((double) (10.0F * (float) i * speed), 2))) {
+ if (d10 - d9 > Math.max(f2, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2))) {
+ // CraftBukkit end
ServerGamePacketListenerImpl.LOGGER.warn("{} moved too quickly! {},{},{}", new Object[]{this.player.getName().getString(), d6, d7, d8});
this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot());

View file

@ -332,4 +332,10 @@ public class SpigotConfig
{
SpigotConfig.movedWronglyThreshold = SpigotConfig.getDouble( "settings.moved-wrongly-threshold", 0.0625D );
}
public static double movedTooQuicklyMultiplier;
private static void movedTooQuicklyMultiplier()
{
SpigotConfig.movedTooQuicklyMultiplier = SpigotConfig.getDouble( "settings.moved-too-quickly-multiplier", 10.0D );
}
}