Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reach skip option #1794

Open
wants to merge 1 commit into
base: 2.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/main/java/ac/grim/grimac/checks/impl/combat/Reach.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,33 @@
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)
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<Integer, Vector3d> playerAttackQueue = new HashMap<>();

private static final List<EntityType> 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
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/config/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/config/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/config/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/config/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/config/it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/config/nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/config/pt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/config/ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
# Это отправит дополнительный пакет в конце каждого тика, чтобы увеличить вероятность поимки читов.
# Это встраивается в список соединений сервера для отправки последнего пакета непосредственно перед тем, как сервер будет удален.
# Включение этой функции увеличит использование полосы пропускания для всех игроков.
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/config/tr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/config/zh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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结束时发送一个额外的数据包,以检查作弊的可能性
# 这会注入服务器的连接列表以在服务器刷新之前发送最终数据包
# 启用这将增加所有玩家的带宽使用
Expand Down