mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 22:15:28 +00:00
Fixed false positives with boats, changes to MorePackets
This commit is contained in:
1 parent
db9aa97ca1
commit
610d53550f
6 files changed
+32
-4
No files matched your search
@@ -798,6 +798,11 @@ public class Backend {
|
|||||||
public void logExitFly(final Player player) {
|
public void logExitFly(final Player player) {
|
||||||
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + magic.EXIT_FLY_TIME());
|
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + magic.EXIT_FLY_TIME());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void logBoatCollision(final Player player) {
|
||||||
|
// TODO config
|
||||||
|
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + 100 /* 2 ticks */);
|
||||||
|
}
|
||||||
|
|
||||||
public void logJoin(final Player player) {
|
public void logJoin(final Player player) {
|
||||||
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + magic.JOIN_TIME());
|
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + magic.JOIN_TIME());
|
||||||
|
|||||||
@@ -60,7 +60,8 @@ public class FlightCheck {
|
|||||||
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN),
|
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN),
|
||||||
new Material[] { Utilities.IRON_BARS })
|
new Material[] { Utilities.IRON_BARS })
|
||||||
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN),
|
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN),
|
||||||
new String[] { "FENCE", "FENCE_GATE" })) {
|
new String[] { "FENCE", "FENCE_GATE" })
|
||||||
|
&& !Utilities.couldBeOnBoat(player)) {
|
||||||
if (!BLOCKS_OVER_FLIGHT.containsKey(uuid)) {
|
if (!BLOCKS_OVER_FLIGHT.containsKey(uuid)) {
|
||||||
BLOCKS_OVER_FLIGHT.put(uuid, 0D);
|
BLOCKS_OVER_FLIGHT.put(uuid, 0D);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,7 +124,8 @@ public class SpeedCheck {
|
|||||||
&& !VersionUtil.isRiptiding(player)
|
&& !VersionUtil.isRiptiding(player)
|
||||||
&& !Utilities.isNearBed(distance.getTo())
|
&& !Utilities.isNearBed(distance.getTo())
|
||||||
&& !Utilities.isSlime(AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
&& !Utilities.isSlime(AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
||||||
.getGoodLocation(player.getLocation()).getBlock())) {
|
.getGoodLocation(player.getLocation()).getBlock())
|
||||||
|
&& !Utilities.couldBeOnBoat(player)) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
"y speed was too high (speed=" + distance.getYDifference() + ", max=" + backend.getMagic().Y_SPEED_MAX() + ")");
|
"y speed was too high (speed=" + distance.getYDifference() + ", max=" + backend.getMagic().Y_SPEED_MAX() + ")");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
|
import org.bukkit.entity.Boat;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@@ -50,6 +51,8 @@ import org.bukkit.event.player.PlayerToggleFlightEvent;
|
|||||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||||
import org.bukkit.event.player.PlayerVelocityEvent;
|
import org.bukkit.event.player.PlayerVelocityEvent;
|
||||||
|
import org.bukkit.event.vehicle.VehicleCollisionEvent;
|
||||||
|
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
|
||||||
import org.bukkit.inventory.EquipmentSlot;
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
@@ -57,7 +60,6 @@ import org.bukkit.inventory.PlayerInventory;
|
|||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.AimbotCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.AimbotCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.FastLadderCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.FastLadderCheck;
|
||||||
@@ -232,6 +234,15 @@ public class PlayerListener extends EventListener {
|
|||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerVehicleCollide(VehicleEntityCollisionEvent event) {
|
||||||
|
if (!(event.getVehicle() instanceof Boat) || !(event.getEntity() instanceof Player))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player player = (Player) event.getEntity();
|
||||||
|
getBackend().logBoatCollision(player);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerToggleSprint(PlayerToggleSprintEvent event) {
|
public void onPlayerToggleSprint(PlayerToggleSprintEvent event) {
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.Boat;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.util.NumberConversions;
|
import org.bukkit.util.NumberConversions;
|
||||||
@@ -121,6 +123,14 @@ public final class Utilities {
|
|||||||
&& !isSlime(block.getRelative(BlockFace.SOUTH)) && !isSlime(block.getRelative(BlockFace.WEST)) && !isSlime(block.getRelative(BlockFace.DOWN));
|
&& !isSlime(block.getRelative(BlockFace.SOUTH)) && !isSlime(block.getRelative(BlockFace.WEST)) && !isSlime(block.getRelative(BlockFace.DOWN));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean couldBeOnBoat(Player player) {
|
||||||
|
for (Entity entity : player.getNearbyEntities(0.25, 0.25, 0.25)) {
|
||||||
|
if (entity instanceof Boat)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine whether a player is fully submerged in water
|
* Determine whether a player is fully submerged in water
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ MOREPACKETS_TELEPORT_COMPENSATION: 200
|
|||||||
# The amount of milliseconds that were offset to flag for MorePackets (50ms = 1 tick)
|
# The amount of milliseconds that were offset to flag for MorePackets (50ms = 1 tick)
|
||||||
# Increase this in case of false positives
|
# Increase this in case of false positives
|
||||||
# Can be decreased in to tighten check
|
# Can be decreased in to tighten check
|
||||||
MOREPACKETS_TRIGGER_BALANCE: 50
|
MOREPACKETS_TRIGGER_BALANCE: 100
|
||||||
# The maximum amount of overall lag compensating in milliseconds (50ms = 1 tick)
|
# The maximum amount of overall lag compensating in milliseconds (50ms = 1 tick)
|
||||||
# Increase this in case of false positives
|
# Increase this in case of false positives
|
||||||
# Can be decreased in to tighten check
|
# Can be decreased in to tighten check
|
||||||
|
|||||||
Reference in new issue
Block a user