Reduce noswing false positives when attacking entities

This commit is contained in:
gravitylow committed 2014-01-21 16:37:46 -05:00
1 parent 67394716c4
commit d49bb9c22e
3 files changed
+15 -1

No files matched your search

@@ -43,6 +43,7 @@ public class Backend {
private List<String> isInWater = new ArrayList<String>();
private List<String> isInWaterCache = new ArrayList<String>();
private List<String> isAscending = new ArrayList<String>();
private Map<String, Integer> interactionCount = new HashMap<String, Integer>();
private Map<String, Integer> ascensionCount = new HashMap<String, Integer>();
private Map<String, Double> blocksOverFlight = new HashMap<String, Double>();
private Map<String, Integer> chatLevel = new HashMap<String, Integer>();
@@ -880,6 +881,7 @@ public class Backend {
animated.put(player.getName(), System.currentTimeMillis());
increment(player, blockPunches, magic.BLOCK_PUNCH_MIN);
itemInHand.put(player.getName(), player.getItemInHand().getType());
interactionCount.put(player.getName(), 0);
}
public void logInstantBreak(final Player player) {
@@ -957,7 +959,13 @@ public class Backend {
String name = player.getName();
if (animated.containsKey(name)) {
long time = System.currentTimeMillis() - animated.get(name);
animated.remove(player.getName());
int count = interactionCount.get(player.getName()) + 1;
interactionCount.put(player.getName(), count);
if (count > magic.ANIMATION_INTERACT_MAX) {
animated.remove(player.getName());
return false;
}
return time < magic.ANIMATION_MIN;
} else {
return false;
@@ -215,6 +215,10 @@ public class Magic extends ConfigurationFile {
* Number of times a player can sprint without proper food level before action is taken; Type=integer, +Leniency=Increase.
*/
public int SPRINT_FOOD_MIN;
/**
* Maximum times a player can interact between animations; Type=integer, +Leniency=Increase.
*/
public int ANIMATION_INTERACT_MAX;
/**
* Minimum time between animations; Type=system, +Leniency=Increase.
*/
@@ -427,6 +431,7 @@ public class Magic extends ConfigurationFile {
WATER_ASCENSION_VIOLATION_MAX = new ConfigValue<Integer>("WATER_ASCENSION_VIOLATION_MAX").getValue();
WATER_SPEED_VIOLATION_MAX = new ConfigValue<Integer>("WATER_SPEED_VIOLATION_MAX").getValue();
SPRINT_FOOD_MIN = new ConfigValue<Integer>("SPRINT_FOOD_MIN").getValue();
ANIMATION_INTERACT_MAX = new ConfigValue<Integer>("ANIMATION_INTERACT_MAX").getValue();
ANIMATION_MIN = new ConfigValue<Integer>("ANIMATION_MIN").getValue();
COMMAND_MIN = new ConfigValue<Integer>("COMMAND_MIN").getValue();
COMMAND_REPEAT_MIN = new ConfigValue<Integer>("COMMAND_REPEAT_MIN").getValue();
+1
View File
@@ -1,6 +1,7 @@
# AntiCheat configuration file
# Please report any bugs: http://dev.bukkit.org/server-mods/anticheat/
# Documentation for these values is available at http://gravitydevelopment.net/docs/anticheat/net/gravitydevelopment/anticheat/util/Magic.html
ANIMATION_INTERACT_MAX: 3
ANIMATION_MIN: 200
ASCENSION_COUNT_MAX: 8
BLOCK_BREAK_MIN: 0.1