diff --git a/src/fr/neatmonster/nocheatplus/checks/moving/CreativeFly.java b/src/fr/neatmonster/nocheatplus/checks/moving/CreativeFly.java index 6cccb420..6d689f4a 100644 --- a/src/fr/neatmonster/nocheatplus/checks/moving/CreativeFly.java +++ b/src/fr/neatmonster/nocheatplus/checks/moving/CreativeFly.java @@ -56,9 +56,9 @@ public class CreativeFly extends Check { * the to * @return the location */ - public Location check(final Player player, final PlayerLocation from, final PlayerLocation to) { - final MovingConfig cc = MovingConfig.getConfig(player); - final MovingData data = MovingData.getData(player); + public Location check(final Player player, final MovingData data, final MovingConfig cc) { + final PlayerLocation from = data.from; + final PlayerLocation to = data.to; // If we have no setback, define one now. if (data.setBack == null) diff --git a/src/fr/neatmonster/nocheatplus/checks/moving/MorePackets.java b/src/fr/neatmonster/nocheatplus/checks/moving/MorePackets.java index d53294a4..19ae5111 100644 --- a/src/fr/neatmonster/nocheatplus/checks/moving/MorePackets.java +++ b/src/fr/neatmonster/nocheatplus/checks/moving/MorePackets.java @@ -60,11 +60,12 @@ public class MorePackets extends Check { * the to * @return the location */ - public Location check(final Player player, final PlayerLocation from, final PlayerLocation to) { + public Location check(final Player player, final MovingData data, final MovingConfig cc) { + final PlayerLocation from = data.from; + final PlayerLocation to = data.to; // Take time once, first: final long time = System.currentTimeMillis(); - final MovingData data = MovingData.getData(player); Location newTo = null; diff --git a/src/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java b/src/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java index da5b3505..56304e3a 100644 --- a/src/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java +++ b/src/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java @@ -324,6 +324,7 @@ public class MovingListener implements Listener { return; final MovingData data = MovingData.getData(player); + final MovingConfig cc = MovingConfig.getConfig(player); // Just try to estimate velocities over time. Not very precise, but works good enough most of the time. Do // general data modifications one for each event. @@ -351,21 +352,21 @@ public class MovingListener implements Listener { if ((player.getGameMode() == GameMode.CREATIVE || player.getAllowFlight()) && creativeFly.isEnabled(player)) // If the player is handled by the creative fly check, execute it. - newTo = creativeFly.check(player, data.from, data.to); + newTo = creativeFly.check(player, data, cc); else if (survivalFly.isEnabled(player)) { // If he is handled by the survival fly check, execute it. - newTo = survivalFly.check(player, data.from, data.to); + newTo = survivalFly.check(player, data, cc); // If don't have a new location and if he is handled by the no fall check, execute it. if (newTo == null && noFall.isEnabled(player)) // NOTE: noFall might set yOnGround for the positions. - noFall.check(player, data.from, data.to); + noFall.check(player, data, cc); } else // He isn't handled by any fly check, clear his data. data.clearFlyData(); if (newTo == null && morePackets.isEnabled(player)) // If he hasn't been stopped by any other check and is handled by the more packets check, execute it. - newTo = morePackets.check(player, data.from, data.to); + newTo = morePackets.check(player, data, cc); else // Otherwise we need to clear his data. data.clearMorePacketsData(); diff --git a/src/fr/neatmonster/nocheatplus/checks/moving/NoFall.java b/src/fr/neatmonster/nocheatplus/checks/moving/NoFall.java index 68f4814f..b6da10f9 100644 --- a/src/fr/neatmonster/nocheatplus/checks/moving/NoFall.java +++ b/src/fr/neatmonster/nocheatplus/checks/moving/NoFall.java @@ -46,10 +46,10 @@ public class NoFall extends Check { * @param to * the to */ - public void check(final Player player, final PlayerLocation from, final PlayerLocation to) { - final MovingConfig cc = MovingConfig.getConfig(player); - final MovingData data = MovingData.getData(player); - + public void check(final Player player, final MovingData data, final MovingConfig cc) { + final PlayerLocation from = data.from; + final PlayerLocation to = data.to; + if (from.getY() > to.getY()){ // Reset the on ground properties only if necessary. if (from.getyOnGround() != cc.noFallyOnGround && (from.getY() - (double) Location.locToBlock(from.getY()) < cc.noFallyOnGround)) diff --git a/src/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java b/src/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java index 8dc9971f..8d050ae5 100644 --- a/src/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java +++ b/src/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java @@ -77,9 +77,9 @@ public class SurvivalFly extends Check { * the to * @return the location */ - public Location check(final Player player, final PlayerLocation from, final PlayerLocation to) { - final MovingConfig cc = MovingConfig.getConfig(player); - final MovingData data = MovingData.getData(player); + public Location check(final Player player, final MovingData data, final MovingConfig cc) { + final PlayerLocation from = data.from; + final PlayerLocation to = data.to; // A player is considered sprinting if the flag is set and if he has enough food level. final boolean sprinting = player.isSprinting() && player.getFoodLevel() > 5;