mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 22:16:03 +00:00
Added and tested backwards compatibility for 1.13 and 1.14.
This commit is contained in:
1 parent
f77d45a78d
commit
6afe0049c5
11 files changed
+78
-45
No files matched your search
@@ -61,7 +61,7 @@ public class KillAuraCheck {
|
||||
LivingEntity living = (LivingEntity) entity;
|
||||
Location eyeLocation = player.getEyeLocation();
|
||||
|
||||
double yawDifference = calculateYawDifference(eyeLocation, living.getLocation());
|
||||
double yawDifference = KillauraAssist.calculateYawDifference(eyeLocation, living.getLocation());
|
||||
double playerYaw = player.getEyeLocation().getYaw();
|
||||
|
||||
double angleDifference = Math.abs(180 - Math.abs(Math.abs(yawDifference - playerYaw) - 180));
|
||||
@@ -83,14 +83,6 @@ public class KillAuraCheck {
|
||||
return PASS;
|
||||
}
|
||||
|
||||
public static double calculateYawDifference(Location from, Location to) {
|
||||
Location clonedFrom = from.clone();
|
||||
Vector startVector = clonedFrom.toVector();
|
||||
Vector targetVector = to.toVector();
|
||||
clonedFrom.setDirection(targetVector.subtract(startVector));
|
||||
return clonedFrom.getYaw();
|
||||
}
|
||||
|
||||
static {
|
||||
KILLAURA_ASSIST = new KillauraAssist();
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class BlinkCheck {
|
||||
.getMagic().BLINK_AVERAGE_PING();
|
||||
float pingLeniency = (float) ((ping / averagePing));
|
||||
if (pingLeniency < 1) pingLeniency = 1;
|
||||
if (pingLeniency > 3) pingLeniency = 3;
|
||||
if (pingLeniency > 2.5F) pingLeniency = 2.5F;
|
||||
blinkMagic = Math.round(pingLeniency * blinkMagic);
|
||||
final float finalPingLeniency = pingLeniency;
|
||||
try {
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -68,12 +69,12 @@ public class GlideCheck {
|
||||
.GLIDE_LIMIT()) {
|
||||
VIOLATIONS.remove(player.getUniqueId());
|
||||
if (!AntiCheatReloaded.getManager().getBackend().silentMode()) {
|
||||
Location to = player.getLocation();
|
||||
to.setY(to.getY() - distanceToFall(to));
|
||||
player.teleport(to);
|
||||
Location prev = player.getLocation();
|
||||
prev.setY(prev.getY() - distanceToFall(prev));
|
||||
player.teleport(AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId()).getGoodLocation(prev));
|
||||
}
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
"desc_amount="
|
||||
"type=glide, desc_amount="
|
||||
+ new BigDecimal(yDiff).setScale(2, RoundingMode.HALF_UP) + ")");
|
||||
} else {
|
||||
VIOLATIONS.put(player.getUniqueId(), VIOLATIONS.get(player.getUniqueId()) + 1);
|
||||
@@ -89,11 +90,8 @@ public class GlideCheck {
|
||||
|
||||
private static double distanceToFall(Location location) {
|
||||
location = location.clone();
|
||||
double firstY = location.getY();
|
||||
Material subtractType = location.clone().add(0, -0.1, 0).getBlock().getType();
|
||||
while (subtractType == Material.AIR || subtractType == Material.CAVE_AIR)
|
||||
location.add(0, -0.1, 0);
|
||||
return firstY - location.getY();
|
||||
double highestY = location.getWorld().getHighestBlockYAt(location) + 1.02D;
|
||||
return location.getY() - highestY;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,6 +32,7 @@ import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
import com.rammelkast.anticheatreloaded.util.checkassist.KillauraAssist;
|
||||
|
||||
public class IllegalInteract {
|
||||
|
||||
@@ -85,7 +86,7 @@ public class IllegalInteract {
|
||||
}
|
||||
|
||||
Location eyeLocation = player.getEyeLocation();
|
||||
double yawDifference = KillAuraCheck.calculateYawDifference(eyeLocation, block.getLocation());
|
||||
double yawDifference = KillauraAssist.calculateYawDifference(eyeLocation, block.getLocation());
|
||||
double playerYaw = player.getEyeLocation().getYaw();
|
||||
double angleDifference = Math.abs(180 - Math.abs(Math.abs(yawDifference - playerYaw) - 180));
|
||||
if (Math.round(angleDifference) > magic.ILLEGALINTERACT_MAX_ANGLE_DIFFERENCE()) {
|
||||
|
||||
Reference in new issue
Block a user