Move PlayeRMove from combined to moving (still feeds combined/yawrate).

This commit is contained in:
asofold 2012-10-19 12:00:38 +02:00
parent b08282d925
commit 033cebf7cb
2 changed files with 22 additions and 16 deletions

View File

@ -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.
*

View File

@ -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.<br>
* (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.