mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 06:28:52 +00:00
Updated to 1.15, fixed issues and made changes to some checks
This commit is contained in:
1 parent
0428c4796a
commit
0963458be5
18 files changed
+275
-501
No files matched your search
@@ -23,6 +23,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
@@ -35,6 +36,7 @@ import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
/**
|
||||
* @author Rammelkast
|
||||
@@ -49,7 +51,7 @@ public class BlinkCheck {
|
||||
public void run() {
|
||||
MOVE_COUNT.clear();
|
||||
}
|
||||
}.runTaskTimer(AntiCheatReloaded.getPlugin(), 20, 20);
|
||||
}.runTaskTimer(AntiCheatReloaded.getPlugin(), 100, 20);
|
||||
}
|
||||
|
||||
public static void listenPackets() {
|
||||
@@ -67,18 +69,35 @@ public class BlinkCheck {
|
||||
if (AntiCheatReloaded.getManager().getCheckManager().checkInWorld(p)
|
||||
&& !AntiCheatReloaded.getManager().getCheckManager().isOpExempt(p)
|
||||
&& !AntiCheatReloaded.getManager().getCheckManager().isExempt(p, CheckType.BLINK)) {
|
||||
if (MOVE_COUNT.get(p.getUniqueId()) > AntiCheatReloaded.getManager().getBackend()
|
||||
.getMagic().BLINK_PACKET()) {
|
||||
EventListener.log(
|
||||
new CheckResult(CheckResult.Result.FAILED, p.getName()
|
||||
+ " failed Blink, sent " + MOVE_COUNT.get(p.getUniqueId())
|
||||
+ " packets in one second (max=" + AntiCheatReloaded.getManager()
|
||||
.getBackend().getMagic().BLINK_PACKET()
|
||||
+ ")").getMessage(),
|
||||
p, CheckType.BLINK);
|
||||
MOVE_COUNT.remove(p.getUniqueId());
|
||||
e.setCancelled(true);
|
||||
e.getPlayer().teleport(cur);
|
||||
int ping = VersionUtil.getPlayerPing(p);
|
||||
int blinkMagic = AntiCheatReloaded.getManager().getBackend()
|
||||
.getMagic().BLINK_PACKET();
|
||||
float pingLeniency = (float) ((ping / 150));
|
||||
if (pingLeniency < 1) pingLeniency = 1;
|
||||
if (pingLeniency > 3) pingLeniency = 3;
|
||||
blinkMagic = Math.round(pingLeniency * blinkMagic);
|
||||
final float finalPingLeniency = pingLeniency;
|
||||
try {
|
||||
if (MOVE_COUNT.get(p.getUniqueId()) > blinkMagic) {
|
||||
final int packets = MOVE_COUNT.get(p.getUniqueId());
|
||||
MOVE_COUNT.remove(p.getUniqueId());
|
||||
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
EventListener.log(
|
||||
new CheckResult(CheckResult.Result.FAILED, p.getName()
|
||||
+ " failed Blink, sent " + packets
|
||||
+ " packets in one second (max=" + AntiCheatReloaded.getManager()
|
||||
.getBackend().getMagic().BLINK_PACKET()
|
||||
+ ", leniency=" + finalPingLeniency + ", ping=" + ping + ")").getMessage(),
|
||||
p, CheckType.BLINK);
|
||||
e.setCancelled(true);
|
||||
e.getPlayer().teleport(cur);
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (NullPointerException nullPointer) {
|
||||
// TODO this is thrown sometimes, might have something to do with line 83
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,16 +40,17 @@ public class ElytraCheck {
|
||||
// This was a teleport, so skip check.
|
||||
return PASS;
|
||||
}
|
||||
if (!FlightCheck.isMovingExempt(player) && !Utilities.isHoveringOverWater(player.getLocation(), 1)
|
||||
/*if (!FlightCheck.isMovingExempt(player) && !Utilities.isHoveringOverWater(player.getLocation(), 1)
|
||||
&& Utilities.cantStandAtExp(player.getLocation())
|
||||
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN),
|
||||
new Material[] { Material.FENCE, Material.FENCE_GATE, Material.COBBLE_WALL,
|
||||
Material.ACACIA_FENCE, Material.ACACIA_FENCE_GATE, Material.BIRCH_FENCE,
|
||||
Material.BIRCH_FENCE_GATE, Material.DARK_OAK_FENCE, Material.DARK_OAK_FENCE_GATE,
|
||||
Material.IRON_FENCE, Material.JUNGLE_FENCE, Material.JUNGLE_FENCE_GATE,
|
||||
Material.NETHER_FENCE, Material.SPRUCE_FENCE, Material.SPRUCE_FENCE_GATE, Material.IRON_BARDING })) {
|
||||
Material.fence, Material.SPRUCE_FENCE, Material.SPRUCE_FENCE_GATE, Material.IRON_BARS })) {
|
||||
|
||||
}
|
||||
}*/
|
||||
//TODO 1.15 update
|
||||
|
||||
return PASS;
|
||||
}
|
||||
|
||||
@@ -56,11 +56,11 @@ public class FlightCheck {
|
||||
if (!isMovingExempt(player) && !Utilities.isHoveringOverWater(player.getLocation(), 1)
|
||||
&& Utilities.cantStandAtExp(player.getLocation())
|
||||
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN),
|
||||
new Material[] { Material.FENCE, Material.FENCE_GATE, Material.COBBLE_WALL,
|
||||
Material.ACACIA_FENCE, Material.ACACIA_FENCE_GATE, Material.BIRCH_FENCE,
|
||||
Material.BIRCH_FENCE_GATE, Material.DARK_OAK_FENCE, Material.DARK_OAK_FENCE_GATE,
|
||||
Material.IRON_FENCE, Material.JUNGLE_FENCE, Material.JUNGLE_FENCE_GATE,
|
||||
Material.NETHER_FENCE, Material.SPRUCE_FENCE, Material.SPRUCE_FENCE_GATE, Material.IRON_BARDING })) {
|
||||
new Material[] { Material.IRON_BARS })
|
||||
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN), new String[] {
|
||||
"FENCE",
|
||||
"FENCE_GATE"
|
||||
})) {
|
||||
|
||||
if (!blocksOverFlight.containsKey(uuid)) {
|
||||
blocksOverFlight.put(uuid, 0D);
|
||||
|
||||
@@ -24,17 +24,13 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
public class GlideCheck {
|
||||
@@ -49,6 +45,9 @@ public class GlideCheck {
|
||||
if (VersionUtil.isFlying(player)) {
|
||||
return PASS;
|
||||
}
|
||||
if (player.getLocation().getBlock().getType() == Material.LADDER || player.getLocation().getBlock().getRelative(0, 1, 0).getType() == Material.LADDER) {
|
||||
return PASS;
|
||||
}
|
||||
if (!lastDiff.containsKey(player.getUniqueId())) {
|
||||
lastDiff.put(player.getUniqueId(), distance.getYDifference());
|
||||
return PASS;
|
||||
|
||||
@@ -69,7 +69,7 @@ public class WaterWalkCheck {
|
||||
}
|
||||
if (!b && !Utilities.isFullyInWater(player.getLocation())
|
||||
&& Utilities.isHoveringOverWater(player.getLocation(), 1) && y == 0D
|
||||
&& !block.getType().equals(Material.WATER_LILY)) {
|
||||
&& !block.getType().equals(Material.LILY_PAD)) {
|
||||
b = true;
|
||||
}
|
||||
if (b) {
|
||||
|
||||
@@ -126,7 +126,8 @@ public class YAxisCheck {
|
||||
}
|
||||
|
||||
public static boolean isMoveUpBlock(Block block) {
|
||||
return VersionUtil.getMoveUpBlocks().contains(block.getType());
|
||||
Material type = block.getType();
|
||||
return type.name().endsWith("STAIRS"); // TODO slabs/others?
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user