Make individual check timings configurable
This commit is contained in:
14 files changed
+45
-40
No files matched your search
@@ -56,7 +56,7 @@ public final class AntiBot {
|
||||
return shouldPerform(Sonar.get0().getConfig().getVerification().getMap().getTiming());
|
||||
}
|
||||
|
||||
private static boolean shouldPerform(final SonarConfiguration.Verification.Timing timing) {
|
||||
public static boolean shouldPerform(final SonarConfiguration.Verification.Timing timing) {
|
||||
return timing == SonarConfiguration.Verification.Timing.ALWAYS
|
||||
|| (timing == SonarConfiguration.Verification.Timing.DURING_ATTACK
|
||||
&& Sonar.get0().getAttackTracker().getCurrentAttack() != null);
|
||||
|
||||
@@ -167,12 +167,12 @@ public final class SonarConfiguration {
|
||||
Sonar.get0().getLogger().warn(" ");
|
||||
}
|
||||
|
||||
verification.gravity.enabled = generalConfig.getBoolean("verification.checks.gravity.enabled");
|
||||
verification.gravity.checkCollisions = generalConfig.getBoolean("verification.checks.collision.enabled");
|
||||
verification.gravity.timing = Verification.Timing.valueOf(generalConfig.getString("verification.checks.gravity.timing"));
|
||||
verification.gravity.collisionTiming = Verification.Timing.valueOf(generalConfig.getString("verification.checks.collision.timing"));
|
||||
verification.gravity.captchaOnFail = generalConfig.getBoolean("verification.checks.gravity.captcha-on-fail");
|
||||
verification.gravity.maxMovementTicks = clamp(generalConfig.getInt("verification.checks.gravity.max-movement-ticks"), 2, 100);
|
||||
|
||||
verification.vehicle.enabled = generalConfig.getBoolean("verification.checks.vehicle.enabled");
|
||||
verification.vehicle.timing = Verification.Timing.valueOf(generalConfig.getString("verification.checks.vehicle.timing"));
|
||||
verification.vehicle.minimumPackets = clamp(generalConfig.getInt("verification.checks.vehicle.minimum-packets"), 0, 20);
|
||||
|
||||
verification.map.timing = Verification.Timing.valueOf(generalConfig.getString("verification.checks.map-captcha.timing"));
|
||||
@@ -380,15 +380,15 @@ public final class SonarConfiguration {
|
||||
|
||||
@Getter
|
||||
public static final class Gravity {
|
||||
private boolean enabled;
|
||||
private boolean checkCollisions;
|
||||
private Timing timing;
|
||||
private Timing collisionTiming;
|
||||
private boolean captchaOnFail;
|
||||
private int maxMovementTicks;
|
||||
}
|
||||
|
||||
@Getter
|
||||
public static final class Vehicle {
|
||||
private boolean enabled;
|
||||
private Timing timing;
|
||||
private int minimumPackets;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ package xyz.jonesdev.sonar.common.verification;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import xyz.jonesdev.sonar.api.Sonar;
|
||||
import xyz.jonesdev.sonar.api.antibot.AntiBot;
|
||||
import xyz.jonesdev.sonar.api.antibot.SonarUser;
|
||||
import xyz.jonesdev.sonar.api.antibot.protocol.ProtocolVersion;
|
||||
import xyz.jonesdev.sonar.common.protocol.SonarPacket;
|
||||
@@ -38,8 +39,10 @@ public final class GravityHandler extends VerificationHandler {
|
||||
// Bedrock users start falling immediately
|
||||
this.canFall = user.isGeyser();
|
||||
// We don't want to check Geyser players for valid gravity, as this might cause issues because of the protocol
|
||||
this.enableGravityCheck = !user.isGeyser() && Sonar.get0().getConfig().getVerification().getGravity().isEnabled();
|
||||
this.enableCollisionsCheck = !user.isGeyser() && Sonar.get0().getConfig().getVerification().getGravity().isCheckCollisions();
|
||||
this.enableGravityCheck = !user.isGeyser() && AntiBot.shouldPerform(
|
||||
Sonar.get0().getConfig().getVerification().getGravity().getTiming());
|
||||
this.enableCollisionsCheck = !user.isGeyser() && AntiBot.shouldPerform(
|
||||
Sonar.get0().getConfig().getVerification().getGravity().getCollisionTiming());
|
||||
|
||||
// First, write the JoinGame packet to the buffer
|
||||
user.delayedWrite(joinGame);
|
||||
|
||||
@@ -19,6 +19,7 @@ package xyz.jonesdev.sonar.common.verification;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import xyz.jonesdev.sonar.api.Sonar;
|
||||
import xyz.jonesdev.sonar.api.antibot.AntiBot;
|
||||
import xyz.jonesdev.sonar.api.antibot.SonarUser;
|
||||
import xyz.jonesdev.sonar.api.antibot.protocol.ProtocolVersion;
|
||||
import xyz.jonesdev.sonar.common.protocol.SonarPacket;
|
||||
@@ -163,7 +164,8 @@ public final class ProtocolHandler extends VerificationHandler {
|
||||
|
||||
private void markSuccess() {
|
||||
// Pass the player to the next best verification handler
|
||||
if (!user.isGeyser() && Sonar.get0().getConfig().getVerification().getVehicle().isEnabled()) {
|
||||
if (!user.isGeyser()
|
||||
&& AntiBot.shouldPerform(Sonar.get0().getConfig().getVerification().getVehicle().getTiming())) {
|
||||
user.channel().pipeline().get(SonarPacketDecoder.class).setListener(new VehicleHandler(user));
|
||||
} else if (user.isForceCaptcha() || Sonar.get0().getAntiBot().shouldPerformCaptcha()) {
|
||||
user.channel().pipeline().get(SonarPacketDecoder.class).setListener(new CaptchaHandler(user));
|
||||
|
||||
@@ -80,7 +80,7 @@ verification:
|
||||
# Všechny předpokládané pohyby jsou předpočítány, kvůli ušetření výkonu
|
||||
gravity:
|
||||
# Měl by Sonar zkoušet pro gravitaci hráče (Doporučováno)
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
# Měl by Sonar přimět hráče, aby vyřešil CAPTCHA, pokud neuspějí při kontrole gravitace?
|
||||
captcha-on-fail: false
|
||||
# Maximální počet ticků, který má hráč padat aby byl puštěn na verifikační platformu
|
||||
@@ -89,12 +89,12 @@ verification:
|
||||
# Kontroluje, zda hráč naráží do bloků, které se vytvořily pod ním
|
||||
collision:
|
||||
# Měl by Sonar zkoušet jestli se hráč dotýka bloku? (Doporučováno)
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
|
||||
# Kontroluje, zda klient odesílá správné pakety při montáži vozidla
|
||||
vehicle:
|
||||
# Měl by sonar kontrolovat, zda hráč správně vstoupil na loď?
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
# Minimální počet paketů odeslaných klientem
|
||||
minimum-packets: 2
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ verification:
|
||||
# Alle vorhergesagten Bewegungen werden vorausberechnet, um die Leistung zu sparen
|
||||
gravity:
|
||||
# Soll Sonar auf gültige Client-Gravitation prüfen? (Empfohlen)
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
# Soll Sonar den Spieler dazu bringen, ein CAPTCHA zu lösen, wenn er die Schwerkraftprüfung nicht besteht?
|
||||
captcha-on-fail: false
|
||||
# Maximale Anzahl an Ticks, die der Spieler fallen muss, um die Plattform erreichen zu dürfen
|
||||
@@ -86,12 +86,12 @@ verification:
|
||||
# Prüft, ob der Spieler mit Blöcken kollidiert, die unter ihm gespawnt sind
|
||||
collision:
|
||||
# Soll Sonar prüfen, ob der Spieler mit Blöcken kollidiert? (Empfohlen)
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
|
||||
# Überprüft, ob der Spieler beim Einsteigen in ein Boot die richtigen Pakete sendet
|
||||
vehicle:
|
||||
# Sollte Sonar prüfen, ob der Spieler richtig in ein Fahrzeug einsteigt?
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
# Mindestanzahl der vom Client gesendeten Pakete
|
||||
minimum-packets: 2
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ verification:
|
||||
# All predicted motions are precalculated to save performance
|
||||
gravity:
|
||||
# Should Sonar check for valid client gravity? (Recommended)
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
# Should Sonar make the player solve a CAPTCHA if they fail the gravity check?
|
||||
captcha-on-fail: false
|
||||
# The number of ticks the player has to fall to be allowed to hit the platform
|
||||
@@ -88,12 +88,12 @@ verification:
|
||||
# Checks if the player is colliding with blocks spawned below them
|
||||
collision:
|
||||
# Should Sonar check if the player collides with blocks? (Recommended)
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
|
||||
# Checks if the client sends proper packets when entering a boat
|
||||
vehicle:
|
||||
# Should Sonar check if the player properly enters a boat?
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
# Minimum number of packets sent by the client
|
||||
minimum-packets: 2
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ verification:
|
||||
# Tous les mouvements prévus sont précalculés afin d'économiser les performances
|
||||
gravity:
|
||||
# Sonar devrait-il vérifier la gravité du client ? (Recommandé)
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
# Sonar devrait-il faire résoudre un CAPTCHA au joueur s'il échoue à la vérification de la gravité ?
|
||||
captcha-on-fail: false
|
||||
# Nombre maximum de ticks que le joueur a pour tomber avant de pouvoir toucher la plateforme
|
||||
@@ -88,12 +88,12 @@ verification:
|
||||
# Vérifie si le joueur entre en collision avec les blocs apparus en dessous de lui
|
||||
collision:
|
||||
# Sonar devrait-il vérifier si le joueur entre en collision avec des blocs ? (Recommandé)
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
|
||||
# Vérifie si le client envoie les paquets appropriés lorsqu'il monte dans un véhicule
|
||||
vehicle:
|
||||
# Sonar devrait-il vérifier si le joueur entre correctement dans un bateau ?
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
# Nombre minimum de paquets envoyés par le client
|
||||
minimum-packets: 2
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ verification:
|
||||
# ყველა პროგნოზირებული მოძრაობა წინასწარ არის გათვლილი შესრულების სისწრაფის შესანარჩუნებლად
|
||||
gravity:
|
||||
# უნდა შეამოწმოს თუ არა Sonar-მა მოთამაშის (ან ბოტის) გრავიტაცია? (რეკომენდებულია)
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
# უნდა აიძულოს თუ არა Sonar-მა მოთამაშეს შეასრულოს CAPTCHA, თუ ისინი ვერ შეასრულებენ სიმძიმის შემოწმებას?
|
||||
captcha-on-fail: false
|
||||
# ტიკების მაქსიმალური რაოდენობა რომელითაც მოთამაშე უნდა დაეცეს, რათა პლატფორმაზე დაცემა შეეძლოს. (20 ტიკი = 1 წამი)
|
||||
@@ -88,12 +88,12 @@ verification:
|
||||
# ამოწმებს, ეჯახება თუ არა მოთამაშე მათ ქვემოთ წარმოქმნილ ბლოკებს
|
||||
collision:
|
||||
# უნდა შეამოწმოს თუ არა Sonar-მა, ეტაკება თუ არა მოთამაშე ბლოკებს? (რეკომენდებულია)
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
|
||||
# ამოწმებს, აგზავნის თუ არა კლიენტი შესაბამის პაკეტებს სატრანსპორტო საშუალებაზე დაჯდომის დროს
|
||||
vehicle:
|
||||
# უნდა შეამოწმოს თუ არა სონარმა მოთამაშე სწორად შესული თუ არა ნავში?
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
# კლიენტის მიერ გაგზავნილი პაკეტების მინიმალური რაოდენობა
|
||||
minimum-packets: 2
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ verification:
|
||||
# Alle voorspelde bewegingen worden vooraf berekend om prestaties te besparen
|
||||
gravity:
|
||||
# Moet Sonar controleren op geldige zwaartekracht van de cliënt? (Aanbevolen)
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
# Moet Sonar de speler een CAPTCHA laten oplossen als hij niet slaagt voor de zwaartekracht controle?
|
||||
captcha-on-fail: false
|
||||
# Maximaal aantal ticks dat de speler moet laten vallen om het platform te mogen raken
|
||||
@@ -88,12 +88,12 @@ verification:
|
||||
# Controleert of de speler botst met blokken die onder hem zijn gespawned
|
||||
collision:
|
||||
# Moet Sonar controleren of de speler tegen blokken botst? (Aanbevolen)
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
|
||||
# Controleert of de klant de juiste pakketten verzendt bij het monteren van een voertuig
|
||||
vehicle:
|
||||
# Moet Sonar controleren of de speler goed in een boot stapt?
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
# Minimaal aantal pakketten verzonden door de cliënt
|
||||
minimum-packets: 2
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ verification:
|
||||
# Wszystkie przewidywane ruchy są wstępnie obliczane w celu zachowania wydajności
|
||||
gravity:
|
||||
# Czy Sonar powinien sprawdzać poprawność grawitacji gracza? (Zalecane)
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
# Czy Sonar powinien zmusić gracza do rozwiązania CAPTCHA, jeśli nie uda mu się przejść testu grawitacji?
|
||||
captcha-on-fail: false
|
||||
# Maksymalna liczba tików, po których gracz musi spaść, aby móc uderzyć w platformę.
|
||||
@@ -88,12 +88,12 @@ verification:
|
||||
# Sprawdza, czy gracz zderza się z blokami, które pojawiły się pod nim
|
||||
collision:
|
||||
# Czy Sonar powinien sprawdzać, czy gracz zderza się z blokami? (Zalecane)
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
|
||||
# Sprawdza, czy gracz wysyła odpowiednie pakiety podczas umieszczania na pojeździe.
|
||||
vehicle:
|
||||
# Czy Sonar powinien sprawdzać, czy gracz prawidłowo wsiada do łodzi?
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
# Minimalna liczba pakietów wysłanych przez klienta
|
||||
minimum-packets: 2
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ verification:
|
||||
# Todos os movimentos previstos são pré-calculados para economizar desempenho
|
||||
gravity:
|
||||
# O Sonar deve verificar a gravidade do cliente? (Recomendado)
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
# O Sonar deve fazer o jogador resolver um CAPTCHA se falhar na verificação de gravidade?
|
||||
captcha-on-fail: false
|
||||
# O número de ticks que o jogador deve cair para ser permitido atingir a plataforma
|
||||
@@ -87,12 +87,12 @@ verification:
|
||||
# Verifica se o jogador está colidindo com blocos gerados abaixo dele
|
||||
collision:
|
||||
# O Sonar deve verificar se o jogador colide com blocos? (Recomendado)
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
|
||||
# Verifica se o cliente envia pacotes adequados ao entrar em um barco
|
||||
vehicle:
|
||||
# O Sonar deve verificar se o jogador entra corretamente em um barco?
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
# Número mínimo de pacotes enviados pelo cliente
|
||||
minimum-packets: 2
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ verification:
|
||||
# Все предсказанные движения предварительно просчитываются для экономии производительности
|
||||
gravity:
|
||||
# Должен ли Sonar проверять наличие действительной гравитации клиента? (Рекомендуется)
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
# Должен ли Sonar заставлять игрока решать CAPTCHA, если он не проходит проверку на гравитацию?
|
||||
captcha-on-fail: false
|
||||
# Максимальное количество тиков, на которое должен упасть игрок, чтобы ему было разрешено упасть на платформу
|
||||
@@ -88,12 +88,12 @@ verification:
|
||||
# Проверяет, сталкивается ли игрок с блоками, порожденными под ним
|
||||
collision:
|
||||
# Должен ли Sonar проверять, сталкивается ли игрок с блоками? (Рекомендуется)
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
|
||||
# Проверяет, отправляет ли клиент правильные пакеты при садке на транспортное средство
|
||||
vehicle:
|
||||
# Должен ли сонар проверять, правильно ли игрок входит в лодку?
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
# Минимальное количество пакетов, отправляемых клиентом
|
||||
minimum-packets: 2
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ verification:
|
||||
# 检查玩家的下落移动是否遵循原版客户端.
|
||||
gravity:
|
||||
# Sonar 是否应该检查玩家的下落移动? (推荐启用)
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
# 当玩家验证失败时 是否向他们发送地图验证码?
|
||||
captcha-on-fail: false
|
||||
# 玩家跌落在平台上多少tick后才能被算作站在平台上?
|
||||
@@ -87,12 +87,12 @@ verification:
|
||||
# 检查玩家是否可以正确地站在方块上
|
||||
collision:
|
||||
# Sonar 是否应该生成方块平台以检查玩家下落与方块之间的碰撞? (推荐启用)
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
|
||||
# 检查客户端坐在实体上时是否发送了正确的数据包
|
||||
vehicle:
|
||||
# Sonar 是否应该让玩家坐在实体上, 以便检查他们的数据包是否合法?
|
||||
enabled: true
|
||||
timing: ALWAYS
|
||||
# 客户端需要发送的所需的最小数据包数量
|
||||
minimum-packets: 2
|
||||
|
||||
|
||||
Reference in new issue
Block a user