Noswing detection for PvP/PvE

This commit is contained in:
Adam committed 2012-05-19 01:44:56 -04:00
1 parent ce19d564e2
commit 376c79f44b
2 files changed
+21

No files matched your search

@@ -152,6 +152,10 @@ public class Anticheat extends JavaPlugin
}
try
{
if(verbose)
{
logger.log(Level.INFO,"[AC] Enabling metrics...");
}
metrics = new Metrics(this);
final EventListener listener = new EventListener();
Graph graph = metrics.createGraph("Hacks blocked");
@@ -170,6 +174,10 @@ public class Anticheat extends JavaPlugin
listener.resetCheck(type);
}
metrics.start();
if(verbose)
{
logger.log(Level.INFO,"[AC] Metrics started.");
}
}
catch (IOException ex)
{
@@ -179,6 +187,10 @@ public class Anticheat extends JavaPlugin
String name = player.getName();
AnticheatManager.PLAYER_MANAGER.setLevel(player, config.getLevel(name));
}
if(verbose)
{
logger.log(Level.INFO,"[AC] Player's levels collected from storage and applied.");
}
}
private void saveFile(String file, String url)
@@ -143,6 +143,15 @@ public class EntityListener extends EventListener
noHack = false;
}
}
if(checkManager.willCheck(player, CheckType.NO_SWING))
{
if(!backend.justAnimated(player))
{
event.setCancelled(true);
log("tried to damage an entity without swinging their arm.",player,CheckType.NO_SWING);
noHack = false;
}
}
if(noHack)
{
decrease(player);