Check for sprinting while standing still

This commit is contained in:
h31ix committed 2012-12-15 21:02:45 -05:00
1 parent 69f58e08e1
commit 2fc17b87ca
4 files changed
+18 -3

No files matched your search

@@ -1,6 +1,6 @@
/*
* AntiCheat for Bukkit.
* Copyright (C) 2012 H31IX http://gravitydevelopment.net
* Copyright (C) 2012 AntiCheat Team | http://gravitydevelopment.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -178,7 +178,7 @@ public class PlayerListener extends EventListener
Player player = event.getPlayer();
if (checkManager.willCheck(player, CheckType.SPRINT))
{
if (backend.checkSprint(event))
if (backend.checkSprintHungry(event))
{
event.setCancelled(!config.silentMode());
log("tried to sprint while hungry.", player, CheckType.SPRINT);
@@ -293,6 +293,14 @@ public class PlayerListener extends EventListener
double y = distance.getYDifference();
backend.logAscension(player, from.getY(), to.getY());
if (checkManager.willCheck(player, CheckType.SPRINT))
{
if (backend.checkSprintStill(player, from, to))
{
event.setCancelled(!config.silentMode());
log("tried to sprint while standing still.", player, CheckType.SPRINT);
}
}
if (checkManager.willCheck(player, CheckType.FLY) && !player.isFlying() && checkManager.willCheck(player, CheckType.ZOMBE_FLY) && backend.checkFlight(player, distance))
{
if (!config.silentMode())
@@ -340,7 +340,7 @@ public class Backend
}
}
public boolean checkSprint(PlayerToggleSprintEvent event)
public boolean checkSprintHungry(PlayerToggleSprintEvent event)
{
Player player = event.getPlayer();
if (event.isSprinting())
@@ -353,6 +353,11 @@ public class Backend
}
}
public boolean checkSprintStill(Player player, Location from, Location to)
{
return player.isSprinting() && from.getX() == to.getX() && from.getZ() == to.getZ();
}
public boolean checkWaterWalk(Player player, double x, double y, double z)
{
Block block = player.getLocation().getBlock();
@@ -1,3 +1,5 @@
// Not production code yet. Still experimental and needs a lot of work.
package net.h31ix.anticheat.util;
import org.bukkit.ChatColor;