mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 06:28:52 +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
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user