mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 22:15:28 +00:00
Re-add timer check for testing
This commit is contained in:
1 parent
2fc17b87ca
commit
38deac94d4
3 files changed
+18
-8
No files matched your search
@@ -88,6 +88,8 @@ public class Backend
|
|||||||
private Map<String, Long> inventoryTime = new HashMap<String, Long>();
|
private Map<String, Long> inventoryTime = new HashMap<String, Long>();
|
||||||
private Map<String, Integer> inventoryChanges = new HashMap<String, Integer>();
|
private Map<String, Integer> inventoryChanges = new HashMap<String, Integer>();
|
||||||
private Map<String, Material> itemInHand = new HashMap<String, Material>();
|
private Map<String, Material> itemInHand = new HashMap<String, Material>();
|
||||||
|
private Map<String, Integer> steps = new HashMap<String, Integer>();
|
||||||
|
private Map<String, Long> stepTime = new HashMap<String, Long>();
|
||||||
|
|
||||||
private Magic magic;
|
private Magic magic;
|
||||||
private AnticheatManager micromanage = null;
|
private AnticheatManager micromanage = null;
|
||||||
@@ -556,7 +558,6 @@ public class Backend
|
|||||||
|
|
||||||
public boolean checkTimer(Player player)
|
public boolean checkTimer(Player player)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
String name = player.getName();
|
String name = player.getName();
|
||||||
int step = 1;
|
int step = 1;
|
||||||
if(steps.containsKey(name))
|
if(steps.containsKey(name))
|
||||||
@@ -565,18 +566,15 @@ public class Backend
|
|||||||
}
|
}
|
||||||
if(step == 1)
|
if(step == 1)
|
||||||
{
|
{
|
||||||
lastTime.put(name,System.currentTimeMillis());
|
stepTime.put(name,System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
increment(player, steps, step);
|
increment(player, steps, step);
|
||||||
if(step >= STEP_CHECK)
|
if(step == magic.TIMER_STEP_CHECK)
|
||||||
{
|
{
|
||||||
long time = System.currentTimeMillis()-lastTime.get(name);
|
long time = System.currentTimeMillis()-stepTime.get(name);
|
||||||
steps.put(name, 0);
|
steps.put(name, 0);
|
||||||
if(time < TIME_MIN)
|
return time < magic.TIMER_TIMEMIN;
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}*/
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -332,6 +332,14 @@ public class Magic
|
|||||||
* Time between inventory changes that triggers inventory violations; Type=integer; +Leniency=Decrease.
|
* Time between inventory changes that triggers inventory violations; Type=integer; +Leniency=Decrease.
|
||||||
*/
|
*/
|
||||||
public final int INVENTORY_TIMEMAX;
|
public final int INVENTORY_TIMEMAX;
|
||||||
|
/**
|
||||||
|
* The number of steps we should wait before checking if the player has used timer cheating; Type=integer; +Leniency=Increase.
|
||||||
|
*/
|
||||||
|
public final int TIMER_STEP_CHECK;
|
||||||
|
/**
|
||||||
|
* The minimum time it should have taken for the player to travel X steps; Type=system; +Leniency=Decrease.
|
||||||
|
*/
|
||||||
|
public final long TIMER_TIMEMIN;
|
||||||
|
|
||||||
private FileConfiguration defaults;
|
private FileConfiguration defaults;
|
||||||
private FileConfiguration magic;
|
private FileConfiguration magic;
|
||||||
@@ -417,6 +425,8 @@ public class Magic
|
|||||||
INVENTORY_MAXVIOLATIONS = getInt("INVENTORY_MAXVIOLATIONS");
|
INVENTORY_MAXVIOLATIONS = getInt("INVENTORY_MAXVIOLATIONS");
|
||||||
INVENTORY_MAXVIOLATIONTIME = getInt("INVENTORY_MAXVIOLATIONTIME");
|
INVENTORY_MAXVIOLATIONTIME = getInt("INVENTORY_MAXVIOLATIONTIME");
|
||||||
INVENTORY_TIMEMAX = getInt("INVENTORY_TIMEMAX");
|
INVENTORY_TIMEMAX = getInt("INVENTORY_TIMEMAX");
|
||||||
|
TIMER_STEP_CHECK = getInt("TIMER_STEP_CHECK");
|
||||||
|
TIMER_TIMEMIN = getLong("TIMER_TIMEMIN");
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getInt(String path)
|
private int getInt(String path)
|
||||||
|
|||||||
@@ -74,3 +74,5 @@ SPEED_MAX: 3
|
|||||||
INVENTORY_MAXVIOLATIONS: 2
|
INVENTORY_MAXVIOLATIONS: 2
|
||||||
INVENTORY_MAXVIOLATIONTIME: 10000
|
INVENTORY_MAXVIOLATIONTIME: 10000
|
||||||
INVENTORY_TIMEMAX: 50
|
INVENTORY_TIMEMAX: 50
|
||||||
|
TIMER_STEP_CHECK: 50
|
||||||
|
TIMER_TIMEMIN: 2000
|
||||||
Reference in new issue
Block a user