diff --git a/src/main/java/ac/grim/grimac/checks/impl/combat/Reach.java b/src/main/java/ac/grim/grimac/checks/impl/combat/Reach.java index 5b6e987580..0d7c58a4c8 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/combat/Reach.java +++ b/src/main/java/ac/grim/grimac/checks/impl/combat/Reach.java @@ -32,11 +32,19 @@ import com.github.retrooper.packetevents.protocol.player.ClientVersion; import com.github.retrooper.packetevents.protocol.player.GameMode; import com.github.retrooper.packetevents.util.Vector3d; +import com.github.retrooper.packetevents.util.Vector3i; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying; import org.bukkit.util.Vector; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; // You may not copy the check unless you are licensed under GPL @CheckData(name = "Reach", configName = "Reach", setback = 10) @@ -44,11 +52,13 @@ public class Reach extends Check implements PacketCheck { // Only one flag per reach attack, per entity, per tick. // We store position because lastX isn't reliable on teleports. private final Map playerAttackQueue = new HashMap<>(); + private static final List blacklisted = Arrays.asList( EntityTypes.BOAT, EntityTypes.CHEST_BOAT, EntityTypes.SHULKER); + private boolean ignoreNonPlayerTargets; private boolean cancelImpossibleHits; private double threshold; private double cancelBuffer; // For the next 4 hits after using reach, we aggressively cancel reach @@ -82,6 +92,10 @@ public void onPacketReceive(final PacketReceiveEvent event) { return; } + if (ignoreNonPlayerTargets && !entity.getType().equals(EntityTypes.PLAYER)) { + return; + } + // Dead entities cause false flags (https://github.com/GrimAnticheat/Grim/issues/546) if (entity.isDead) return; @@ -239,6 +253,7 @@ private String checkReach(PacketEntity reachEntity, Vector3d from, boolean isPre @Override public void onReload(ConfigManager config) { + this.ignoreNonPlayerTargets = config.getBooleanElse("Reach.ignore-non-player-targets", false); this.cancelImpossibleHits = config.getBooleanElse("Reach.block-impossible-hits", true); this.threshold = config.getDoubleElse("Reach.threshold", 0.0005); } diff --git a/src/main/resources/config/de.yml b/src/main/resources/config/de.yml index 29d10af784..e1b2c41f07 100644 --- a/src/main/resources/config/de.yml +++ b/src/main/resources/config/de.yml @@ -147,6 +147,8 @@ Reach: # Sollten wir Treffer annullieren, von denen wir wissen, dass sie unmöglich sind? # 3.00-3.03-Treffer können aufgrund von Beschränkungen der Paketreihenfolge durchgehen, aber dennoch gekennzeichnet werden. block-impossible-hits: true + # Only apply reach checks if the target is a player + ignore-non-player-targets: false # Dies sendet ein zusätzliches Paket am Ende jedes Ticks, um die Wahrscheinlichkeit zu erhöhen, dass Betrüger erwischt werden. # Dies injiziert in die Verbindungsliste des Servers, um ein letztes Paket zu senden, kurz bevor der Server geleert wird. # Aktivieren dieser Funktion erhöht die Bandbreitennutzung für alle Spieler. diff --git a/src/main/resources/config/en.yml b/src/main/resources/config/en.yml index aff61a8f20..4729fd859a 100644 --- a/src/main/resources/config/en.yml +++ b/src/main/resources/config/en.yml @@ -147,6 +147,8 @@ Reach: # Should we cancel hits that we know are impossible? # 3.00-3.03 hits may go through but still be flagged, due to packet order limitations block-impossible-hits: true + # Only apply reach checks if the target is a player + ignore-non-player-targets: false # This will send an additional packet at the end of every tick to increase the likelihood of catching cheats # This injects into server's connection list to send a final packet just before the server flushes # Enabling this will increase bandwidth usage for all players diff --git a/src/main/resources/config/es.yml b/src/main/resources/config/es.yml index b83737e466..10058aa7d3 100644 --- a/src/main/resources/config/es.yml +++ b/src/main/resources/config/es.yml @@ -153,6 +153,8 @@ Reach: # ¿Deberíamos cancelar golpes que sabemos que son imposibles? # Golpes de 3.00-3.03 puede que aun asi pasen, pero se marcaran debido a limitaciones del orden de paquetes. block-impossible-hits: true + # Only apply reach checks if the target is a player + ignore-non-player-targets: false # Esto mandará un paquete adicional al final de cada tick para aumentar las chances de encontrar trampas # Esto se inyecta en la lista de conexiones del servidor para mandar un paquete final justo antes de que el servidor haga "flush". # Habilitar esto causará que el uso de banda ancha de todos los jugadores aumente diff --git a/src/main/resources/config/fr.yml b/src/main/resources/config/fr.yml index 0e1c36c451..9d5f85deb0 100644 --- a/src/main/resources/config/fr.yml +++ b/src/main/resources/config/fr.yml @@ -148,6 +148,8 @@ Reach: # Devons-nous annuler les coups que nous savons impossibles ? # Les coups entre 3,00 et 3,03 peuvent passer mais seront quand même signalés en raison des limitations de l'ordre des paquets. block-impossible-hits: true + # Only apply reach checks if the target is a player + ignore-non-player-targets: false # Cela enverra un paquet supplémentaire à la fin de chaque tick pour augmenter les chances de détecter les triches. # Cela s'injecte dans la liste de connexions du serveur pour envoyer un dernier paquet juste avant que le serveur ne le vide. # Activer cette fonctionnalité augmentera l'utilisation de la bande passante pour tous les joueurs. diff --git a/src/main/resources/config/it.yml b/src/main/resources/config/it.yml index 82926afb77..e10df984c3 100644 --- a/src/main/resources/config/it.yml +++ b/src/main/resources/config/it.yml @@ -133,6 +133,8 @@ Reach: threshold: 0.0005 # Annulla gli attacchi impossibili block-impossible-hits: true + # Only apply reach checks if the target is a player + ignore-non-player-targets: false # Abilita l'invio di pacchetti aggiuntivi per il rilevamento degli attacchi enable-post-packet: false diff --git a/src/main/resources/config/nl.yml b/src/main/resources/config/nl.yml index f198782f54..f30a0f93fe 100644 --- a/src/main/resources/config/nl.yml +++ b/src/main/resources/config/nl.yml @@ -147,6 +147,8 @@ Reach: # Moeten we hits annuleren waarvan we weten dat ze onmogelijk zijn? # 3.00-3.03 hits kunnen doorkomen, maar toch gemarkeerd worden, vanwege pakketvolgorderbeperkingen block-impossible-hits: true + # Only apply reach checks if the target is a player + ignore-non-player-targets: false # Dit stuurt een extra pakket aan het eind van elke tick om de kans op het vangen van valsspelers te vergroten # Dit injecteert in de verbindingslijst van de server om een laatste pakket te sturen net voordat de server doorspoelt # Door dit in te schakelen zal het bandbreedtegebruik voor alle spelers toenemen diff --git a/src/main/resources/config/pt.yml b/src/main/resources/config/pt.yml index 386bf6d103..877e15dcb5 100644 --- a/src/main/resources/config/pt.yml +++ b/src/main/resources/config/pt.yml @@ -151,6 +151,8 @@ Reach: # Deve-se cancelar hits que sabemos que são impossíveis? # O alcance de 3.00-3.03 pode acabar passando, por conta da ordem de pacotes, mas continuará registrando violações. block-impossible-hits: true + # Only apply reach checks if the target is a player + ignore-non-player-targets: false # Isso enviará um pacote adicional no final de todos os ticks para aumentar a probabilidade de detectarmos trapaceiros. # Isso injeta na lista de conecção do servidor para envar um pacote final logo antes do servidor recarregar. # Habilitando isso, irá aumentar o uso de banda para todos os jogadores. diff --git a/src/main/resources/config/ru.yml b/src/main/resources/config/ru.yml index 0cd1bae724..97ebe04e98 100644 --- a/src/main/resources/config/ru.yml +++ b/src/main/resources/config/ru.yml @@ -148,6 +148,8 @@ Reach: # Должны ли мы отменять удары, которые, как мы знаем, невозможны? # Удары 3.00-3.03 могут пройти, но все равно будут замечены из-за ограничений на порядок пакетов. block-impossible-hits: true + # Only apply reach checks if the target is a player + ignore-non-player-targets: false # Это отправит дополнительный пакет в конце каждого тика, чтобы увеличить вероятность поимки читов. # Это встраивается в список соединений сервера для отправки последнего пакета непосредственно перед тем, как сервер будет удален. # Включение этой функции увеличит использование полосы пропускания для всех игроков. diff --git a/src/main/resources/config/tr.yml b/src/main/resources/config/tr.yml index 4e5e23c480..8ddde722b5 100644 --- a/src/main/resources/config/tr.yml +++ b/src/main/resources/config/tr.yml @@ -147,6 +147,8 @@ Reach: # İmkansız olduğunu bildiğimiz vuruşları iptal etmeli miyiz? # Paket sırası sınırlamaları nedeniyle 3.00-3.03 arası vuruşlar gerçekleşebilir, ancak yine de işaretlenebilir block-impossible-hits: true + # Only apply reach checks if the target is a player + ignore-non-player-targets: false # Bu, hileleri yakalama olasılığını artırmak için her tikin sonunda ek bir paket gönderecektir # Bu, sunucunun bağlantı listesine enjekte edilerek sunucu boşaltmadan hemen önce son bir paket göndermek için yapılır # Bunu etkinleştirmek, tüm oyuncular için bant genişliği kullanımını artıracaktır diff --git a/src/main/resources/config/zh.yml b/src/main/resources/config/zh.yml index 01cacd08eb..95a4173926 100644 --- a/src/main/resources/config/zh.yml +++ b/src/main/resources/config/zh.yml @@ -148,6 +148,8 @@ Reach: # 我们应该取消我们知道不可能的命中吗? # 3.00-3.03 命中可能会通过,但仍会被标记,因为数据包顺序限制 block-impossible-hits: true + # Only apply reach checks if the target is a player + ignore-non-player-targets: false # 这将在每个ticks结束时发送一个额外的数据包,以检查作弊的可能性 # 这会注入服务器的连接列表以在服务器刷新之前发送最终数据包 # 启用这将增加所有玩家的带宽使用