From 66f6d2d072c7858c443a3e7c3f7726cd82e6eea6 Mon Sep 17 00:00:00 2001 From: asofold Date: Sun, 30 Sep 2012 16:12:25 +0200 Subject: [PATCH] Completely bind yawrate check to angle check (includes exemption). --- .../checks/fight/FightListener.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/fr/neatmonster/nocheatplus/checks/fight/FightListener.java b/src/fr/neatmonster/nocheatplus/checks/fight/FightListener.java index 2c51827c..5f1a23eb 100644 --- a/src/fr/neatmonster/nocheatplus/checks/fight/FightListener.java +++ b/src/fr/neatmonster/nocheatplus/checks/fight/FightListener.java @@ -121,11 +121,6 @@ public class FightListener implements Listener { final long now = System.currentTimeMillis(); final boolean worldChanged = !worldName.equals(data.lastWorld); - - // Improbable yaw: - if (Combined.checkYawRate(player, player.getLocation().getYaw(), now, worldName, cc.yawRateCheck && !player.hasPermission(Permissions.FIGHT_ANGLE))){ - cancelled = true; - } // Get the attacked entity. final net.minecraft.server.Entity damaged = ((CraftEntity) cbEntity).getHandle(); @@ -140,8 +135,19 @@ public class FightListener implements Listener { } - if (!cancelled && angle.isEnabled(player) && angle.check(player, worldChanged)) - cancelled = true; + if (!cancelled && angle.isEnabled(player)){ + // Improbable yaw. + if (Combined.checkYawRate(player, player.getLocation().getYaw(), now, worldName, cc.yawRateCheck)){ + // (Check or just feed). + cancelled = true; + } + // Angle check. + if (angle.check(player, worldChanged)) cancelled = true; + } + else{ + // Always feed yaw rate here. + Combined.feedYawRate(player, player.getLocation().getYaw(), now, worldName); + } if (!cancelled && critical.isEnabled(player) && critical.check(player)) cancelled = true;