mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-12-30 20:37:52 +01:00
Move PlayeRMove from combined to moving (still feeds combined/yawrate).
This commit is contained in:
parent
b08282d925
commit
033cebf7cb
@ -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.
|
||||
*
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user