mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 14:38:45 +00:00
A bit better fly protection, this allows us to relax some of the limits on walking/running etc.
This commit is contained in:
1 parent
b1d37ecdfd
commit
6188216f97
3 files changed
+59
-4
No files matched your search
@@ -0,0 +1,38 @@
|
||||
package net.h31ix.anticheat.manage;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class FlyManager {
|
||||
public Map<Player,Integer> y = new HashMap<Player,Integer>();
|
||||
public Map<Player,Integer> yvl = new HashMap<Player,Integer>();
|
||||
|
||||
public FlyManager()
|
||||
{
|
||||
}
|
||||
|
||||
public boolean checkFly(Player player)
|
||||
{
|
||||
//Sometimes a player's y drop is 0 when they reach the peak of their jump
|
||||
//To combat false positives, the player must have 4 y values of 0 in a row to trigger.
|
||||
if(yvl.get(player) == null)
|
||||
{
|
||||
yvl.put(player,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
yvl.put(player,yvl.get(player)+1);
|
||||
}
|
||||
if(yvl.get(player) >= 4)
|
||||
{
|
||||
yvl.put(player,1);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user