Fixed issue with config reloading and false positives

This commit is contained in:
Rammelkast committed 2020-07-22 11:16:01 +02:00
1 parent 6966582e4c
commit f4ca2ea8bf
5 files changed
+21 -10

No files matched your search

@@ -172,6 +172,9 @@ public class SpeedCheck {
// Slab leniency
if (movementManager.halfMovementHistoryCounter > 8)
limit += 0.2D;
// LivingEntities can give players a small push boost
if (!movingTowards.getWorld().getNearbyEntities(movingTowards, 0.3, 0.3, 0.3).isEmpty())
limit += 0.2D;
// Leniency when boxed in
if (boxedIn)
limit *= 1.1D;
@@ -50,14 +50,14 @@ public class WaterWalkCheck {
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "walk") && blockBeneath.isLiquid()
&& Utilities.isSurroundedByWater(player)
&& (movementManager.motionY == 0 || movementManager.motionY == Utilities.JUMP_MOTION_Y)
&& movementManager.distanceXZ > checksConfig.getDouble(CheckType.WATER_WALK, "lunge", "minimumDistXZ"))
&& ((movementManager.motionY == 0 && movementManager.lastMotionY == 0) || movementManager.motionY == Utilities.JUMP_MOTION_Y)
&& movementManager.distanceXZ > checksConfig.getDouble(CheckType.WATER_WALK, "walk", "minimumDistXZ"))
return new CheckResult(Result.FAILED,
"tried to walk on water (xz=" + Utilities.roundDouble(movementManager.distanceXZ, 5) + ")");
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "hop") && blockBeneath.isLiquid()
&& Utilities.isSurroundedByWater(player) && movementManager.onGround
&& Math.abs(movementManager.motionY) < checksConfig.getDouble(CheckType.WATER_WALK, "lunge", "maxMotionY"))
&& Math.abs(movementManager.motionY) < checksConfig.getDouble(CheckType.WATER_WALK, "hop", "maxMotionY"))
return new CheckResult(Result.FAILED,
"tried to hop on water (mY=" + Utilities.roundDouble(movementManager.motionY, 5) + ")");
@@ -19,6 +19,7 @@
package com.rammelkast.anticheatreloaded.command.executors;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import com.rammelkast.anticheatreloaded.command.CommandBase;
@@ -41,6 +42,6 @@ public class CommandReload extends CommandBase {
@Override
protected void execute(CommandSender cs, String[] args) {
CONFIG.load();
cs.sendMessage(GREEN + "AntiCheat configuration reloaded.");
cs.sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> " + ChatColor.GRAY + "The configuration was reloaded");
}
}
@@ -151,12 +151,15 @@ public class Configuration {
file.load();
checkReload(file);
}
for (ConfigurationTable table : dbfiles) {
for (ConfigurationTable table : dbfiles)
table.load();
}
if (manager.getBackend() != null) {
if (manager.getBackend() != null)
manager.getBackend().updateConfig(this);
}
if (manager.getCheckManager() != null)
manager.getCheckManager().loadCheckIgnoreList(this);
}
private void checkReload(ConfigurationFile file) {
@@ -47,9 +47,13 @@ public class CheckManager {
public CheckManager(AntiCheatManager manager) {
this.manager = manager;
this.config = manager.getConfiguration();
this.loadCheckIgnoreList(this.config);
}
public void loadCheckIgnoreList(Configuration configuration) {
checkIgnoreList.clear();
for (CheckType type : CheckType.values()) {
if (!config.getChecks().isEnabled(type)) {
if (!configuration.getChecks().isEnabled(type)) {
checkIgnoreList.add(type);
break;
}
@@ -60,7 +64,7 @@ public class CheckManager {
+ checkIgnoreList.size() + " check(s) have been disabled");
}
}
/**
* Turn a check on
*