mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 22:15:28 +00:00
Check for sprinting while standing still
This commit is contained in:
1 parent
69f58e08e1
commit
2fc17b87ca
4 files changed
+18
-3
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* 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
|
* 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
|
* 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();
|
Player player = event.getPlayer();
|
||||||
if (checkManager.willCheck(player, CheckType.SPRINT))
|
if (checkManager.willCheck(player, CheckType.SPRINT))
|
||||||
{
|
{
|
||||||
if (backend.checkSprint(event))
|
if (backend.checkSprintHungry(event))
|
||||||
{
|
{
|
||||||
event.setCancelled(!config.silentMode());
|
event.setCancelled(!config.silentMode());
|
||||||
log("tried to sprint while hungry.", player, CheckType.SPRINT);
|
log("tried to sprint while hungry.", player, CheckType.SPRINT);
|
||||||
@@ -293,6 +293,14 @@ public class PlayerListener extends EventListener
|
|||||||
double y = distance.getYDifference();
|
double y = distance.getYDifference();
|
||||||
backend.logAscension(player, from.getY(), to.getY());
|
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 (checkManager.willCheck(player, CheckType.FLY) && !player.isFlying() && checkManager.willCheck(player, CheckType.ZOMBE_FLY) && backend.checkFlight(player, distance))
|
||||||
{
|
{
|
||||||
if (!config.silentMode())
|
if (!config.silentMode())
|
||||||
|
|||||||
@@ -340,7 +340,7 @@ public class Backend
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkSprint(PlayerToggleSprintEvent event)
|
public boolean checkSprintHungry(PlayerToggleSprintEvent event)
|
||||||
{
|
{
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (event.isSprinting())
|
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)
|
public boolean checkWaterWalk(Player player, double x, double y, double z)
|
||||||
{
|
{
|
||||||
Block block = player.getLocation().getBlock();
|
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;
|
package net.h31ix.anticheat.util;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|||||||
Reference in new issue
Block a user