Quick fix for alt-freeze exploit, more soon.

This commit is contained in:
h31ix committed 2012-12-16 16:40:08 -05:00
1 parent c76b462199
commit 32a762298f
2 files changed
+27 -3

No files matched your search

@@ -292,7 +292,11 @@ public class PlayerListener extends EventListener
Distance distance = new Distance(from, to);
double y = distance.getYDifference();
backend.logAscension(player, from.getY(), to.getY());
if (checkManager.willCheck(player, CheckType.SPEED) && backend.checkFreeze(player, from.getY(), to.getY()))
{
player.kickPlayer("Freezing client");
log("tried to freeze in mid-air.", player, CheckType.SPEED);
}
if (checkManager.willCheck(player, CheckType.SPRINT))
{
if (backend.checkSprintStill(player, from, to))
@@ -92,6 +92,7 @@ public class Backend
private Map<String, Integer> steps = new HashMap<String, Integer>();
private Map<String, Long> stepTime = new HashMap<String, Long>();
private HashSet<Byte> transparent = new HashSet<Byte>();
private Map<String, Long> lastFallPacket = new HashMap<String, Long>();
private Magic magic;
private AnticheatManager micromanage = null;
@@ -166,6 +167,25 @@ public class Backend
inventoryTime.remove(pN);
inventoryChanges.remove(pN);
}
public boolean checkFreeze(Player player, double from, double to)
{
if((from-to) > 0)
{
boolean flag = false;
if(lastFallPacket.containsKey(player.getName()) && lastFallPacket.get(player.getName()) > 0)
{
flag = (System.currentTimeMillis()-lastFallPacket.get(player.getName())) > 1000;
}
lastFallPacket.put(player.getName(), System.currentTimeMillis());
return flag;
}
else
{
lastFallPacket.put(player.getName(), -1L);
}
return false;
}
public boolean checkFastBow(Player player, float force)
{
@@ -705,7 +725,7 @@ public class Backend
}
else
{
isAscending.remove(player.getName());
isAscending.remove(name);
}
}
@@ -1193,7 +1213,7 @@ public class Backend
public boolean isAscending(Player player)
{
return isAscending.contains(player.getName());
}
}
public boolean isSpeedExempt(Player player)
{