mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 14:38:45 +00:00
Blink is now MorePackets, fix #67
This commit is contained in:
1 parent
80b5e64924
commit
91f5fcd31c
9 files changed
+63
-59
No files matched your search
@@ -33,7 +33,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
|
|
||||||
import com.comphenix.protocol.ProtocolLibrary;
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
import com.comphenix.protocol.ProtocolManager;
|
import com.comphenix.protocol.ProtocolManager;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.BlinkCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.MorePacketsCheck;
|
||||||
import com.rammelkast.anticheatreloaded.command.CommandHandler;
|
import com.rammelkast.anticheatreloaded.command.CommandHandler;
|
||||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||||
import com.rammelkast.anticheatreloaded.event.BlockListener;
|
import com.rammelkast.anticheatreloaded.event.BlockListener;
|
||||||
@@ -95,8 +95,8 @@ public class AntiCheatReloaded extends JavaPlugin {
|
|||||||
|
|
||||||
getLogger().info("Enabling checks that use ProtcolLib");
|
getLogger().info("Enabling checks that use ProtcolLib");
|
||||||
// Enable packetlisteners
|
// Enable packetlisteners
|
||||||
BlinkCheck.startTimer();
|
MorePacketsCheck.startTimer();
|
||||||
BlinkCheck.listenPackets();
|
MorePacketsCheck.listenPackets();
|
||||||
|
|
||||||
updateManager = new UpdateManager();
|
updateManager = new UpdateManager();
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import org.bukkit.potion.PotionEffectType;
|
|||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck;
|
import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.BlinkCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.MorePacketsCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.GlideCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.GlideCheck;
|
||||||
@@ -121,7 +121,7 @@ public class Backend {
|
|||||||
UUID pU = player.getUniqueId();
|
UUID pU = player.getUniqueId();
|
||||||
|
|
||||||
VelocityCheck.cleanPlayer(player);
|
VelocityCheck.cleanPlayer(player);
|
||||||
BlinkCheck.MOVE_COUNT.remove(player.getUniqueId());
|
MorePacketsCheck.MOVE_COUNT.remove(player.getUniqueId());
|
||||||
blocksDropped.remove(pU);
|
blocksDropped.remove(pU);
|
||||||
blockTime.remove(pU);
|
blockTime.remove(pU);
|
||||||
FlightCheck.MOVING_EXEMPT.remove(pU);
|
FlightCheck.MOVING_EXEMPT.remove(pU);
|
||||||
@@ -690,7 +690,7 @@ public class Backend {
|
|||||||
public CheckResult checkFastHeal(Player player) {
|
public CheckResult checkFastHeal(Player player) {
|
||||||
if (lastHeal.containsKey(player.getUniqueId())) // Otherwise it was modified by a plugin, don't worry about it.
|
if (lastHeal.containsKey(player.getUniqueId())) // Otherwise it was modified by a plugin, don't worry about it.
|
||||||
{
|
{
|
||||||
long healTime = VersionUtil.getHealTime();
|
long healTime = magic.MIN_HEAL_TIME();
|
||||||
long l = lastHeal.get(player.getUniqueId());
|
long l = lastHeal.get(player.getUniqueId());
|
||||||
lastHeal.remove(player.getUniqueId());
|
lastHeal.remove(player.getUniqueId());
|
||||||
if ((System.currentTimeMillis() - l) < healTime) {
|
if ((System.currentTimeMillis() - l) < healTime) {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public enum CheckType {
|
|||||||
ITEM_SPAM(Permission.CHECK_ITEMSPAM),
|
ITEM_SPAM(Permission.CHECK_ITEMSPAM),
|
||||||
FAST_INVENTORY(Permission.CHECK_FASTINVENTORY),
|
FAST_INVENTORY(Permission.CHECK_FASTINVENTORY),
|
||||||
AUTOTOOL(Permission.CHECK_AUTOTOOL),
|
AUTOTOOL(Permission.CHECK_AUTOTOOL),
|
||||||
BLINK(Permission.CHECK_BLINK),
|
MOREPACKETS(Permission.CHECK_MOREPACKETS),
|
||||||
VELOCITY(Permission.CHECK_VELOCITY),
|
VELOCITY(Permission.CHECK_VELOCITY),
|
||||||
CRITICALS(Permission.CHECK_CRITICALS),
|
CRITICALS(Permission.CHECK_CRITICALS),
|
||||||
CHAT_UNICODE(Permission.CHECK_UNICODE),
|
CHAT_UNICODE(Permission.CHECK_UNICODE),
|
||||||
|
|||||||
+41
-40
@@ -40,7 +40,7 @@ import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
|||||||
/**
|
/**
|
||||||
* @author Rammelkast
|
* @author Rammelkast
|
||||||
*/
|
*/
|
||||||
public class BlinkCheck {
|
public class MorePacketsCheck {
|
||||||
|
|
||||||
public static final Map<UUID, Integer> MOVE_COUNT = new HashMap<UUID, Integer>();
|
public static final Map<UUID, Integer> MOVE_COUNT = new HashMap<UUID, Integer>();
|
||||||
|
|
||||||
@@ -59,48 +59,49 @@ public class BlinkCheck {
|
|||||||
new PacketType[] { PacketType.Play.Client.POSITION, PacketType.Play.Client.POSITION_LOOK }) {
|
new PacketType[] { PacketType.Play.Client.POSITION, PacketType.Play.Client.POSITION_LOOK }) {
|
||||||
@Override
|
@Override
|
||||||
public void onPacketReceiving(PacketEvent e) {
|
public void onPacketReceiving(PacketEvent e) {
|
||||||
Player p = e.getPlayer();
|
Player player = e.getPlayer();
|
||||||
|
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player,
|
||||||
|
CheckType.MOREPACKETS)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Location cur = e.getPlayer().getLocation();
|
Location cur = e.getPlayer().getLocation();
|
||||||
if (!MOVE_COUNT.containsKey(p.getUniqueId())) {
|
if (!MOVE_COUNT.containsKey(player.getUniqueId())) {
|
||||||
MOVE_COUNT.put(p.getUniqueId(), 1);
|
MOVE_COUNT.put(player.getUniqueId(), 1);
|
||||||
} else {
|
} else {
|
||||||
MOVE_COUNT.put(p.getUniqueId(), MOVE_COUNT.get(p.getUniqueId()) + 1);
|
MOVE_COUNT.put(player.getUniqueId(), MOVE_COUNT.get(player.getUniqueId()) + 1);
|
||||||
if (AntiCheatReloaded.getManager().getCheckManager().checkInWorld(p)
|
int ping = VersionUtil.getPlayerPing(player);
|
||||||
&& !AntiCheatReloaded.getManager().getCheckManager().isOpExempt(p)
|
int limit = AntiCheatReloaded.getManager().getBackend().getMagic().MOREPACKETS_LIMIT();
|
||||||
&& !AntiCheatReloaded.getManager().getCheckManager().isExempt(p, CheckType.BLINK)) {
|
int averagePing = AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||||
int ping = VersionUtil.getPlayerPing(p);
|
.MOREPACKETS_AVERAGE_PING();
|
||||||
int blinkMagic = AntiCheatReloaded.getManager().getBackend().getMagic().BLINK_PACKET();
|
float pingLeniency = (float) ((ping / averagePing));
|
||||||
int averagePing = AntiCheatReloaded.getManager().getBackend().getMagic()
|
if (pingLeniency < 1)
|
||||||
.BLINK_AVERAGE_PING();
|
pingLeniency = 1;
|
||||||
float pingLeniency = (float) ((ping / averagePing));
|
if (pingLeniency > 2.5F)
|
||||||
if (pingLeniency < 1)
|
pingLeniency = 2.5F;
|
||||||
pingLeniency = 1;
|
limit = Math.round(pingLeniency * limit);
|
||||||
if (pingLeniency > 2.5F)
|
final float finalPingLeniency = pingLeniency;
|
||||||
pingLeniency = 2.5F;
|
try {
|
||||||
blinkMagic = Math.round(pingLeniency * blinkMagic);
|
if (MOVE_COUNT.get(player.getUniqueId()) > limit) {
|
||||||
final float finalPingLeniency = pingLeniency;
|
final int packets = MOVE_COUNT.get(player.getUniqueId());
|
||||||
try {
|
MOVE_COUNT.remove(player.getUniqueId());
|
||||||
if (MOVE_COUNT.get(p.getUniqueId()) > blinkMagic) {
|
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||||
final int packets = MOVE_COUNT.get(p.getUniqueId());
|
@Override
|
||||||
MOVE_COUNT.remove(p.getUniqueId());
|
public void run() {
|
||||||
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
EventListener.log(
|
||||||
@Override
|
new CheckResult(CheckResult.Result.FAILED,
|
||||||
public void run() {
|
"sent " + packets + " packets in one second (max="
|
||||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED,
|
+ AntiCheatReloaded.getManager().getBackend()
|
||||||
"sent " + packets + " packets in one second (max="
|
.getMagic().MOREPACKETS_LIMIT()
|
||||||
+ AntiCheatReloaded.getManager().getBackend().getMagic()
|
+ ", leniency=" + finalPingLeniency + ", ping="
|
||||||
.BLINK_PACKET()
|
+ ping + ")").getMessage(),
|
||||||
+ ", leniency=" + finalPingLeniency + ", ping=" + ping
|
player, CheckType.MOREPACKETS);
|
||||||
+ ")").getMessage(),
|
e.setCancelled(true);
|
||||||
p, CheckType.BLINK);
|
e.getPlayer().teleport(cur);
|
||||||
e.setCancelled(true);
|
}
|
||||||
e.getPlayer().teleport(cur);
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (NullPointerException nullPointer) {
|
|
||||||
// TODO this is thrown sometimes, might have something to do with line 83
|
|
||||||
}
|
}
|
||||||
|
} catch (NullPointerException nullPointer) {
|
||||||
|
// TODO this is thrown sometimes, might have something to do with line 83
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -365,11 +365,11 @@ public interface Magic {
|
|||||||
/**
|
/**
|
||||||
* Maximum amount of packets a player can send in a second; Type=INTEGER, Leniency=INCREASE.
|
* Maximum amount of packets a player can send in a second; Type=INTEGER, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
public int BLINK_PACKET();
|
public int MOREPACKETS_LIMIT();
|
||||||
/**
|
/**
|
||||||
* The average ping settings used to account for lag; TYPE=INTEGER, Leniency=INCREASE
|
* The average ping settings used to account for lag; TYPE=INTEGER, Leniency=INCREASE
|
||||||
*/
|
*/
|
||||||
public int BLINK_AVERAGE_PING();
|
public int MOREPACKETS_AVERAGE_PING();
|
||||||
/**
|
/**
|
||||||
* Maximum amount of low/zero velocity moments before flagging; Type=INTEGER, Leniency=INCREASE.
|
* Maximum amount of low/zero velocity moments before flagging; Type=INTEGER, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
@@ -390,4 +390,8 @@ public interface Magic {
|
|||||||
* The maximum angle difference allowed when breaking or placing blocks; TYPE=INTEGER, Leniency=INCREASE
|
* The maximum angle difference allowed when breaking or placing blocks; TYPE=INTEGER, Leniency=INCREASE
|
||||||
*/
|
*/
|
||||||
public int ILLEGALINTERACT_MAX_ANGLE_DIFFERENCE();
|
public int ILLEGALINTERACT_MAX_ANGLE_DIFFERENCE();
|
||||||
|
/**
|
||||||
|
* The minimum time it takes to regenerate health; TYPE=INTEGER, Leniency=DECREASE
|
||||||
|
*/
|
||||||
|
public int MIN_HEAL_TIME();
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,7 @@ public enum Permission {
|
|||||||
CHECK_FLIGHT, CHECK_ELYTRA, CHECK_WATERWALK, CHECK_NOSWING, CHECK_FASTBREAK,
|
CHECK_FLIGHT, CHECK_ELYTRA, CHECK_WATERWALK, CHECK_NOSWING, CHECK_FASTBREAK,
|
||||||
CHECK_FASTPLACE, CHECK_CHATSPAM, CHECK_COMMANDSPAM, CHECK_SPRINT, CHECK_SNEAK, CHECK_SPEED, CHECK_VCLIP,
|
CHECK_FASTPLACE, CHECK_CHATSPAM, CHECK_COMMANDSPAM, CHECK_SPRINT, CHECK_SNEAK, CHECK_SPEED, CHECK_VCLIP,
|
||||||
CHECK_SPIDER, CHECK_NOFALL, CHECK_FASTBOW, CHECK_FASTEAT, CHECK_FASTHEAL, CHECK_KILLAURA, CHECK_LONGREACH, CHECK_UNICODE,
|
CHECK_SPIDER, CHECK_NOFALL, CHECK_FASTBOW, CHECK_FASTEAT, CHECK_FASTHEAL, CHECK_KILLAURA, CHECK_LONGREACH, CHECK_UNICODE,
|
||||||
CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_VISUAL, CHECK_FASTINVENTORY, CHECK_AUTOTOOL, CHECK_BLINK, CHECK_VELOCITY, CHECK_CRITICALS, CHECK_ILLEGAL_INTERACT,
|
CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_VISUAL, CHECK_FASTINVENTORY, CHECK_AUTOTOOL, CHECK_MOREPACKETS, CHECK_VELOCITY, CHECK_CRITICALS, CHECK_ILLEGAL_INTERACT,
|
||||||
|
|
||||||
/* System Nodes */
|
/* System Nodes */
|
||||||
SYSTEM_LOG, SYSTEM_RESET, SYSTEM_HELP, SYSTEM_VERSION, SYSTEM_REPORT, SYSTEM_ALERT, SYSTEM_NOTICE,
|
SYSTEM_LOG, SYSTEM_RESET, SYSTEM_HELP, SYSTEM_VERSION, SYSTEM_REPORT, SYSTEM_ALERT, SYSTEM_NOTICE,
|
||||||
|
|||||||
@@ -70,10 +70,6 @@ public class VersionUtil {
|
|||||||
return p.isFlying() || p.isGliding() || p.hasPotionEffect(PotionEffectType.LEVITATION);
|
return p.isFlying() || p.isGliding() || p.hasPotionEffect(PotionEffectType.LEVITATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getHealTime() {
|
|
||||||
return 495;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isFrostWalk(Player player) {
|
public static boolean isFrostWalk(Player player) {
|
||||||
if (player.getInventory().getBoots() == null || isBountifulUpdate()) {
|
if (player.getInventory().getBoots() == null || isBountifulUpdate()) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -246,10 +246,10 @@ Y_TIME: 800
|
|||||||
GLIDE_LIMIT: 8
|
GLIDE_LIMIT: 8
|
||||||
# Maximum amount of movement packets allowed per second
|
# Maximum amount of movement packets allowed per second
|
||||||
# Increase this in case of false positives
|
# Increase this in case of false positives
|
||||||
BLINK_PACKET: 30
|
MOREPACKETS_LIMIT: 30
|
||||||
# If the blink check gives false positives replace this with the average user ping on your server
|
# If the blink check gives false positives replace this with the average user ping on your server
|
||||||
# Not a good idea to use a value lower than 150 or higher than 300
|
# Not a good idea to use a value lower than 75 or higher than 250
|
||||||
BLINK_AVERAGE_PING: 200
|
MOREPACKETS_AVERAGE_PING: 80
|
||||||
# Maximum amount zero-velocity moments before a player is suspected
|
# Maximum amount zero-velocity moments before a player is suspected
|
||||||
# Increase this in case of false positives
|
# Increase this in case of false positives
|
||||||
VELOCITY_MAX_FLAGS: 5
|
VELOCITY_MAX_FLAGS: 5
|
||||||
@@ -266,3 +266,6 @@ KILLAURA_FIGHTSPEED_MINDIFF: 3
|
|||||||
# The maximum angle difference allowed when placing or breaking a block
|
# The maximum angle difference allowed when placing or breaking a block
|
||||||
# Increase this in case of false positives, can be slightly decreased to tighten check
|
# Increase this in case of false positives, can be slightly decreased to tighten check
|
||||||
ILLEGALINTERACT_MAX_ANGLE_DIFFERENCE: 75
|
ILLEGALINTERACT_MAX_ANGLE_DIFFERENCE: 75
|
||||||
|
# The minimum time it takes to regenerate health
|
||||||
|
# Decrease this in case of false positives
|
||||||
|
MIN_HEAL_TIME: 490
|
||||||
@@ -118,7 +118,7 @@ permissions:
|
|||||||
anticheat.check.autotool:
|
anticheat.check.autotool:
|
||||||
description: Allow players to use autotool to switch tools quickly
|
description: Allow players to use autotool to switch tools quickly
|
||||||
default: false
|
default: false
|
||||||
anticheat.check.blink:
|
anticheat.check.morepackets:
|
||||||
description: Allow players to send lots of movement packets
|
description: Allow players to send lots of movement packets
|
||||||
default: false
|
default: false
|
||||||
anticheat.check.velocity:
|
anticheat.check.velocity:
|
||||||
@@ -160,7 +160,7 @@ permissions:
|
|||||||
anticheat.check.fastinventory: true
|
anticheat.check.fastinventory: true
|
||||||
anticheat.check.autotool: true
|
anticheat.check.autotool: true
|
||||||
anticheat.check.fastanimation: true
|
anticheat.check.fastanimation: true
|
||||||
anticheat.check.blink: true
|
anticheat.check.morepackets: true
|
||||||
anticheat.check.velocity: true
|
anticheat.check.velocity: true
|
||||||
anticheat.check.criticals: true
|
anticheat.check.criticals: true
|
||||||
anticheat.check.unicode: true
|
anticheat.check.unicode: true
|
||||||
|
|||||||
Reference in new issue
Block a user