From 033cebf7cb97b55247a60aa8c1f798d23d6bfdd6 Mon Sep 17 00:00:00 2001 From: asofold Date: Fri, 19 Oct 2012 12:00:38 +0200 Subject: [PATCH] Move PlayeRMove from combined to moving (still feeds combined/yawrate). --- .../checks/combined/CombinedListener.java | 15 ------------ .../checks/moving/MovingListener.java | 23 ++++++++++++++++++- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/fr/neatmonster/nocheatplus/checks/combined/CombinedListener.java b/src/fr/neatmonster/nocheatplus/checks/combined/CombinedListener.java index 4696f9fb..ac5d8d8c 100644 --- a/src/fr/neatmonster/nocheatplus/checks/combined/CombinedListener.java +++ b/src/fr/neatmonster/nocheatplus/checks/combined/CombinedListener.java @@ -2,7 +2,6 @@ package fr.neatmonster.nocheatplus.checks.combined; import net.minecraft.server.EntityPlayer; -import org.bukkit.Location; import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -12,7 +11,6 @@ import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.event.player.PlayerToggleSprintEvent; @@ -31,19 +29,6 @@ public class CombinedListener implements Listener { this.improbable = new Improbable(); } - @EventHandler(priority=EventPriority.MONITOR, ignoreCancelled = false) - public final void onPlayerMove(final PlayerMoveEvent event){ - final long now = System.currentTimeMillis(); - final Player player = event.getPlayer(); - - final Location loc = event.getTo(); // player.getLocation(); - final String worldName = loc.getWorld().getName(); - final CombinedData data = CombinedData.getData(player); - data.lastMoveTime = now; - // Just add the yaw to the list. - Combined.feedYawRate(player, loc.getYaw(), now, worldName, data); - } - /** * We listen to this event to prevent players from leaving while falling, so from avoiding fall damages. * diff --git a/src/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java b/src/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java index 4642d383..065ad99f 100644 --- a/src/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java +++ b/src/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java @@ -32,6 +32,8 @@ import org.bukkit.util.Vector; import fr.neatmonster.nocheatplus.NoCheatPlus; import fr.neatmonster.nocheatplus.checks.CheckType; +import fr.neatmonster.nocheatplus.checks.combined.Combined; +import fr.neatmonster.nocheatplus.checks.combined.CombinedData; import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager; import fr.neatmonster.nocheatplus.players.Permissions; import fr.neatmonster.nocheatplus.utilities.BlockProperties; @@ -298,7 +300,8 @@ public class MovingListener implements Listener { } /** - * When a player moves, he will be checked for various suspicious behaviors. + * When a player moves, he will be checked for various suspicious behaviors.
+ * (lowest priority) * * @param event * the event @@ -446,6 +449,24 @@ public class MovingListener implements Listener { event.setCancelled(false); event.setTo(event.getFrom().clone()); } + + /** + * Monitor level PlayerMoveEvent. + * @param event + */ + @EventHandler(priority=EventPriority.MONITOR, ignoreCancelled = false) + public final void onPlayerMoveMonitor(final PlayerMoveEvent event){ + final long now = System.currentTimeMillis(); + final Player player = event.getPlayer(); + final Location loc = event.getTo(); // player.getLocation(); + final String worldName = loc.getWorld().getName(); + + // Feed combined check. + final CombinedData data = CombinedData.getData(player); + data.lastMoveTime = now; + // Just add the yaw to the list. + Combined.feedYawRate(player, loc.getYaw(), now, worldName, data); + } /** * When a player uses a portal, all information related to the moving checks becomes invalid.